Repository navigation
usermod: add -m/--move-home - #350
jayhemnani9910 wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
2853a4b to
a7fe69b
Compare
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
a7fe69b to
62b7459
Compare
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
Fixes #348
Builds on #349: the first commit here is that PR. I will rebase once it merges.
-mneeds-d(clap, exit 2). After the account files are written, the old home is renamed to the new path; across filesystems it is copied, keeping owners, modes, times, hard links, symlinks and fifos, then the old tree is removed. A failed copy removes the partial new tree and leaves the old one. Like GNU: new path exists, exit 12; move fails, exit 12 with/etc/passwdalready updated; old home missing, a warning and exit 0; old tree not fully removable after a copy, a warning and exit 0. With-uor-gthe home is re-owned at its new path.The user owns the tree being copied and can swap entries while it runs, so the copy walks it through directory fds (
openatwithO_NOFOLLOW) and copies the attributes of what it actually opened. The new tree stays root-owned 0700 until the end. Not copied: xattrs and ACLs; sparse files are written out in full.Tests: a unit test for the copy (hard link, symlink, fifo, mode, mtime), root tests for a move and for a move onto an existing directory (exit 12), and
-mwithout-d.cargo test --workspacerun as root in an Ubuntu 26.04 container: 950 passed (946 with the -g PR, plus the four new).cargo fmt --checkandcargo clippy --workspace --all-targets -- -D warningsare clean. Against GNU shadow 4.17.4 in the same container (old home on the overlay, new home on overlay or tmpfs), moves with-u,-g,-l, a foreign-owned file, a setuid file, a hard link, a symlink and a fifo give the same tree, ownership, times and exit codes.AI tools assisted with this contribution.