Bug 38047

Summary: xdg-open seg fault when using application default set via xdg-mime
Product: Portland Reporter: rwnobrega
Component: xdg-utilsAssignee: Portland Bugs <portland-bugs>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: medium    
Version: 1.1.0 rc1   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description rwnobrega 2011-06-07 12:25:16 UTC
I'm quoting from user "jwhendy" at https://bbs.archlinux.org/viewtopic.php?id=119122
 
I'm posting this here because his fix worked for me.

>>
>> Hi,
>> 
>> I use Chromium and have set xdg-mime to open .pdf files with Evince using:
>> 
>>   $ xdg-mime default evince.desktop application/pdf
>> 
>> I can verify that it's set with:
>> 
>>   $ xdg-mime query default application/pdf
>>   evince.desktop
>> 
>> When I download a pdf in Chromium and open it, it opens in Evince, but when
>> closing Evince, it brings up Firefox as well. I thought this was solved by
>> setting defaults via xdg-mime. I only caught the real potential issue because
>> I used xdg-open to open a pdf directly. After I quit out of Evince, stderr
>> spits out the following at the command line:
>> 
>>   $ xdg-open test.pdf 
>>   /usr/bin/xdg-open: line 396: 19916 Segmentation fault   $command_exec "$1"
>> 
>> This is when Firefox pops open. Quitting firefox ends the xdg-open command.
>> 
>> [...]
>> 
>> Update: This works (line 402 in /usr/bin/xdg-open):
>> 
>> ---( From )---
>> 
>>   $command_exec "$1"
>> 
>> ---( To )---
>> 
>>   eval `"$command_exec" "$1"`
>>
Comment 1 jw.hendy 2011-07-05 09:22:53 UTC
Wow -- what a surprise to find that a bug report was already filed for my find quoted below!

A new version must have reverted my fix, as this just started happening again. Opening downloaded pdfs in Chromium correctly opens in my pdf reader set via xdg-mime, however upon closing that pdf viewer, Firefox will try and open the file as well. Fixing the script as shown at the linked Arch Linux forum post does, indeed, work for me.
Comment 2 Rex Dieter 2011-07-05 09:42:06 UTC
This was fixed along with bug #32487

*** This bug has been marked as a duplicate of bug 32487 ***
Comment 3 jw.hendy 2011-07-30 08:06:04 UTC
(In reply to comment #2)
> This was fixed along with bug #32487
> 
> *** This bug has been marked as a duplicate of bug 32487 ***

@Rex Dieter:

That "duplicate" was fixed with a commit in Dec 2010 -- I find it odd that this would be a duplicate since it's occurring 7 month later. This is certainly not fixed in all cases for me. I have also verified that my version contains the fix from this Dec 2010 bug:

line 420 in /usr/bin/xdg-open
,---
| local file="$x/applications/$default"
`---

some other pertinent information/settings verification:
,---
| $ xdg-mime --version
| xdg-mime 1.0.2
|
| $ xdg-mime query default application/pdf
| evince.desktop
| 
| $ evince --version
| GNOME Document Viewer 2.32.0
`---

Steps:
1) google "test pdf"
2) download first hit: www.education.gov.yk.ca/pdf/pdf-test.pdf
3) open from browser
4) opens in evince
5) quit evince
6) firefox opens up asking me what I want to do with it
7) replicate from command line:

,---
| $ xdg-open pdf-test.pdf 
| /usr/bin/xdg-open: line 419:  6617 Segmentation fault \
|    $command_exec "$1"
`---

Fix:
1) edit /usr/bin/xdg-open
2) edit line 425 from:

,---
| $command_exec "$1"
`---

to:

,---
| eval `"$command_exec" "$1"`
`---

I'm open to other suggestions... but just want to definitively state that this has not been fixed for me. I'm open to other suggestions regarding settings on my system or WM/DE or something else that might be doing this.

For potential assistance:

,---
| $ uname -a
| Linux Macrophage 2.6.39-ARCH #1 SMP PREEMPT Sat Jul 9 14:57:41
| CEST 2011 x86_64 Intel(R) Core(TM)2 CPU T7200 @ 2.00GHz 
| GenuineIntel GNU/Linux
`---

Please ask for any other information.
Comment 4 Rex Dieter 2011-08-10 07:14:05 UTC
Sorry, wrong dup, should've been bug #30453

re-confirmed this should be fixed with commit a616912e48b7ff1d908852739d16525df79471b9

See:
http://cgit.freedesktop.org/xdg/xdg-utils/commit/?id=a616912e48b7ff1d908852739d16525df79471b9

*** This bug has been marked as a duplicate of bug 30453 ***

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.