Thank you for your bug report. Indeed that seems incorrect and should be
reported to https://gitlab.gnome.org/GNOME/glib/-/issues

** Changed in: glib2.0 (Ubuntu)
   Importance: Undecided => Low

-- 
You received this bug notification because you are a member of Desktop
Packages, which is subscribed to glib2.0 in Ubuntu.
https://bugs.launchpad.net/bugs/2007621

Title:
  gio open exits with success even though the underlying exec failed

Status in glib2.0 package in Ubuntu:
  Confirmed

Bug description:
  This is a sort of annoyingly complex interaction, so bear with me. The
  observed problem is that xdg-open does not exit with a non-zero exit
  code when it fails to open.

  ```
  $ unset DISPLAY 
  $ xdg-open http://example.com
  exo-open: Cannot open display: .
  $ echo $?
  0
  ```

  It turns out to not exactly be xdg-open's fault, though:
  ```
  $ sh -x $(which xdg-open) http://example.com 2>&1 | tail -n10
  + return 0
  + open_xfce http://example.com
  + exo-open --help
  + gio help open
  + gio open http://example.com
  exo-open: Cannot open display: .
  + [ 0 -eq 0 ]
  + exit_success
  + [ 0 -gt 0 ]
  + exit 0
  ```

  So, from this we see that xdg-open uses `exo-open --help` to see if
  exo-open works, but it fails due to the DISPLAY, so it falls back to
  gio open. gio open ends up turning around and calling exo-open again,
  but gio swallows the exit code, so xdg-open thinks it worked.

  ```
  $ exo-open http://example.com
  exo-open: Cannot open display: .
  $ echo $?
  1
  $ gio open http://example.com
  exo-open: Cannot open display: .
  $ echo $?
  0
  ```

  Versions:
  $ lsb_release -rd              
  Description:    Ubuntu 22.04.1 LTS
  Release:        22.04
  $ xdg-open --version           
  xdg-open 1.1.3
  $ exo-open --version | head -n1
  exo-open 4.16.3
  $ gio --version           
  2.72.4

  Specifically:
  exo-utils:
    Installed: 4.16.3-1
    Candidate: 4.16.3-1
    Version table:
   *** 4.16.3-1 500
          500 http://us.archive.ubuntu.com/ubuntu jammy/universe amd64 Packages
          100 /var/lib/dpkg/status
  libglib2.0-bin:
    Installed: 2.72.4-0ubuntu1
    Candidate: 2.72.4-0ubuntu1
    Version table:
   *** 2.72.4-0ubuntu1 500
          500 http://us.archive.ubuntu.com/ubuntu jammy-updates/main amd64 
Packages
          100 /var/lib/dpkg/status
       2.72.1-1 500
          500 http://us.archive.ubuntu.com/ubuntu jammy/main amd64 Packages
  xdg-utils:
    Installed: 1.1.3-4.1ubuntu3~22.04.1
    Candidate: 1.1.3-4.1ubuntu3~22.04.1
    Version table:
   *** 1.1.3-4.1ubuntu3~22.04.1 500
          500 http://us.archive.ubuntu.com/ubuntu jammy-updates/main amd64 
Packages
          500 http://us.archive.ubuntu.com/ubuntu jammy-updates/main i386 
Packages
          100 /var/lib/dpkg/status
       1.1.3-4.1ubuntu1 500
          500 http://us.archive.ubuntu.com/ubuntu jammy/main amd64 Packages
          500 http://us.archive.ubuntu.com/ubuntu jammy/main i386 Packages

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/glib2.0/+bug/2007621/+subscriptions


-- 
Mailing list: https://launchpad.net/~desktop-packages
Post to     : desktop-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~desktop-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to