Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 893604 - app-text/mupdf-1.21.0: can't open link (URL) in default Web browser via xdg-open
Summary: app-text/mupdf-1.21.0: can't open link (URL) in default Web browser via xdg-open
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Philipp Rösner
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-02-08 12:25 UTC by sphakka
Modified: 2023-02-26 07:02 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Test file with an embedded URL link (test-xdg-open-url.pdf,10.62 KB, application/pdf)
2023-02-08 12:26 UTC, sphakka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description sphakka 2023-02-08 12:25:42 UTC
Opening URL links via xdg-open in default browser (configured in XFCE) is broken. The error on console is:

 warning: cannot spawn browser 'xdg-open': No such file or directory

My actual XFCE configuration is:

  $ xdg-settings get default-web-browser
  firefox.desktop


Cf. Evince which handles xdg-open URL as expected.

Reproducible: Always

Steps to Reproduce:
1. Open a PDF with embedded URL links (e.g., the attached test file)
2. Click on any URL link

Actual Results:  
Nothing happen. The console shows the error: 

  warning: cannot spawn browser 'xdg-open': No such file or directory


Expected Results:  
A default Web browser window/tab is opened on the linked URL.

Portage 3.0.43 (python 3.10.9-final-0, default/linux/amd64/17.1/no-multilib, gcc-12, glibc-2.36-r5, 5.15.88-gentoo-docker x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-5.15.88-gentoo-docker-x86_64-Intel-R-_Core-TM-_i7-4702MQ_CPU_@_2.20GHz-with-glibc2.36
KiB Mem:    16112352 total,   1538188 free
KiB Swap:   16777212 total,  16453976 free
Timestamp of repository gentoo: Tue, 07 Feb 2023 17:02:08 +0000
Head commit of repository gentoo: 96262a957998d616bf038fc5cc58954c6d25abf8

sh bash 5.1_p16-r2
ld GNU ld (Gentoo 2.39 p5) 2.39.0
app-misc/pax-utils:        1.3.5::gentoo
app-shells/bash:           5.1_p16-r2::gentoo
dev-lang/perl:             5.36.0-r1::gentoo
dev-lang/python:           3.10.9-r1::gentoo, 3.11.1-r1::gentoo
dev-lang/rust:             1.66.1::gentoo
dev-util/cmake:            3.25.2::gentoo
dev-util/meson:            0.64.1::gentoo
sys-apps/baselayout:       2.9::gentoo
sys-apps/openrc:           0.45.2-r2::gentoo
sys-apps/sandbox:          2.29::gentoo
sys-devel/autoconf:        2.13-r7::gentoo, 2.71-r5::gentoo
sys-devel/automake:        1.16.5::gentoo
sys-devel/binutils:        2.39-r4::gentoo
sys-devel/binutils-config: 5.4.1::gentoo
sys-devel/clang:           14.0.6-r1::gentoo, 15.0.7-r1::gentoo
sys-devel/gcc:             12.2.1_p20230121-r1::gentoo
sys-devel/gcc-config:      2.8::gentoo
sys-devel/libtool:         2.4.7-r1::gentoo
sys-devel/lld:             14.0.6-r1::gentoo, 15.0.7::gentoo
sys-devel/llvm:            14.0.6-r2::gentoo, 15.0.7::gentoo
sys-devel/make:            4.3::gentoo
sys-kernel/linux-headers:  5.15-r3::gentoo (virtual/os-headers)
sys-libs/glibc:            2.36-r5::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: git
    sync-uri: https://anongit.gentoo.org/git/repo/sync/gentoo.git
    priority: -1000
    volatile: True

localrepo
    location: /var/db/repos/overlay/localrepo
    masters: gentoo
    priority: 10
    volatile: True

Installed sets: @audio, @cloud, @dev, @emacs, @emul, @fonts, @gkrellm, @graphix, @net, @office, @utilz, @video, @web, @webdev, @xfce
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=haswell -pipe -O2 -fomit-frame-pointer"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php8.1/ext-active/ /etc/php/cgi-php8.1/ext-active/ /etc/php/cli-php8.1/ext-active/ /etc/php/fpm-php8.1/ext-active/ /etc/php/phpdbg-php8.1/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=haswell -pipe -O2 -fomit-frame-pointer"
DISTDIR="/var/cache/distfiles"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME"
FCFLAGS="-march=haswell -pipe -O2 -fomit-frame-pointer"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch parallel-install pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-march=haswell -pipe -O2 -fomit-frame-pointer"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LEX="flex"
LINGUAS=""
MAKEOPTS="-j9"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
SHELL="/bin/bash"
USE="alsa amd64 apng bittorrent bluetooth btrfs bzip2 cacert calendar caps cddb cdio clang cli corefonts crypt cups curl cvs dav1d dbus device-mapper djvu dri dvd dynamic-loading ebook elogind emacs eme-free enchant fam fbcon fortran fpm gdbm git glamor gnome-keyring gnutls gpm graphicsmagick gtk3 gtkstyle gui h323 hddtemp heif http hunspell iconv icu id3tag imagemagick introspection jabber jpeg jumbo-build kpathsea ladspa laptop latex lcms libglvnd libnotify libsamplerate libtirpc lm_sensors lto luks1_default mng mp3 mplayer musepack musicbrainz mysql mysqli ncurses networkmanager nls nptl ntfs ntfsprogs objc objc++ ogg openmp openvg opus pam pcre pgo png policykit postscript ppds python3 readline rtmp scanner sdl seamonkey seccomp split-usr sql sqlite sqlitessh ssl system-av1 system-bootstrap system-cmark system-crontab system-ffmpeg system-harfbuzz system-icu system-jpeg system-libevent system-libvpx system-libyaml system-llvm system-mesa system-sqlite system-ssl system-webp system-zlib test-rust threads tordns truetype udisks unicode v4l v4l2 video vlc vorbis wavpack xattr xcb xcomposite xetex xfce xfs xkb xmp xorg xvfb zlib" ABI_X86="64" ADA_TARGET="gnat_2021" ALSA_CARDS="hda-intel usb-audio" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt rdrand sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="pc" INPUT_DEVICES="keyboard mouse libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-1" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_10" PYTHON_TARGETS="python3_10" RUBY_TARGETS="ruby30" SANE_BACKENDS="epson2 epkowa hp" USERLAND="GNU" VIDEO_CARDS="intel i965" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EMERGE_DEFAULT_OPTS, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LFLAGS, LIBTOOL, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS

=================================================================
                        Package Settings
=================================================================

app-text/mupdf-1.21.0::gentoo was built with the following:
USE="X javascript opengl ssl"
CFLAGS="-march=haswell -pipe -O2 -fomit-frame-pointer -DFZ_ENABLE_JS=1"
Comment 1 sphakka 2023-02-08 12:26:52 UTC
Created attachment 850162 [details]
Test file with an embedded URL link
Comment 2 Philipp Rösner 2023-02-12 19:39:01 UTC
Greetings,

thanks for the report. I can confirm the issue.

For now it's possible to switch to USE=-opengl to build the non-OpenGL version of MuPDF, in which opening URLs works.
In case USE=X is set, it's also possible to keep MuPDF with USE=opengl installed  and use the mupdf-x11 binary instead of mupdf/mupdf-gl.

The issue is around platform/gl/gl-main.c:125 in the MuPDF source code. The "No such file directory" is coming from the ENOENT signal from Glibc, thrown by posix_spawnp(), because it can't find the xdg-open program.
The posix_spawnp() function takes an array of strings, the environment, and looks up the to be called program (here xdg-open) in the environment.
So apparently, posix_spawnp() cannot find the xdg-open program in the environment it was given. The environment is here defined through the environ variable.

Interestingly, if I set browser="/usr/bin/xdg-open" instead of browser="xdg-open", it works. 
This implies to me, that there is a problem in handing over the environment (this variable is called environ) to the posix_spawnp() function.
Printing environ correctly prints the PATH, so posix_spawnp() should be able to find xdg-open in /usr/bin.

I tested this in mupdf-gl on fedora, with the same issue. 
So I suspect it's an upstream problem. In the following days, after having gathered enough information for describing the problem, I want to file a bug on the upstream bugzilla.

Regards,
Philipp
Comment 3 Larry the Git Cow gentoo-dev 2023-02-26 07:02:42 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2d0b50425eb4184f10e275934e8c6939c9bffea8

commit 2d0b50425eb4184f10e275934e8c6939c9bffea8
Author:     Philipp Rösner <rndxelement@protonmail.com>
AuthorDate: 2023-02-13 21:42:05 +0000
Commit:     Joonas Niilola <juippis@gentoo.org>
CommitDate: 2023-02-26 06:59:58 +0000

    app-text/mupdf: fix url processing in 1.21.1
    
    In <=app-text/mupdf-1.21.1 built with USE=opengl trying to open
    an URL in a PDF file results in "warning: cannot spawn browser
    'xdg-open': No such file or directory".
    Apply fix from upstream to resolve the issue until the next
    release of MuPDF.
    
    Closes: https://bugs.gentoo.org/893604
    Signed-off-by: Philipp Rösner <rndxelement@protonmail.com>
    Signed-off-by: Joonas Niilola <juippis@gentoo.org>

 .../files/mupdf-1.21.1-fix-url-processing.patch    |  25 ++++
 app-text/mupdf/mupdf-1.21.1-r1.ebuild              | 166 +++++++++++++++++++++
 2 files changed, 191 insertions(+)