alexmurray / emacs-snap

GNU Emacs in a snap
https://snapcraft.io/emacs
71 stars 13 forks source link

setup proper paths for gtk pixbuf #4

Closed sergiusens closed 4 years ago

sergiusens commented 4 years ago

Achieve this by use of command-chain and getting rid of the wrappers.

Fixes #3

Signed-off-by: Sergio Schvezov sergio.schvezov@canonical.com

alexmurray commented 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.

sergiusens commented 4 years ago

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
alexmurray commented 4 years ago
$ 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.
alexmurray commented 4 years ago
$ 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
alexmurray commented 4 years ago

So either change the interpreter to bash or change the == for = and keep sh as the interpreter I guess.

sergiusens commented 4 years ago

Thanks @alexmurray, I made it more than bash compatible

alexmurray commented 4 years ago

Nice - thanks.