`fopen("/proc/self/exe", ...)` opens the dynamic linker instead of the expected target
Calling fopen("/proc/self/exe", "rb")
should return a stream for the file being executed. Instead, it returns a stream for the dynamic linker, e.g. /lib/ld-musl-x86_64.so.1
on Alpine Linux edge x86_64 with gcompat-1.0.0-r4.
This leads to AppImages failing to run with the error message "This doesn't look like a squashfs image." from squashfuse, since squashfuse is attempting to read the linker instead of the AppImage itself.
See https://github.com/AppImage/AppImageKit/pull/1168. However, that fix would only affect newly built AppImages. Existing AppImages would still have this problem.
Test case: proc-self-exe-test.c
Sample output: proc-self-exe-test.out.txt