mirror of
https://github.com/systemd/systemd.git
synced 2026-11-07 22:07:14 +00:00
machinectl clone --read-only ignored the requested read-only mode when cloning a foreign-UID-owned directory because the unprivileged clone path did not receive the read_only argument. Pass the flag through and apply the immutable bit via the already-open destination directory fd after copying. Keep this best-effort, matching the ordinary directory clone fallback, so failure to set the attribute does not turn a completed copy into a reported clone failure. Add a regression test using foreign-0 rather than a fixed UID. Verify the cloned image's ReadOnly property, copied contents and ownership, and that the immutable directory rejects new entries. Run this subtest only when file attributes and the existing rootless nspawn prerequisites are available, leaving the other machined tests unchanged. (cherry picked from commitf789245918) (cherry picked from commit618d3e7d10)