Bug 749213 - QUrl.toLocalFile behavior change, regression
Summary: QUrl.toLocalFile behavior change, regression
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: qt
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Than Ngo
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: qt-4.8
TreeView+ depends on / blocked
 
Reported: 2011-10-26 13:47 UTC by Rex Dieter
Modified: 2013-10-04 12:33 UTC (History)
8 users (show)

Fixed In Version: qt-4.8.0-0.23.rc1.fc16
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-10-29 06:30:38 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
KDE Software Compilation 285028 0 None None None Never
Qt Bug Tracker QTBUG-22380 0 None None None Never
Qt Bug Tracker QTBUG-22382 0 None None None Never

Description Rex Dieter 2011-10-26 13:47:16 UTC
Test case:


python -c "from PyQt4 import QtCore; print 'File: %s' % QtCore.QUrl('KDE-K3B-Finish-Success.ogg').toLocalFile()"

In qt-4.7.x:

File: KDE-K3B-Finish-Success.ogg

In qt-4.8.0-rc1:

File:



The impact is this affects KUrl too, and audio system notifications without full paths fail.

Comment 1 Rex Dieter 2011-10-26 14:03:56 UTC
Filed upstream,
https://bugreports.qt.nokia.com/browse/QTBUG-22380

Comment 2 Rex Dieter 2011-10-26 15:25:31 UTC
sorry, closed the older one too quick, cloned/re-opened as
https://bugreports.qt.nokia.com/browse/QTBUG-22382

Comment 3 Rex Dieter 2011-10-26 18:13:06 UTC
and tracking KUrl impact upstream,
http://bugs.kde.org/285028

Comment 4 Rex Dieter 2011-10-26 20:03:01 UTC
Pretty sure this is the upstream Qt commit the introduced this:

http://qt.gitorious.org/qt/qt/commit/a2f797b52c4274a62a7cf1f0939aca1429afe211

Comment 5 Kevin Kofler 2011-10-26 20:54:05 UTC
Easiest fix (reverting the logic change only without reverting the API addition and the cleanups):

In the (new) isLocalFile function, before:

if (d->scheme.compare(QLatin1String("file"), Qt::CaseInsensitive) != 0)

add the following:

// Treat URLs with no scheme as local for backwards compatibility
if (d->scheme.isEmpty())
    return true;

(Not tested yet, but looking at the offending commit, it should fix this.)

Comment 6 Kevin Kofler 2011-10-27 16:19:25 UTC
It turns out that the behavior of the new QUrl::isLocalFile() is consistent with the existing KUrl::isLocalFile() and Q3Url::isLocalFile() functions, so an alternative easy fix:

In the toLocalFile function, change:

if (!isLocalFile())

to:

// Treat URLs with no scheme as local for backwards compatibility
if (!d->scheme.isEmpty() && !isLocalFile())

(Again, not tested yet, but should work based on my proofreading, and fix this regression in the least invasive way possible.)

Comment 7 Kevin Kofler 2011-10-27 19:08:56 UTC
Actually, please use:

// Treat URLs with no scheme as local for backwards compatibility
if (!isLocalFile() && !d->scheme.isEmpty())

in this order, because isLocalFile() also ensures the URL is parsed (as written in the comment above the line we're changing).

Comment 8 Kevin Kofler 2011-10-27 21:50:07 UTC
Actually, please use:

// Treat URLs with no scheme as local for backwards compatibility
if (!isLocalFile() && (!d || !d->scheme.isEmpty()))

Some code (e.g. in Digikam) is calling isLocalFile() on a null QUrl(), without the added !d check, it crashes trying to check !d->scheme.isEmpty().

(I use !d || rather than d && because if d is NULL, we really SHOULD return a QString() (what else?).)

Comment 9 Fedora Update System 2011-10-28 14:58:02 UTC
qt-4.8.0-0.21.rc1.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/qt-4.8.0-0.21.rc1.fc16

Comment 10 Fedora Update System 2011-10-28 22:02:58 UTC
qt-4.8.0-0.23.rc1.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/qt-4.8.0-0.23.rc1.fc16

Comment 11 Fedora Update System 2011-10-29 06:30:38 UTC
qt-4.8.0-0.23.rc1.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 12 Red Hat Bugzilla 2013-10-04 00:21:23 UTC
Removing external tracker bug with the id '22380' as it is not valid for this tracker

Comment 13 Red Hat Bugzilla 2013-10-04 00:21:27 UTC
Removing external tracker bug with the id '22382' as it is not valid for this tracker


Note You need to log in before you can comment on or make changes to this bug.