Bug 19649

Summary: ``pw usermod -n user -d /new/homedir'' does nothing
Product: Base System Reporter: Martin Butkus <mb>
Component: binAssignee: davidn
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.0-STABLE   
Hardware: Any   
OS: Any   

Description Martin Butkus 2000-07-02 20:30:01 UTC
	When you try changing the home directory of an account 
	with "pw usermod -d ...", the home directory is *not* 
	changed. This used to work in earlier 4-STABLEs.

Fix: 

None known, sorry.
How-To-Repeat: 
	root@bagheera# pw usershow mb
	mb:*:1001:1001::0:0:Martin Butkus:/home/mb:/usr/local/bin/zsh

	root@bagheera# pw usermod -n mb -d /

	root@bagheera# pw usershow mb
	mb:*:1001:1001::0:0:Martin Butkus:/home/mb:/usr/local/bin/zsh

	root@bagheera# grep "^mb:" /etc/passwd 
	mb:*:1001:1001:Martin Butkus:/home/mb:/usr/local/bin/zsh
Comment 1 Sheldon Hearn freebsd_committer freebsd_triage 2000-07-03 10:13:44 UTC
Responsible Changed
From-To: freebsd-bugs->davidn

David's interested in these.
Comment 2 davidn freebsd_committer freebsd_triage 2000-07-04 04:14:00 UTC
State Changed
From-To: open->closed

Fixed in rev. 1.39 of pw_user.c in -current, and MFC to 
4.0-stable shortly. Thanks for the bug report!
Comment 3 Peter Pentchev 2000-07-14 15:28:58 UTC
The attached patch solves this problem for me; IMHO, there's
no reason not to commit it to RELENG_4 before 4.1-RELEASE.

G'luck,
Peter Pentchev

----------------------------------------------
This would easier understand fewer had omitted.

diff -u src/usr.sbin/pw/pw_user.c mysrc/usr.sbin/pw/pw_user.c
--- src/usr.sbin/pw/pw_user.c	Mon Jul  3 11:47:50 2000
+++ mysrc/usr.sbin/pw/pw_user.c	Mon Jul  3 11:46:56 2000
@@ -537,6 +537,7 @@
 				  warnx("WARNING: home `%s' does not exist", pwd->pw_dir);
 			} else if (!S_ISDIR(st.st_mode))
 				warnx("WARNING: home `%s' is not a directory", pwd->pw_dir);
+			edited = 1;
 		}
 
 		if ((arg = getarg(args, 'w')) != NULL && getarg(args, 'h') == NULL) {
Comment 4 Peter Pentchev 2000-07-14 15:41:44 UTC
Hmm sorry for the last post; never noticed the person responsible
had actually fixed this in -current :(
Still, this does look like a pretty strong MFC candidate to me.

G'luck,
Peter

----------------------------------------------
This sentence was in the past tense.