deb: chown the symlinks, not their targets, in the handover
The handover pipeline found entries with find, which never dereferences, but chowned them without -h, so chown followed each symlink to its target. A dangling one, which vendored trees carry (skia's fontations/Cargo.toml points into a bazel external that is not shipped), then failed with ENOENT and aborted the handover mid-build.
This commit is contained in:
1 parent
5c3808f083
commit
fb61df35fe
1 file changed
+6
-2
+6
-2
@@ -408,11 +408,15 @@ fn migrate_ccache_ownership(ccache_host_dir: &Path) {
|
|||||||
/// (staging, quilt re-application), and the copy-ups of independent files
|
/// (staging, quilt re-application), and the copy-ups of independent files
|
||||||
/// parallelize across the chroot's cores. On a resumed tree every entry
|
/// parallelize across the chroot's cores. On a resumed tree every entry
|
||||||
/// is already owned and the phase collapses to a metadata-only walk.
|
/// is already owned and the phase collapses to a metadata-only walk.
|
||||||
|
///
|
||||||
|
/// The chown is `-h`: find never dereferences, and plain chown would follow
|
||||||
|
/// a symlink to its target — a dangling one (vendored trees carry them)
|
||||||
|
/// then fails with ENOENT and aborts the handover.
|
||||||
fn hand_over_script(dir: &str, uid: &str, gid: &str) -> String {
|
fn hand_over_script(dir: &str, uid: &str, gid: &str) -> String {
|
||||||
format!(
|
format!(
|
||||||
"n=$(nproc 2>/dev/null || echo 4); \
|
"n=$(nproc 2>/dev/null || echo 4); \
|
||||||
find {} \\! -uid {uid} -print0 \
|
find {} \\! -uid {uid} -print0 \
|
||||||
| xargs -0 -r -P \"$n\" -n 512 chown -- {uid}:{gid}",
|
| xargs -0 -r -P \"$n\" -n 512 chown -h -- {uid}:{gid}",
|
||||||
shlex_quote(dir)
|
shlex_quote(dir)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -1963,7 +1967,7 @@ mod tests {
|
|||||||
"{script}"
|
"{script}"
|
||||||
);
|
);
|
||||||
assert!(script.contains("xargs -0 -r -P"), "{script}");
|
assert!(script.contains("xargs -0 -r -P"), "{script}");
|
||||||
assert!(script.contains("chown -- 64500:64500"), "{script}");
|
assert!(script.contains("chown -h -- 64500:64500"), "{script}");
|
||||||
|
|
||||||
let quoted = hand_over_script("/tmp/some'dir", "1000", "1000");
|
let quoted = hand_over_script("/tmp/some'dir", "1000", "1000");
|
||||||
assert!(
|
assert!(
|
||||||
|
|||||||
Reference in new issue
Block a user