Please use xdg-open rather than calling firefox

Bug #198449 reported by James Westby on 2008-03-04
138
This bug affects 18 people
Affects Status Importance Assigned to Milestone
Apport
High
Martin Pitt
apport (Ubuntu)
Medium
Martin Pitt

Bug Description

Hi,

xdg-open in xdg-utils is provided to allow apps to open a URL
in their preferred browser. Please consider using this than
hardcoding firefox.

Thanks,

James

James Westby (james-w) wrote :

Hi,

I have just looked at the code and see that it isn't just
firefox that is tried.

You may find that xdg-open is easier to use and works
in more cases, but I'm not sure.

Please feel free to close this if you are happy with what
you have already.

Thanks,

James

Martin Pitt (pitti) wrote :

It indeed looks interesting, thank you for the pointer! One problem
that the current code solves is to call the browser as user when
apport-gtk is started as root (to see system crashes). This doesn't
work straight OOTB with xdg-open, but I'll play with that case.

Changed in apport:
importance: Undecided → Low
status: New → Confirmed
Dereck Wonnacott (dereck) wrote :

I think if this reporter's idea were followed it would solve this issue I found, so I'll put it here rather than a new report.

when apport is opened from the icon in the notification area it tried to open firefox, but it was already open and apport just went away leaving me no way to report the crash that just happened.

recently upgraded to Ibex 8.10

Marco Rodrigues (gothicx) wrote :

I replaced the browser checking in open_url with this and it worked fine in my Ubuntu Karmic.

try:
    if os.getenv('DISPLAY'):
        subprocess.call(sudo_prefix + ['xdg-open', url])
        sys.exit(0)
except OSError:
    pass

Martin, why apport-gtk needs to open an url with sudo? Or it was needed in some apport older version?

The only problem I see here is.. there is no --new-window option in xdg-open. I've it _ON_ in Firefox, but it's turned _OFF_ in most popular browsers by default. I've already requested this feature upstream.

Thank you

Martin Pitt (pitti) wrote :

Right, the reason why Apport explicitly calls firefox is due to --new-window, since it's more or less a part of Apport's UI. Opening it in a new tab doesn't show it to you if Firefox is on another workspace.

Changed in apport:
status: Confirmed → Triaged
Martin Pitt (pitti) wrote :

> Martin, why apport-gtk needs to open an url with sudo?

Apport needs to run as root to process system crashes. However, the browser should run as normal user, primarily to get your cookies/settings/theme/etc.

Einar (christian-einarsson) wrote :

This is still an issue in Lucid, when i run 'ubuntu-bug pkg-name' I get an error stating.

Error showing url: Failed to execute child process "firefox-3.5" (No such file or directory)

I have firefox-3.6 as default browser.

Alex Mayorga (alex-mayorga) wrote :

Looks like this bugger is still alive in natty, I got the error below after I removed firefox in favor of firefox-4.0 (nightly build).

alex-mayorga@VPCCW1FFXL:~$ ubuntu-bug gwibber
Error showing url: Failed to execute child process "firefox" (No such file or directory)
Error showing url: Failed to execute child process "firefox" (No such file or directory)

How can I get this fixed? the same problem occur if I try to open links from gwibber.

Philip Muškovac (yofel) wrote :

Note that you can use apport-cli as a workaround if gnome-open fails (which applies esp. to natty currently)

Martin Pitt (pitti) wrote :

Old issue, and the original issue is not really relevant any more, as apport already calls gnome-open if the preferred browser is not firefox. However, both gnome-open and gconf (which it checks) are obsolete, this needs to be changed to gsettings and xdg-open (which will call gvfs-open on GNOME).

Changed in apport:
importance: Low → High
status: Triaged → In Progress
assignee: nobody → Martin Pitt (pitti)
Martin Pitt (pitti) on 2011-10-10
Changed in apport (Ubuntu):
status: New → In Progress
importance: Undecided → High
importance: High → Medium
assignee: nobody → Martin Pitt (pitti)
Martin Pitt (pitti) wrote :

Fixed in upstream trunk r1984.

Changed in apport:
status: In Progress → Fix Released
Changed in apport (Ubuntu):
status: In Progress → Fix Committed
Launchpad Janitor (janitor) wrote :
Download full text (4.3 KiB)

This bug was fixed in the package apport - 1.24-0ubuntu1

---------------
apport (1.24-0ubuntu1) precise; urgency=low

  * New upstream release 1.23.1:
    - apport/crashdb.py: Ensure that duplicate table only has one entry per
      report ID.
    - apport-retrace: Pass correct executable path to gdb in --gdb with
      --sandbox mode.
    - apport-retrace: Do not leave behind temporary directories on errors.
    - apport-retrace: Drop assertion failure for existance of "Stacktrace".
      This isn't present in the case of gdb crashing, and there is not much we
      can do about it. This should not break the retracer.
    - apport/report.py: Unwind XError() from stack traces for the
      "StacktraceTop" field, as they take a significant part of the trace.
      This causes bugs to be duplicated which really have different causes.
  * New upstream release 1.24:
   - apport-retrace: Add --timestamp option to prepend a timestamp to log
     messages. This is useful for batch operations.
   - crash-digger: Call apport-retrace with --timestamps, to get consistent
     timestamps in log output.
   - hookutils.py: Add two new functions attach_gsettings_package() and
     attach_gsettings_schema() for adding user-modified gsettings keys to a
     report. (LP: #836489)
   - hookutils.py: Add new function in_session_of_problem() which returns
     whether the given report happened in the currently running XDG session.
     This can be used to determine if e. g. ~/.xsession-errors is relevant and
     should be attached.
   - backends/packaging-apt-dpkg.py, install_packages(): Also copy
     apt/sources.list.d/ into sandbox.
   - backends/packaging-apt-dpkg.py, install_packages(): Install apt keyrings
     from config dir or from system into sandbox. (LP: #856216)
   - packaging.py, backends/packaging-apt-dpkg.py: Define that
     install_packages() should return a SystemError for broken
     configs/unreachable servers etc., and fix the apt/dpkg implementation
     accordingly.
   - apport-retrace: Don't crash, just give a proper error message if servers
     are unreachable, or configuration files are broken. (LP: #859248)
   - backends/packaging-apt-dpkg.py: Fix crash when
     /etc/apport/native-origins.d contains any files. (LP: #865199)
   - hookutils, recent_logfile(): Fix invalid return value if log file is not
     readable. (LP: #819357)
   - test/crash: Fix race condition in the "second instance terminates
     immediately" check.
   - hookutils.py: Replace attach_gconf() with a no-op stub. It used static
     python modules like "gconf" which broke the PyGI GTK user interface, and
     gconf is rather obsolete these days.
   - ui.py, open_url(): Greatly simply and robustify by just using xdg-open.
     This already does the right thing wrt. reading the default browser from
     GNOME, KDE, XCE, and other desktops. (LP: #198449)
   - data/general-hooks/generic.py: Only attach ~/.xsession_errors if the bug
     is reported in the same XDG session as the crash happened. (LP: #869974)
   - Ignore crashes for programs which got updated in between the crash and
     reporting. (LP: #132904)
   - Special-case crashes of 'twistd': Try to determin...

Read more...

Changed in apport (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers