After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 733189 - Careless URI construction in GTK+
Careless URI construction in GTK+
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: .General
3.13.x
Other Windows
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2014-07-15 08:44 UTC by LRN
Modified: 2014-07-15 19:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Use file:/// URI prefix on W32 (1.71 KB, application/octet-stream)
2014-07-15 08:44 UTC, LRN
  Details
GktIconTheme: Be even more careful with paths (1.67 KB, patch)
2014-07-15 17:22 UTC, LRN
committed Details | Review

Description LRN 2014-07-15 08:44:22 UTC
Created attachment 280691 [details]
Use file:/// URI prefix on W32

> uri = g_strconcat ("file://", icon_info->filename, NULL);
> ...
> g_file_new_for_uri (uri=uri@entry=0x4327970 "file://F:\\e31\\mingw\\share\\icons\\Adwaita\\16x16/status\\image-missing.png") at gfile.c:6302

that doesn't end well - URI handler in glib does no understand URIs that look like "file://X:...".
Apparently, "file://" means that the path part of the URI is a relative path, and CWD is prepended to it.
Or, as it's been pointed out for me, the part before first "/" is considered to be a "host", and the rest is a "path". Since the URI does contain a single "/" (by accident - both "/" and "\\" work as dir separators on W32, so this is allowed), the whole thing before it is "host", and the rest is a "path". That still doesn't explain why i get something like this:
> 1345      fd = g_open (local->filename, O_RDONLY|O_BINARY, 0);
> (gdb) p local->filename
> $26 = (gchar *) "F:\\e31\\mingw\\bin\\file:\\F:\\e31\\mingw\\share\\icons\\Adwaita\\16x16\\status\\image-missing.png"
down the road with such URI.

Currently https://git.gnome.org/browse/gtk+/commit/?id=5a252f13a863c00ccd9901afa110e85836a6af4c is pushed as a fix. It probably works (haven't had a chance to test it), but there are other ways.

One way is to use "file:///" prefix, which would cause the path part of the URI to be used as-is (and assumed to be absolute path). I've attached a patch (probably not good enough for pushing) that does fix things for me this way.

Another way is to change g_file_new_for_uri() (that is, glib) to be able to handle "file://X:..." URIs (at least on Windows).
Comment 1 Matthias Clasen 2014-07-15 10:57:59 UTC
lets go with the fix thats in place now
Comment 2 LRN 2014-07-15 17:22:17 UTC
Created attachment 280748 [details] [review]
GktIconTheme: Be even more careful with paths

This is a followup for 5a252f13a863c00ccd9901afa110e85836a6af4c
Comment 3 Emmanuele Bassi (:ebassi) 2014-07-15 17:53:24 UTC
Review of attachment 280748 [details] [review]:

looks good.
Comment 4 LRN 2014-07-15 19:05:10 UTC
Attachment 280748 [details] pushed as e3d725e - GktIconTheme: Be even more careful with paths