Closed sergiusens closed 4 years ago
This failed for me:
$ emacs
/snap/emacs/x1/gtk-launch: 3: [: amd64: unexpected operator
/snap/emacs/x1/gtk-launch: 5: [: amd64: unexpected operator
/snap/emacs/x1/gtk-launch: 7: [: amd64: unexpected operator
(emacs:1212): GdkPixbuf-WARNING **: 13:04:53.967: Error loading XPM image loader: Unable to load image-loading module: /snap/emacs/x5/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-xpm.so: /snap/emacs/x5/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-xpm.so: cannot open shared object file: No such file or directory
However, if I changed the interpreter to #!/bin/bash
in gtk-launch
(rather than #!/bin/sh
) then it seems to run without error.
Interesting, let me run shellcheck against it, FWIW I built the snap locally with what I presented in this PR and running just fine. Now I see why:
sergiusens@gotham Linux 5.2.11-1-MANJARO x86_64 19.08.14 Juhraya
~ >>> ls /bin/sh -l
lrwxrwxrwx 1 root root 4 ago 20 12:12 /bin/sh -> bash
$ shellcheck gtk-launch
In gtk-launch line 3:
if [ "$SNAP_ARCH" == "amd64" ]; then
^-- SC2039: In POSIX sh, == in place of = is undefined.
In gtk-launch line 5:
elif [ "$SNAP_ARCH" == "armhf" ]; then
^-- SC2039: In POSIX sh, == in place of = is undefined.
In gtk-launch line 7:
elif [ "$SNAP_ARCH" == "arm64" ]; then
^-- SC2039: In POSIX sh, == in place of = is undefined.
$ checkbashisms gtk-launch
possible bashism in gtk-launch line 3 (should be 'b = a'):
if [ "$SNAP_ARCH" == "amd64" ]; then
possible bashism in gtk-launch line 5 (should be 'b = a'):
elif [ "$SNAP_ARCH" == "armhf" ]; then
possible bashism in gtk-launch line 7 (should be 'b = a'):
elif [ "$SNAP_ARCH" == "arm64" ]; then
So either change the interpreter to bash
or change the ==
for =
and keep sh
as the interpreter I guess.
Thanks @alexmurray, I made it more than bash compatible
Nice - thanks.
Achieve this by use of command-chain and getting rid of the wrappers.
Fixes #3
Signed-off-by: Sergio Schvezov sergio.schvezov@canonical.com