AppImage breaks nested launching from Python
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- linux, python
- Domain
- operating-systems, tooling
Research direction
Begin with the extracted AppImage and ./AppRun reproduction, then inspect scc/scripts.py around run_binary at line 28. Compare the nested launch behavior under Python 3.12 and 3.13, including the ./env failure, and verify that the completed change works for both direct and Python-launched binaries inside the AppImage.
Written by the indexing model from the issue text.
Description
The problem demonstrated on an extracted AppImage:
[0] % ./AppRun
Traceback (most recent call last):
File "/home/c0rn3j/Downloads/appimage-trixie-amd64/squashfs-root/usr/bin/scc", line 8, in <module>
sys.exit(main())
~~~~^^
File "/home/c0rn3j/Downloads/appimage-trixie-amd64/squashfs-root/usr/lib/python3.13/site-packages/scc/scripts.py", line 412, in main
sys.exit(command(sys.argv[0], sys.argv[2:]))
~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/c0rn3j/Downloads/appimage-trixie-amd64/squashfs-root/usr/lib/python3.13/site-packages/scc/scripts.py", line 47, in cmd_gui
return run_binary("sc-controller", argv)
File "/home/c0rn3j/Downloads/appimage-trixie-amd64/squashfs-root/usr/lib/python3.13/site-packages/scc/scripts.py", line 30, in run_binary
child = subprocess.Popen([binary] + argv)
File "/home/c0rn3j/Downloads/appimage-trixie-amd64/squashfs-root/usr/lib/python3.13/subprocess.py", line 1039, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pass_fds, cwd, env,
^^^^^^^^^^^^^^^^^^^
...<5 lines>...
gid, gids, uid, umask,
^^^^^^^^^^^^^^^^^^^^^^
start_new_session, process_group)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/c0rn3j/Downloads/appimage-trixie-amd64/squashfs-root/usr/lib/python3.13/subprocess.py", line 1857, in _execute_child
self._posix_spawn(args, executable, env, restore_signals, close_fds,
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
p2cread, p2cwrite,
^^^^^^^^^^^^^^^^^^
c2pread, c2pwrite,
^^^^^^^^^^^^^^^^^^
errread, errwrite)
^^^^^^^^^^^^^^^^^^
File "/home/c0rn3j/Downloads/appimage-trixie-amd64/squashfs-root/usr/lib/python3.13/subprocess.py", line 1801, in _posix_spawn
self.pid = os.posix_spawn(executable, args, env, **kwargs)
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/home/c0rn3j/Downloads/appimage-trixie-amd64/squashfs-root/usr/bin/sc-controller'
Now, changing the usr/bin/env python in sc-controller to /usr/bin/env python solves this, because it no longer tries to load the AppImage-castrated env binary that relies on lib64/ld-linux-x86-64.so.2 to exist, but we're not in runtime/compat where it resides.
So we get this wonderful error when launching directly, and the same issue will break the binary when launched through Python:
./env
zsh: no such file or directory: ./env
Now, the scripts.py is launching it this way: https://github.com/C0rn3j/sc-controller/blob/5a8e3025f75c214a54db05d438e2bbab015cf057/scc/scripts.py#L28
This works on Python 3.12 and earlier, but not Python 3.13, since that now uses posix_spawn() by default in this situation - https://docs.python.org/3/whatsnew/3.13.html#subprocess
A workaround is to preface subprocess.Popen calls with:
subprocess._USE_POSIX_SPAWN = False
Or replacing the shebang with the host's /usr/bin/env, if env is all you use in your shebangs.
What am I supposed to do here?
- Dominant language
- No language data
- Stars
- 9.4k
- Forks
- 588
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
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 AppImage/AppImageKit
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
AppImage/AppImageKit#1428 · 1 reaction ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
AppImage/AppImageKit#1164 · 2 comments · 1 reaction ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
AppImage/AppImageKit#1434 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
AppImage/AppImageKit#1427 · 3 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 20/100
AppImage/AppImageKit#1426 · 2 comments ·
All issues in AppImage/AppImageKit
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
AiursoftWeb/AnduinOS-2#19 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
linux
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
andrewdavidmackenzie/zCore#376 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100