You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
runtime: always use link target for /proc/self/exe
When running an AppImage under [gcompat][0] (e.g. on Alpine Linux),
`fopen("/proc/self/exe", "rb")` opens the dynamic linker (e.g.
`/lib/ld-musl-x86_64.so.1`) instead of the AppImage itself. However,
`readlink("/proc/self/exe", ...)` does give the path to the AppImage as
expected, even under gcompat.
This commit fixes this problem by always using the link target for
`/proc/self/exe` in places that read the AppImage instead of the link
itself. Without this commit, running an AppImage under gcompat results
in [the error message "This doesn't look like a squashfs image." from
squashfuse][1]. With this commit, AppImages run as expected under
gcompat.
In order to make `--appimage-help` and
`--appimage-portable-{home,config}` work under gcompat, I also move the
calculation of the `fullpath` variable in `main()` to earlier in the
function and change `print_help()` and `portable_option()` to use it
instead of calculating the fullpath separately. (When
`$TARGET_APPIMAGE` is set, since `realpath()` is (already) used instead
of `readlink()` in that case, this change could result in a different
path being used in help output and when _creating_ the portable home and
config directories with the respective command line options, but
`fullpath` is already being used to find existing portable directories
when running an AppImage, so this should not affect existing portable
installations.) For consistency, I also rename the `fullpath` variable
in `main()` and the corresponding arguments in `print_help()` and
`portable_option()` to `appimage_fullpath`.
FixesAppImage#1015 on Alpine Linux systems with gcompat installed, for
AppImages made with this changeset applied.
Tested on Alpine Linux edge x86_64 and postmarketOS (based on Alpine)
edge aarch64.
[0]: https://git.adelielinux.org/adelie/gcompat/
[1]: https://github.com/vasi/squashfuse/blob/e51978cd6bb5c4d16fae9eee43d0b258f570bb0f/util.c#L81-L82
0 commit comments