> -----Original Message----- > From: interest-bounces+kai.koehne=theqtcompany....@qt-project.org > [mailto:interest-bounces+kai.koehne=theqtcompany....@qt-project.org] > On Behalf Of alexander golks > Sent: Thursday, November 27, 2014 3:55 PM > To: interest > Subject: [Interest] QDir::cdUp looping forever > > hi, > > i am running windows 7, using qt-online 5.3.2. > > when executing following code on a network share as working directory, e.g. > "//server/data/": > > QDir dir=QDir::current(); > qDebug()<<"start dir="<<dir; > while(dir.cdUp()) > qDebug()<<"up dir="<<dir; > > this will print: > > start dir= QDir( "//server/data" , nameFilters = { * }, QDir::SortFlags( > Name | > IgnoreCase ) , QDir::Filters( Dirs|Files|Drives|AllEntries ) ) up dir= QDir( > "//server" , nameFilters = { * }, QDir::SortFlags( Name | IgnoreCase ) , > QDir::Filters( Dirs|Files|Drives|AllEntries ) ) up dir= QDir( "//server.." , > nameFilters = { * }, QDir::SortFlags( Name | IgnoreCase ) , QDir::Filters( > Dirs|Files|Drives|AllEntries ) ) up dir= QDir( "//server...." , nameFilters > = { * > }, QDir::SortFlags( Name | IgnoreCase ) , QDir::Filters( > Dirs|Files|Drives|AllEntries ) ) up dir= QDir( "//server......" > > and on and on. > > the problem seems to be: > > bool QDir::cd(const QString &dirName) > //... > if (isRoot()) > newPath = d->dirEntry.filePath(); > else > newPath = d->dirEntry.filePath() % QLatin1Char('/'); > newPath += dirName; > > > whereas qt 4.8.6 has an additional check there: > > //... > if (isRoot()) { > if (dirName == QLatin1String("..")) > return false; > newPath = d->dirEntry.filePath(); > } else { > newPath = d->dirEntry.filePath() % QLatin1Char('/'); > } > newPath += dirName;
Looks to me like a regression indeed. This got introduced with commit https://codereview.qt-project.org/#/c/14517/9 ... > is this a regression, or what? > > can't we do just a > > //... > newPath = d->dirEntry.filePath() % QLatin1Char('/') + dirName; > > and let the rest of code clean and fix the path? The whole thing is pretty fragile due to the myriad of ways for valid paths on different operating systems. But yeah, how about you give it a try ? :) Regards Kai > alex > > -- > /* > * There is an old time toast which is golden for its beauty. > * "When you ascend the hill of prosperity may you not meet a friend." > * -- Mark Twain > */ _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest