[linux] Tests: an archive made with 'tar -C dir -czf x .' (a ./ root entry) is accepted (red: found by the systemd container test)

This commit is contained in:
2026-11-17 13:10:24 +01:00
parent 21b11cc3ef
commit b4e63423c9
2 changed files with 38 additions and 0 deletions
+5
View File
@@ -223,6 +223,11 @@ fn archive_entries_stay_inside_the_release() {
check_entry(EntryKind::File, "bin/shop", 10).unwrap();
check_entry(EntryKind::Dir, "static/", 0).unwrap();
check_entry(EntryKind::File, "./README", 10).unwrap();
// `tar -C dir -czf x.tar.gz .` writes the root itself as `./`: allowed, and it names nothing.
assert!(check_entry(EntryKind::Dir, "./", 0).unwrap().is_empty());
assert!(check_entry(EntryKind::Dir, ".", 0).unwrap().is_empty());
assert!(check_entry(EntryKind::File, "./", 0).is_err());
assert!(check_entry(EntryKind::File, ".", 0).is_err());
for (kind, path) in [
(EntryKind::File, "/etc/passwd"),
(EntryKind::File, "../outside"),