Normalize inactive State Anchor work storage

This commit is contained in:
ms2k 2026-07-23 21:44:16 +09:00
commit 42e197510e

View file

@ -1,6 +1,6 @@
use std::collections::BTreeMap;
use std::ffi::OsString;
use std::fs;
use std::fs::{self, File};
use std::io::{self, BufRead, BufReader, Read, Write};
use std::os::unix::ffi::OsStrExt;
use std::os::unix::fs::MetadataExt;
@ -157,10 +157,26 @@ fn run() -> io::Result<()> {
"upper runtime-file entry survived transient override preflight",
));
}
let held_directory = layout.merged().join("root/open-lock");
fs::create_dir_all(&held_directory)?;
let held = File::open(&held_directory)?;
fs::remove_dir(&held_directory)?;
drop(held);
if layout.work().join("work").read_dir()?.next().is_none() {
return Err(io::Error::other(
"open-directory removal did not create fuse-overlayfs work residue",
));
}
runtime_mount.unmount().map_err(io::Error::other)?;
layout.inspect_state().map_err(io::Error::other)?;
fs::remove_file(layout.upper().join("etc/hosts"))?;
let first = acquire(&layout, &artifact)?;
if layout.merged().join("root/open-lock").exists() {
return Err(io::Error::other(
"removed open directory returned after normalized remount",
));
}
fs::write(
layout.merged().join("usr/bin/installed-tool"),
b"persistent",