Load binaries from a read-only lib dir
AS
15h ago+187+187+012345678901234567890123456789-4-4-0123456789
On a read-only ABXPKG_LIB_DIR:
save_derived_cacheskips the write.EnvProviderreturns the host binary instead of creating a newenv/binlink.write_cached_binaryno longer creates missing provider roots.- Package-manager caches under
$ABXPKG_LIB_DIR/cache/<provider>fall back toABXPKG_TMP_CACHE_DIR.
It applies whenever the lib dir is on a read-only mount; there is no setting. Writable lib dirs are unchanged. The README documents the behaviour.
Tested:
uv run pytest tests/test_read_only_lib_dir.py: passes. It fails on main and with any one of the four changes removed. It installs into a Docker volume, makes a cached record stale, then mounts the volume read-only and loads, invalidates and reloads.uv run pytest tests/test_envprovider.py tests/test_env_projection_concurrency.py tests/test_cache_timestamp_precision.py tests/test_central_lib_dir.py tests/test_uvprovider.py tests/test_binprovider.py: same results as main.uv run prek run --files abxpkg/config.py abxpkg/base_types.py abxpkg/binprovider.py tests/test_read_only_lib_dir.py README.md: passes.- ArchiveBox 0.9.73 image with a read-only root:
archivebox addfailed withabxpkg could not resolve supervisordbefore and archives normally with this.
Refs ArchiveBox/ArchiveBox#1980
Summary by cubic
Fixes abxpkg failing to load installed binaries when ABXPKG_LIB_DIR is on a read-only mount, so container images with a read-only root filesystem keep resolving binaries instead of hitting EROFS.
- On read-only mounts,
derived.envwrites are skipped (records are still re-validated on every read), provider roots aren't created, andEnvProviderreturns the host binary without adding anenv/binlink. - Package-manager caches under
$ABXPKG_LIB_DIR/cache/<provider>fall back to theABXPKG_TMP_CACHE_DIRlocation, asuvlocks its cache even for read-only operations likepip show. - Detection is automatic via
statvfs; writable lib dirs behave as before, and installing into a read-only lib dir still fails. - Adds a Docker integration test that installs into a volume, remounts it read-only, then loads, invalidates, and reloads binaries.