Bug 91758 - xdg-icon-resource does not support filenames with spaces
Summary: xdg-icon-resource does not support filenames with spaces
Status: RESOLVED FIXED
Alias: None
Product: Portland
Classification: Unclassified
Component: xdg-utils (show other bugs)
Version: 1.1.0 rc3
Hardware: All All
: medium normal
Assignee: Portland Bugs
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-26 06:17 UTC by Rodrigo Silva
Modified: 2015-09-16 15:01 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Quote a single occurrence to fix this bug (1.16 KB, patch)
2015-08-26 06:43 UTC, Rodrigo Silva
Details | Splinter Review
Quote other occurrences that might cause trouble in the future (4.96 KB, patch)
2015-08-26 06:44 UTC, Rodrigo Silva
Details | Splinter Review

Description Rodrigo Silva 2015-08-26 06:17:40 UTC
This is similar to bug #66605 but for xdg-icon-resource this time, and has the same cause: unquoted var expansions.

Example:
~ $ xdg-icon-resource install --novendor --size 48 "./foo bar.png" foobar
/usr/bin/xdg-icon-resource: 790: [: /home/xxx/foo: unexpected operator

A real scenario is installing icons from software zip/tarballs where the icon file is in a data dir deep down the archive tree, and paths can not be renamed as the binary executable might have the path to this data dir hardcoded.

A workaround is to copy the icon to a temp dir before using xdg-icon-resource.

The unquoted var to fix this particular case is $icon_icon_file at line 397 of xdg-icon-resource.in ( http://cgit.freedesktop.org/xdg/xdg-utils/tree/scripts/xdg-icon-resource.in#n397 ) (line 790 in 1.0.2, 953 in 1.1.0 rc3), but there are several other unquoted var occurrences in code that might also cause trouble.

I'll post 2 patches, one fixing this critical occurrence only, and another one quoting other vars I've spotted to minimize future issues.
Comment 1 Rodrigo Silva 2015-08-26 06:43:01 UTC
Created attachment 117918 [details] [review]
Quote a single occurrence to fix this bug
Comment 2 Rodrigo Silva 2015-08-26 06:44:09 UTC
Created attachment 117919 [details] [review]
Quote other occurrences that might cause trouble in the future
Comment 3 Rex Dieter 2015-09-16 15:01:00 UTC
Committed, thanks.

http://cgit.freedesktop.org/xdg/xdg-utils/commit/?id=679c72d1432df229e08b0dbe02a67f0bb28039cc

(and followups)


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.