From Bugzilla Helper: User-Agent: Mozilla/5.0 (Windows; U; Win98; en-GB; rv:1.5) Gecko/20031007 Description of problem: The man page (in the messed up default charset - can we get an 'export LANG=C' put into the profile as a fix, please?) for usermod says: -d home_dir The user�s new login directory. If the -m option is given the contents of the current home directory will be moved to the new home directory, which is created if it does not already exist. I'm reading this as at least "if there's no ~, make one." Seems that's not what it's doing: [root@fishy root]# usermod -d /home/steve -m steve [root@fishy root]# ls -l ~steve ls: /home/steve: No such file or directory in fact, (see attachment, strace) it doesn't even seem to be checking to see if ~steve's even there! Version-Release number of selected component (if applicable): shadow-utils-4.0.3-6 How reproducible: Always Steps to Reproduce: 1. usermod -d <new dir> -m <some user> 2. ls -l ~<same user> 3. Actual Results: Nothing. Well, changes to /etc/passwd, of course. No files moved, no dirs created. Expected Results: I had hoped that ~steve would exist, at the least. I mean, I can do me a mv, or a mkdir-p / chown / chmod dance, but I was hoping that it would just kinda work. Additional info: My box is so stock, probably rpm -Va would be clean.
Created attachment 96030 [details] strace of 'moduser -d /home/steve2 -m steve' Have a strace. Watch it prove me wrong. 8-) (actually it nullifies some of it. It seems to be checking to see if the old dir exists .. but it's still not creating the new)
I'd read it as "whatever was in the old home directory gets moved to the new location". If I'm reading the strace output right, the original home directory was /home/steve, which didn't exist. usermod searched for the contents of the home directory, determined that there was nothing to move, and did nothing, which is what I'd have expected. Unless I'm missing something here, I'm inclined to mark this notabug.
Sure. It then boils down to just a badly-worded manpage. No big deal.
Okay, good to know we're on the same page. If you have a clearer wording, I can ask upstream if they want to incorporate it. Thanks!
Yeah, that would be cool. Is it the PLD folks maintaining that source? If so, I can mail Tomasz instead, if you're busy (and that's labour you don't have to do!) I'm not thinking anything too major; just changing the logic as described on the manpage to match what's actually happening, and I'm thinking it just needs a few added words for that: if -d specified ; then + if [ -d current_home ]; then if [ ! -d new_home ] ; then install -d -o $(id -un <user>) -g $(id -gn <user>) new_home fi - if [ -d current_home ]; then mv_and_rechown (current_home, new_home) fi fi diff -uBb /home/bishop/cvs/shadow/man/usermod.8\~ /home/bishop/cvs/shadow/man/usermod.8 --- /home/bishop/cvs/shadow/man/usermod.8~ 2003-10-21 13:13:11.000000000 -0700 +++ /home/bishop/cvs/shadow/man/usermod.8 2003-11-21 03:49:53.000000000 -0800 @@ -48,9 +48,10 @@ The new value of the user's password file comment field. It is normally modified using the \fBchfn\fR(1) utility. .IP "\fB-d\fR \fIhome_dir\fR" -The user's new login directory. If the \fB-m\fR option is given the contents -of the current home directory will be moved to the new home directory, which -is created if it does not already exist. +The user's new login directory. If the \fB-m\fR option is given and +the current home directory exists, the contents of the current home +directory will be moved to the new home directory, which is created if +it does not already exist. .IP "\fB-e\fR \fIexpire_date\fR" The date on which the user account will be disabled. The date is specified in the format \fIYYYY-MM-DD\fR.
Yes, so far as I know the PLD site (http://shadow.pld.org.pl/) is still the official upstream. Thanks!
Sent. Maybe it'll appear, maybe not. Thanks a lot for your help, as always. - bish