Bug 694752 - Default browser application
Summary: Default browser application
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: gtk2
Version: 14
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Matthias Clasen
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: abrt_hash:fc39feb4
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-04-08 09:45 UTC by Raphael Groner
Modified: 2011-05-05 15:04 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-05-05 15:04:21 UTC
Type: ---


Attachments (Terms of Use)
File: backtrace (701 bytes, text/plain)
2011-04-08 09:46 UTC, Raphael Groner
no flags Details
Unofficial pre-patch to open url with xdg-open (569 bytes, patch)
2011-05-01 19:22 UTC, Raphael Groner
no flags Details | Diff

Description Raphael Groner 2011-04-08 09:45:59 UTC
abrt version: 1.1.17
architecture: x86_64
cmdline: /usr/bin/python /usr/share/yumex/yumex.pyc
comment: Where to configure the browser usage?
component: yumex
executable: /usr/share/yumex/yumex.pyc
kernel: 2.6.35.11-83.fc14.x86_64
package: yumex-3.0.2-1.fc14
Attached file: reason, 150 bytes
release: Fedora release 14 (Laughlin)
time: 1302255749
uid: 500

backtrace
-----
gui.py:227:_url_handler:GError: Kindprozess /usr/lib/firefox-3.5.6/firefox konnte nicht ausgefhrt werden (Datei oder Verzeichnis nicht gefunden)

Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/guihelpers/__init__.py", line 57, in on_url_event
    self.url_handler(tag.get_property("name"))
  File "/usr/lib/python2.7/site-packages/yumexgui/gui.py", line 227, in _url_handler
    gtk.show_uri(None, url, gtk.gdk.CURRENT_TIME)
GError: Kindprozess /usr/lib/firefox-3.5.6/firefox konnte nicht ausgefhrt werden (Datei oder Verzeichnis nicht gefunden)

Local variables in innermost frame:
url: 'http://cola.tuxfamily.org/'
self: <yumexgui.gui.PackageInfo instance at 0x26ab7e8>

How to reproduce
-----
1. click on an url in the package description
2.
3.

Comment 1 Raphael Groner 2011-04-08 09:46:02 UTC
Created attachment 490746 [details]
File: backtrace

Comment 2 Tim Lauridsen 2011-04-09 07:31:08 UTC
I use a gtk function to open an URL, using the default browser on your system
There must be some be something not configured right on your system

Try to change your default browser in your system preferences (Gnome)

Comment 3 Raphael Groner 2011-04-10 08:31:11 UTC
Package: yumex-3.0.2-1.fc14
Architecture: x86_64
OS Release: Fedora release 14 (Laughlin)


How to reproduce
-----
1. click on an url in the package description
2.
3.


Comment
-----
Where to configure the browser usage?

Comment 4 Raphael Groner 2011-04-10 17:10:37 UTC
Package: yumex-3.0.2-1.fc14
Architecture: x86_64
OS Release: Fedora release 14 (Laughlin)


How to reproduce
-----
1. click on an url in the package description
2.
3.


Comment
-----
Where to configure the browser usage?
- Changed preferred browser application from Midori to Firefox and back again, always same result.
- I am wondering where this (non-existing) path gets taken from.

