From aa4b862a123112085660ee14fc0e2bccb251ddfa Mon Sep 17 00:00:00 2001 From: Cristian Cerroni Date: Fri, 13 Nov 2026 11:43:51 -0500 Subject: [PATCH] fix(01-05): retain executable permissions in offline copies Preserve source read/write/execute bits without privileged mode bits. Verify copied Linux apphost byte identity and permissions. --- tests/test_fidelity_checkpoint.py | 8 ++++++++ tools/recon/fidelity_checkpoint.py | 3 +++ 2 files changed, 11 insertions(+) diff --git a/tests/test_fidelity_checkpoint.py b/tests/test_fidelity_checkpoint.py index 429ad06..696b6be 100644 --- a/tests/test_fidelity_checkpoint.py +++ b/tests/test_fidelity_checkpoint.py @@ -174,6 +174,14 @@ class FidelityCheckpoint(unittest.TestCase): self.assertEqual({r['side'] for r in agenda['runs']}, {'original-windows-dxwnd', 'port-windows-native'}) + def test_package_copy_preserves_source_execution_permissions(self): + apphost = self.packages['linux-x64'] / 'GamePort' + apphost.chmod(0o755) + self.prepare() + copied = self.output / 'port/linux-x64/GamePort' + self.assertEqual(copied.stat().st_mode & 0o777, apphost.stat().st_mode & 0o777) + self.assertEqual(receipts.identify_file(copied), receipts.identify_file(apphost)) + def test_skip_abort_remain_open_schema_valid_results(self): self.prepare() for status in ('skipped', 'aborted'): diff --git a/tools/recon/fidelity_checkpoint.py b/tools/recon/fidelity_checkpoint.py index 2a2a380..b50788c 100644 --- a/tools/recon/fidelity_checkpoint.py +++ b/tools/recon/fidelity_checkpoint.py @@ -35,6 +35,9 @@ def _copy_file(source, target): shutil.copyfile(source, target) if identify_file(source) != identify_file(target): raise ValueError('Source changed during copy: ' + str(source)) + # Byte-identical Unix apphosts still need their source execution permission. + # Do not propagate setuid/setgid/sticky bits into a generated checkpoint. + target.chmod(Path(source).stat().st_mode & 0o777) def _copy_tree(source, target):