probonopd / go-appimage

Go implementation of AppImage tools
MIT License
821 stars 71 forks source link

go-appimage treats executables as libraries to set RPATH #314

Open brunvonlope opened 3 days ago

brunvonlope commented 3 days ago

Running objdump -c on binaries from an .appimage produced by go-appimage reveals that the tool uses executables paths as suitables to be appended on RPATH, not only the paths of libraries.

As far I know, it is not common dynamically linkining to executables on Linux. That was a thing on very early versions of Windows but not anymore. This seems a error.

@Samueru-sama probably can share some words too

Samueru-sama commented 3 days ago

Yeah that isn't right and quite a problem for gimp since there is a directory for each plugin.

probonopd commented 3 days ago

The intended behavior is that only directories containing libraries should be added to RPATH.

func patchRpathsInElf(appdir helpers.AppDir, libraryLocationsInAppDir []string, path string) does the patching.

Apparently somewhere directories not actually containing .so files get added to libraryLocationsInAppDir, can you spot where?

brunvonlope commented 3 days ago

can you spot where?

@probonopd GIMP plug-ins are stored in lib path, this way:

AppDir/usr/lib/arch_triplet/gimp/3.0/plug-ins/plugin_name/plugin_name_executable

The intended behavior is that only directories containing libraries should be added to RPATH

What is a library for go_appimage? go-appimage seems to consider a library whatever ELF files that it found recursively on lib path, independently of the *so extension, creating this monstruosity:

388291568-b0223f31-255c-400f-860a-8a9f697b04d7

probonopd commented 3 days ago

Yes, I guess we need to change that by checking whether a path contains at least one file with the extension .so optionally followed by any combination of dots and numbers before adding to libraryLocationsInAppDir.

probonopd commented 1 day ago

Does the build in #316 improve the situation?