Comment 5 Raphael Groner 2011-04-24 16:30:45 UTC
$ python
Python 2.7 (r27:82500, Sep 16 2010, 18:02:00) 
[GCC 4.5.1 20100907 (Red Hat 4.5.1-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> url="http://cola.tuxfamily.org/"
>>> import gtk
>>> url="http://cola.tuxfamily.org/"
>>> url
'http://cola.tuxfamily.org/'
>>> gtk.show_uri(None, url, gtk.gdk.CURRENT_TIME)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
glib.GError: Kindprozess »/usr/lib/firefox-3.5.6/firefox« konnte nicht ausgeführt werden (Datei oder Verzeichnis nicht gefunden)

Comment 6 Raphael Groner 2011-04-24 16:43:16 UTC
$ python -c "import gtk; gtk.show_uri(None, 'http://cola.tuxfamily.org/', gtk.gdk.CURRENT_TIME)"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
glib.GError: Kindprozess »/usr/lib/firefox-3.5.6/firefox« konnte nicht ausgeführt werden (Datei oder Verzeichnis nicht gefunden)

Comment 7 Raphael Groner 2011-04-24 19:29:30 UTC
Tim,
why don't you just use xdg-open (from xdg-utils package of freedesktop.org)? Maybe take a look into the source of claws-mail how it is solved there.

Comment 8 Tim Lauridsen 2011-04-28 12:21:03 UTC
(In reply to comment #7)
> Tim,
> why don't you just use xdg-open (from xdg-utils package of freedesktop.org)?
> Maybe take a look into the source of claws-mail how it is solved there.

Because yumex uses gtk for the gui and gtk has gtk.show_uri() there should the do the right thing ( in most cases :) )

Comment 9 Raphael Groner 2011-05-01 19:22:06 UTC
Created attachment 496114 [details]
Unofficial pre-patch to open url with xdg-open

This is an unofficial pre-patch to get an url opened with the user's preferred browser application, not let gtk guess for its own and any more what browser is there.

I am still trying to fix that issue with glib.find_program_in_path() due to not working (reported as another new bug, see below). When I have also a fix for that, I would like to suggest another patch that still uses gtk.show_uri() as a fallback if there's no xdg-open available.

Comment 10 Tim Lauridsen 2011-05-02 06:05:29 UTC
Looks good to me

I have add the preliminary patch to yumex

https://github.com/timlau/yumex/commit/fcc0a1b50d7f65b10c4b6a4679236138a698d91b

Comment 11 Raphael Groner 2011-05-03 17:52:15 UTC
What happens if there is no xdg-open available in the system? 
With the preliminary patch applied, it should ignore the click on the link (not compatible downwards). Maybe it is good to check the success of xdg-open and fall back to gtk.show_uri() also in the error case.

Comment 12 Tim Lauridsen 2011-05-04 14:41:24 UTC
I have made it a little better now

https://github.com/timlau/yumex/commit/280c09a8af7286956bc7ae15a0398ac4eb5168ef

Comment 13 Raphael Groner 2011-05-04 15:21:19 UTC
Great!

So does the new patch mean that it is not needed to fix the segfault in glib.find_program_in_path() for yumex to work with xdg-open? If yes, nice work done. :)

Could you add then xdg-open (in package xdg-utils) as an optional / suggested package dependency to go with the recommended official freedesktop standard?

Comment 14 Tim Lauridsen 2011-05-04 17:42:35 UTC
Yes, there is no need for glib.find_program_in_path() in yumex.
optional / suggested package dependency don't make much sense in fedora as it is not supported by rpm/yum.

Comment 15 Raphael Groner 2011-05-04 19:20:23 UTC
This is definitely a feature request especially for yumex.

I try with a new user and yumex starts firefox correctly, though not set as the preferred / default browser to use. I don't know why firefox-3.5.6 is mentioned in the absolute path for the original user. So please change the assignee and component back to yumex.

Tim, there's a potential risk of shell injection (according to the python documentation) with your last patch to yumex. It is not with os.popen. If you prefer to use subprocess.call, maybe set the url value into quotes before calling xdg-open to prevent following given commands being executed as such. 
Anyways, I don't think that a packager will misuse the URL to do some nasty shell injection out of an official package, but what about unofficial packages being installed by a bad user?

Comment 16 Tim Lauridsen 2011-05-05 05:13:37 UTC
<paranoid mode>
Ok, we don't want that :)

https://github.com/timlau/yumex/commit/9ae6791a1e5b601726322f3ad0fc9782bd4620cd4
</paranoid mode>

Comment 18 Tim Lauridsen 2011-05-05 05:16:32 UTC
I must need some coffee :)

One more try to get the right url

https://github.com/timlau/yumex/commit/9ae6791a1e5b601726322f3ad0fc9782bd4620cd

Comment 19 Raphael Groner 2011-05-05 15:04:21 UTC
Alright. I got the latest sources from git and build a package for my own. It looks good.
I am looking forward to the next official release :)


Note You need to log in before you can comment on or make changes to this bug.