xdg-icon-resource does not support filenames with spaces

Bug #1488787 reported by MestreLion
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Xdg-utils
Fix Released
Medium
xdg-utils (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

As reported in an upstream bug, xdg-icon-resource does not handle paths (either filenames or dir names) containing spaces.

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

A patch is provided to be applied downstream in Ubuntu as a new upstream release of xdg-utils might take a while (the last one is from 2011!)

Tags: patch
Revision history for this message
In , MestreLion (mestrelion) wrote :

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.

Revision history for this message
In , MestreLion (mestrelion) wrote :

Created attachment 117918
Quote a single occurrence to fix this bug

Revision history for this message
In , MestreLion (mestrelion) wrote :

Created attachment 117919
Quote other occurrences that might cause trouble in the future

Revision history for this message
MestreLion (mestrelion) wrote :
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "Quote var" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Changed in xdg-utils:
importance: Unknown → Medium
status: Unknown → Confirmed
Revision history for this message
In , Rdieter-math (rdieter-math) wrote :
Revision history for this message
Michael Terry (mterry) wrote :

Thanks for the patch! I uploaded this to wily.

Revision history for this message
MestreLion (mestrelion) wrote :

@Michael, if possible, please also apply to Ubuntu the other related patches committed in upstream git, mentioned at https://bugs.freedesktop.org/show_bug.cgi?id=66605 and https://bugs.freedesktop.org/show_bug.cgi?id=91758

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package xdg-utils - 1.1.0~rc3+git20150907-1ubuntu2

---------------
xdg-utils (1.1.0~rc3+git20150907-1ubuntu2) wily; urgency=medium

  [ MestreLion <email address hidden> ]
  * debian/patches/filenames-with-spaces.patch:
    - Fix xdg-icon-resource not handling files with spaces (LP: #1488787)

 -- Michael Terry <email address hidden> Wed, 16 Sep 2015 16:31:44 -0400

Changed in xdg-utils (Ubuntu):
status: New → Fix Released
Changed in xdg-utils:
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.