fix: give data tree files the umask mode

Verified bytes reach their place through one helper that sets the mode a
plain open() gives and clears a read-only attribute. A data tree member
skipped both and landed 0600, unreadable by the emulator after a sudo
install. The expected digests of an entry are read by one function.
This commit is contained in:
Abdessamad Derraz committed 2026-11-21 06:04:39 +01:00
1 parent 83b1976903
commit c41fb9e609
10 files changed
+66 -48

No files matched your search

+11
View File
@@ -192,6 +192,17 @@ class InstalledFileModes(unittest.TestCase):
finally:
os.umask(umask)
def test_a_data_tree_member_too(self):
data = b"cheat"
meta = {"size": len(data), "sha1": hashlib.sha1(data).hexdigest()}
with tempfile.TemporaryDirectory() as tmp:
target = Path(tmp) / "sub" / "file.ini"
target.parent.mkdir()
status, _ = install._install_data_member(
lambda: io.BytesIO(data), meta, target, Path(tmp), "data", "file.ini", [])
self.assertEqual(status, "installed")
self.assertEqual(target.stat().st_mode & 0o777, 0o666 & ~install._UMASK)
class ProgramsAreMarked(unittest.TestCase):
"""The manifest says which files are programs, read from their header: