xdg-open breaks on spaces in paths when using generic open method

Bug #220750 reported by John Carlyle-Clarke
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Xdg-utils
Fix Released
Medium
xdg-utils (Ubuntu)
Fix Released
Low
Unassigned

Bug Description

Binary package hint: xdg-utils

xdg-utils 1.0.1-2 on Ubuntu Gutsy

xdg-open tries to detect the desktop environment and falls back to a generic method using run-mailcap. There is a bug in this function that means if the path contains a space, the method fails.

e.g.

johncc@liberator:~$ xdg-open Fire\ stockists.txt
local: 438: stockists.txt: bad variable name
Warning: unknown mime-type for "Fire" -- using "application/*"
Error: no such file "Fire"

There are some missing quotes in the code. I have submitted a patch which works for me. I hope I've done it right - first time submitting a patch!

Tags: bitesize
Revision history for this message
In , Greg Grossmeier (greg.grossmeier) wrote :

Confirmed this behavior in Hardy (xdg-utils 1.0.2-2) with the following:

greg@alexandria:~$echo $GNOME_DESKTOP_SESSION_ID
Default
greg@alexandria:~$unset GNOME_DESKTOP_SESSION_ID
greg@alexandria:~$echo $GNOME_DESKTOP_SESSION_ID

greg@alexandria:~$touch file\ with\ spaces.txt
greg@alexandria:~$xdg-open file\ with\ spaces.txt
local: 438: spaces.txt: bad variable name
Warning: unknown mime-type for "file" -- using "application/*"
Error: no such file "file"
greg@alexandria:~$touch file%20with%20a\ space.txt
greg@alexandria:~$ls | grep file
file%20with%20a space.txt
file with spaces.txt
greg@alexandria:~$xdg-open file%20with%20a\ space.txt
local: 438: space.txt: bad variable name
Warning: unknown mime-type for "file%20with%20a" -- using "application/*"
Error: no such file "file%20with%20a"

After an "export GNOME_DESKTOP_SESSION_ID=Default" the above xdg-open commands work as expected.

Revision history for this message
John Carlyle-Clarke (jpcc) wrote :

Binary package hint: xdg-utils

xdg-utils 1.0.1-2 on Ubuntu Gutsy

xdg-open tries to detect the desktop environment and falls back to a generic method using run-mailcap. There is a bug in this function that means if the path contains a space, the method fails.

e.g.

johncc@liberator:~$ xdg-open Fire\ stockists.txt
local: 438: stockists.txt: bad variable name
Warning: unknown mime-type for "Fire" -- using "application/*"
Error: no such file "Fire"

There are some missing quotes in the code. I have submitted a patch which works for me. I hope I've done it right - first time submitting a patch!

Revision history for this message
John Carlyle-Clarke (jpcc) wrote :
Revision history for this message
Greg Grossmeier (greg.grossmeier) wrote :

Confirmed this behavior in Hardy with the following:

greg@alexandria:~$echo $GNOME_DESKTOP_SESSION_ID
Default
greg@alexandria:~$unset GNOME_DESKTOP_SESSION_ID
greg@alexandria:~$echo $GNOME_DESKTOP_SESSION_ID

greg@alexandria:~$touch file\ with\ spaces.txt
greg@alexandria:~$xdg-open file\ with\ spaces.txt
local: 438: spaces.txt: bad variable name
Warning: unknown mime-type for "file" -- using "application/*"
Error: no such file "file"
greg@alexandria:~$touch file%20with%20a\ space.txt
greg@alexandria:~$ls | grep file
file%20with%20a space.txt
file with spaces.txt
greg@alexandria:~$xdg-open file%20with%20a\ space.txt
local: 438: space.txt: bad variable name
Warning: unknown mime-type for "file%20with%20a" -- using "application/*"
Error: no such file "file%20with%20a"

After an "export GNOME_DESKTOP_SESSION_ID=Default" the above xdg-open commands work as expected.

I did not try the patch.

Changed in xdg-utils:
importance: Undecided → Low
status: New → Confirmed
Revision history for this message
John Carlyle-Clarke (jpcc) wrote :
Changed in xdg-utils:
status: Confirmed → Triaged
Changed in xdg-utils:
status: Unknown → Confirmed
Revision history for this message
In , James Westby (james-w) wrote :

Hi,

I have tested this and it is fixed in 1.0.2

Thanks,

James

Revision history for this message
James Westby (james-w) wrote :

Hi,

This is confirmed fixed on Jaunty.

Thanks,

James

Changed in xdg-utils:
status: Triaged → Fix Released
Changed in xdg-utils:
status: Confirmed → Fix Released
Changed in xdg-utils:
importance: Unknown → Medium
Revision history for this message
Sergey Trofimov (sarg) wrote :

Broken in karmic.
Version: 1.0.2+cvs20100307-1

Revision history for this message
Sergey Trofimov (sarg) wrote :

Sorry, broken in maverick.
Version: 1.0.2+cvs20100307-1
Fixed for myself by settings IFS to null.

Changed in xdg-utils:
importance: Medium → Unknown
Changed in xdg-utils:
importance: Unknown → Medium
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.