mirror of
https://github.com/openglow-org/forgefirm.git
synced 2026-10-19 11:01:43 -07:00
forgefirm-image: the pack-licenses test says what tar does with a member it cannot read
The docstring of the case that holds the refusal said that the
manifest check alone passes a bundle truncated after the unreadable
member, and a comment on the member's directory said that it sorts
after license.manifest. Neither is the mechanism. tar reports an error
that it cannot open the member, skips it, writes every other member
and the end of the archive, and exits nonzero only at its end, a
status the former pipeline lost. Where the member sorts does not
matter. The docstring now says that tar skips the member and the
manifest check alone passes the bundle without it, and the comment is
gone.
Proof: forgetest-ci "Unit tests" (`python -B -m unittest discover -s
tests -v` in forgetest), on Ubuntu 24.04 with python 3.12 as an
unprivileged user: test_image.py's PackLicensesTests, 5 tests OK. With
the pack script as it was before 03146a1, the case fails with the
member under zlib/ and with it under aaa/ (exit status 0 both times);
with the script as it is, both placements pass. At the shell, on a
fixture tree with the unreadable member under aaa/ and then under
zlib/, the script as it was exits 0 both times after "Cannot open:
Permission denied", writes a bundle that holds every other member
(zzz/generic_Last, which sorts last, included), and removes the tree.
Text only, so no negative control applies to the change itself.
pyflakes reports no undefined name.
Acceptance: none. tests/ are in no fingerprint.
This commit is contained in:
@@ -318,11 +318,12 @@ class PackLicensesTests(unittest.TestCase):
|
|||||||
|
|
||||||
def test_a_license_text_tar_cannot_read_is_refused_and_the_tree_left(self):
|
def test_a_license_text_tar_cannot_read_is_refused_and_the_tree_left(self):
|
||||||
"""A member tar cannot read fails the pack, bundle removed and tree
|
"""A member tar cannot read fails the pack, bundle removed and tree
|
||||||
left: the manifest check alone passes a bundle truncated after it."""
|
left: tar skips that member, and the manifest check alone passes
|
||||||
|
the bundle without it."""
|
||||||
if os.geteuid() == 0:
|
if os.geteuid() == 0:
|
||||||
self.skipTest("root reads every file")
|
self.skipTest("root reads every file")
|
||||||
self.make_tree(self.RECIPES)
|
self.make_tree(self.RECIPES)
|
||||||
d = os.path.join(self.tree, "zlib") # sorts after license.manifest
|
d = os.path.join(self.tree, "zlib")
|
||||||
os.makedirs(d)
|
os.makedirs(d)
|
||||||
locked = os.path.join(d, "generic_Zlib")
|
locked = os.path.join(d, "generic_Zlib")
|
||||||
with open(locked, "w") as f:
|
with open(locked, "w") as f:
|
||||||
|
|||||||
Reference in New Issue
Block a user