P4: AppImage launcher adds the current folder to the library search path
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- cmake, linux, shell
- Domain
- build-system, devops
Research direction
Read freespace2/cmake/AppRun.in, focusing on how it builds LD_LIBRARY_PATH and passes arguments to exec. Reproduce the issue with LD_DEBUG=libs and LD_LIBRARY_PATH unset, then verify the launcher searches the AppImage library directory and system paths without searching the starting folder.
Written by the indexing model from the issue text.
Description
Minor: this only matters if a file with a library's name ends up in the folder FSO is started from, and a normal Knossos install never puts one there.
Problem
The Linux AppImage's launcher (freespace2/cmake/AppRun.in) sets the library search path to the AppImage's own lib folder followed by the user's LD_LIBRARY_PATH. When LD_LIBRARY_PATH isn't set, which is the default on most systems, the line ends with a colon and leaves an empty entry. Linux reads an empty entry as "the current folder", so for every library the AppImage doesn't bundle, the loader also looks in whatever folder FSO was started from. Knossos starts FSO in the game's root folder.
Steps to reproduce
- On Linux, with
LD_LIBRARY_PATHnot set, open a terminal in any empty folder. - Run the official 26.0.1 build with loader logging:
LD_DEBUG=libs ./fs2_open_26_0_1_x64_SSE2.AppImage(I ran it underxvfb-runand stopped it after a few seconds). - Look at the
search path=lines in the output.
Expected vs. actual behavior
- Expected: the search path is the AppImage's
libfolder, then the system's usual folders. - Actual: the search path ends with relative entries (
glibc-hwcaps/x86-64-v4, ..., and an empty one), and the loader tries files such aslibpthread.so.0in the starting folder: 268 lookups there in my run.
Proposed fixes
- In
AppRun.in, only add the colon when the variable is set:export LD_LIBRARY_PATH="${HERE}"/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}. - The same, plus quoting the arguments on the
execline ("$@"), so an argument with a space is passed as one argument. I found this one by reading the script, not by running into it. - Give the executables a RUNPATH of
$ORIGIN/../liband drop theLD_LIBRARY_PATHexport entirely, which also keeps the AppImage's library folder out of the environment of anything FSO starts.
- Dominant language
- C++
- Stars
- 488
- Forks
- 184
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 33
Getting set up
We have not checked this project's setup files yet. Start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from scp-fs2open/fs2open.github.com
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
scp-fs2open/fs2open.github.com#7956 ·
Maintainers usually reply within 1 day
-
bug HUD LLM-suggested
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
scp-fs2open/fs2open.github.com#7953 ·
Maintainers usually reply within 1 day
-
bug controls LLM-suggested
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
scp-fs2open/fs2open.github.com#7946 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 Half a day Newbie friendliness 66/100
scp-fs2open/fs2open.github.com#7932 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
scp-fs2open/fs2open.github.com#7918 ·
Maintainers usually reply within 1 day
All issues in scp-fs2open/fs2open.github.com
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 4 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
elf-alchemist/elfbsp#113 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
patrick-hudson/put.gd-desktop#979 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Dao-AILab/flash-attention#3097 ·
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Niko1221/Strata#4779 · 2 comments ·
Maintainers usually reply within 3 days