Repository navigation
userdel: keep a mail spool the user does not own - #401
Open
pierre-warnier wants to merge 1 commit into
Open
pierre-warnier wants to merge 1 commit into
pierre-warnier wants to merge 1 commit into
Conversation
With -r, a mail spool that the user does not own is now kept, as upstream does: "SPOOL not owned by LOGIN, not removing" on stderr, the home still removed, exit 12. -f removes it. A spool that is a symlink is judged by the file it points to, and only the link is ever removed. The spool is looked up once through a descriptor on /var/mail, and the unlink goes through that same descriptor. Fixes #400
pierre-warnier
force-pushed
the
fix-392-userdel-missing
branch
from
November 8, 2026 16:33
1ae392c to
7783c18
Compare
pierre-warnier
force-pushed
the
fix-400-userdel-spool-owner
branch
from
November 8, 2026 16:33
52a474b to
f603a28
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #400
Stacked on #396, which changes the same code. The base is
fix-392-userdel-missingfor now; it will be retargeted tomainonce #396 lands.Ubuntu 26.04 behaviour
Probed in
ubuntu:26.04withpasswd1:4.17.4-2ubuntu3, each case with a home the user owns:/var/mail/LOGIN-ruserdel: /var/mail/LOGIN not owned by LOGIN, not removing-r -f-r-r -f-rand-r -fNothing goes to stdout. Ownership is that of the file the link points to (the links were root's own in every case), and only the link is ever unlinked.
Change
remove_mail_spoolopens a descriptor on the spool's directory, stats the entry through it (following a link, so a dangling one is still "not found", as in #396), and unlinks through that same descriptor. Without-f, a spool owned by another uid is kept and said on stderr; the home is still removed and the exit status is 12. The same probe run against this build gives the same table.Tests: five new cases in
tests/by-util/test_userdel.rs; the two refusal cases fail before the fix (exit 0 instead of 12). The man page and CHANGELOG are updated.Reviews welcome. Without objection, this will be merged after 7 days.