[Libreoffice-bugs] [Bug 108591] xdg-open path is hardcoded

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Wed Apr 7 02:54:34 UTC 2021


https://bugs.documentfoundation.org/show_bug.cgi?id=108591

--- Comment #7 from David H. Gutteridge <dhgutteridge at hotmail.com> ---
Part of this patch set won't necessarily behave as intended, depending on the
OS.

diff --git a/shell/source/unix/misc/senddoc.sh
b/shell/source/unix/misc/senddoc.sh
index 4519e01f26e2..8985711a2c01 100755
--- a/shell/source/unix/misc/senddoc.sh
+++ b/shell/source/unix/misc/senddoc.sh
@@ -393,6 +393,8 @@ case `basename "$MAILER" | sed 's/-.*$//'` in
             MAILER=/usr/bin/kde-open
         elif [ -x /usr/bin/xdg-open ] ; then
             MAILER=/usr/bin/xdg-open
+        elif type -p xdg-open >/dev/null 2>&1 ; then
+            MAILER="$(type -p xdg-open)"
         else
             echo "Unsupported mail client: `basename $MAILER | sed
's/-.*^//'`"
             exit 2

This uses "type -p", but that's not portable.

For example, with Debian's dash as /bin/sh:

$ /bin/sh
$ type -p xdg-open
-p: not found
xdg-open is /usr/bin/xdg-open
$ echo $?
127

Or with NetBSD's /bin/sh (with newer than 8.0):

$ /bin/sh
$ type -p xdg-open
type: usage: type name...
$ echo $?
2

"command -v" is probably a better choice here.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20210407/7f7393a1/attachment.htm>


More information about the Libreoffice-bugs mailing list