mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-24 15:26:04 +00:00
fix(desktop): an arm64 AppImage started directly runs like one opened from the file manager (#3108)
* fix(desktop): an arm64 AppImage started directly runs like one opened from the file manager Without proot a guest program starts through the dynamic loader, which refuses the nonzero ABI version byte that marks every type 2 AppImage, so running an arm64 AppImage from a terminal or from a menu entry that names the image failed with "ELF file ABI version invalid". The preload already hands foreign programs to droiddeck-open; AppImages now go there too, where they are unpacked and started as the file manager does. * fix(desktop): hand off only AppImages that carry a filesystem, never a bare runtime
This commit is contained in:
1 parent
5cb8e7fdf3
commit
366afa6b73
2 files changed
+32
-2
No files matched your search
@@ -138,6 +138,27 @@ class BinfmtPreloadTest(unittest.TestCase):
|
||||
program = self.file("arm64", bytes(arm64))
|
||||
self.assertEqual(self.run_program("execve", program), (3, "errno %d" % errno.ENOEXEC, None))
|
||||
|
||||
def arm64_appimage(self, name, filesystem):
|
||||
image = bytearray(128)
|
||||
image[0:4], image[4], image[5], image[8:11], image[18] = b"\x7fELF", 2, 1, b"AI\x02", 183
|
||||
image[0x28:0x30] = (64).to_bytes(8, "little")
|
||||
image[0x3A:0x3C], image[0x3C:0x3E] = (32).to_bytes(2, "little"), (1).to_bytes(2, "little")
|
||||
image[96:102] = filesystem
|
||||
return self.file(name, bytes(image))
|
||||
|
||||
def test_an_arm64_appimage_goes_to_the_handler(self):
|
||||
program = self.arm64_appimage("App.AppImage", b"hsqs\0\0")
|
||||
for how in ("execve", "execvp"):
|
||||
self.log.unlink(missing_ok=True)
|
||||
target = program if how == "execve" else program.name
|
||||
self.assertEqual(self.run_program(how, target, "--x"), (7, "", ["--exec", str(program), "--x"]))
|
||||
self.log.unlink()
|
||||
self.assertEqual(self.run_program("spawn", program, "y"), (0, "exit 7", ["--exec", str(program), "y"]))
|
||||
|
||||
def test_an_appimage_runtime_without_a_filesystem_keeps_its_error(self):
|
||||
runtime = self.arm64_appimage("uruntime", bytes(6))
|
||||
self.assertEqual(self.run_program("execve", runtime), (3, "errno %d" % errno.ENOEXEC, None))
|
||||
|
||||
def test_a_script_runs_as_itself(self):
|
||||
script = self.file("script.sh", b"#!/bin/sh\nexit 5\n")
|
||||
self.assertEqual(self.run_program("execve", script), (5, "", None))
|
||||
|
||||
Reference in new issue
Block a user