mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2026-09-14 11:06:13 +05:00
Repair nested abxpkg projections after UID remap
This commit is contained in:
parent
95065fb8cc
commit
4bb81dbda3
@ -138,10 +138,16 @@ def test_existing_collection_handoff_is_bounded_to_known_top_level_paths(tmp_pat
|
||||
assert all(path == tmp_path or path.parent in (tmp_path, errors_log.parent) for path in paths)
|
||||
|
||||
|
||||
def test_permission_repair_hint_avoids_recursive_collection_chown():
|
||||
def test_permission_repairs_avoid_recursive_collection_and_abxpkg_chown():
|
||||
from archivebox.misc import checks
|
||||
|
||||
assert "chown -R" not in Path(checks.__file__).read_text(encoding="utf-8")
|
||||
entrypoint = (Path(__file__).parents[2] / "bin" / "docker_entrypoint.sh").read_text(encoding="utf-8")
|
||||
abxpkg_repairs = entrypoint.partition('ensure_dir "$ABXPKG_LIB_DIR"')[2].partition("run_as_archivebox touch")[0]
|
||||
|
||||
assert 'for package_dir in "$provider_dir"/packages/*; do' in abxpkg_repairs
|
||||
assert 'ensure_file_owner "$package_dir/derived.env"' in abxpkg_repairs
|
||||
assert "chown -R" not in abxpkg_repairs
|
||||
|
||||
|
||||
def test_root_handoff_never_selects_filesystem_root():
|
||||
|
||||
@ -201,12 +201,17 @@ ensure_runtime_tmp_tree
|
||||
ensure_dir "$ABXPKG_LIB_DIR"
|
||||
ensure_dir "$ABXPKG_LIB_DIR/env"
|
||||
ensure_dir "$ABXPKG_LIB_DIR/env/bin"
|
||||
# abxpkg writes one small derived.env projection per provider. Repair only the
|
||||
# provider directory and projection file; package/cache contents can be large.
|
||||
# abxpkg writes small derived.env projections per provider and package. Repair
|
||||
# only those directories and files; package/cache contents can be large.
|
||||
for provider_dir in "$ABXPKG_LIB_DIR"/*; do
|
||||
[[ -d "$provider_dir" ]] || continue
|
||||
ensure_dir "$provider_dir"
|
||||
ensure_file_owner "$provider_dir/derived.env"
|
||||
for package_dir in "$provider_dir"/packages/*; do
|
||||
[[ -d "$package_dir" ]] || continue
|
||||
ensure_dir "$package_dir"
|
||||
ensure_file_owner "$package_dir/derived.env"
|
||||
done
|
||||
done
|
||||
run_as_archivebox touch "$ABXBUS_CACHE_DIR/semaphores/.permissions_test_safe_to_delete" 2>/dev/null || permission_error "$ABXBUS_CACHE_DIR/semaphores"
|
||||
rm -f "$ABXBUS_CACHE_DIR/semaphores/.permissions_test_safe_to_delete"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user