1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-08 06:53:54 +02:00

Merge remote-tracking branch 'upstream/master' into overlayfs-store

This commit is contained in:
John Ericson 2023-10-23 13:13:37 -04:00
commit 5c1cb0b696
941 changed files with 10981 additions and 4439 deletions

View file

@ -0,0 +1,47 @@
#!/usr/bin/env bash
set -eu -o pipefail
set -x
source common.sh
# Avoid store dir being inside sandbox build-dir
unset NIX_STORE_DIR
unset NIX_STATE_DIR
storeDirs
initLowerStore
mountOverlayfs
buildInStore () {
nix-build --store "$1" ../hermetic.nix --arg busybox "$busybox" --arg seed 1 --no-out-link
}
triggerStaleFileHandle () {
# Arrange it so there are duplicate paths
nix-store --store "$storeA" --gc # Clear lower store
buildInStore "$storeB" # Build into upper layer first
buildInStore "$storeA" # Then build in lower store
# Duplicate paths mean GC will have to delete via upper layer
nix-store --store "$storeB" --gc
# Clear lower store again to force building in upper layer
nix-store --store "$storeA" --gc
# Now attempting to build in upper layer will fail
buildInStore "$storeB"
}
# Without remounting, we should encounter errors
expectStderr 1 triggerStaleFileHandle | grepQuiet 'Stale file handle'
# Configure remount-hook and reset OverlayFS
storeB="$storeB&remount-hook=$PWD/remount.sh"
remountOverlayfs
# Now it should succeed
triggerStaleFileHandle