Date: Sat, 09 Apr 2022 22:31:31 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 263188] pw accepts an "illegal option" but completes the command without error Message-ID: <bug-263188-227-nmbxlQ9lZ2@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-263188-227@https.bugs.freebsd.org/bugzilla/> References: <bug-263188-227@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D263188 --- Comment #2 from Dennis Clarke <dclarke@blastwave.org> --- Testing the exit status and error message on another system where I see that I may add a user reasonably :=20 # uname -apKU=20 FreeBSD callisto 13.0-RELEASE-p11 FreeBSD 13.0-RELEASE-p11 #0: Tue Apr 5 18:54:35 UTC 2022=20=20=20=20 root@amd64-builder.daemonology.net:/usr/obj/usr/src/amd64.amd64/sys/GENERIC= =20 amd64 amd64 1300139 1300139 #=20 # adduser Username: testdude=20 Full name: The Test Dude Uid (Leave empty for default): 54321 Login group [testdude]: devl Login group is devl. Invite testdude into other groups? []:=20 Login class [default]:=20 Shell (sh csh tcsh git-shell bash rbash nologin) [sh]:=20 Home directory [/home/testdude]:=20 Home directory permissions (Leave empty for default):=20 Use password-based authentication? [yes]:=20 Use an empty password? (yes/no) [no]:=20 Use a random password? (yes/no) [no]:=20 Enter password:=20 Enter password again:=20 Lock out the account after creation? [no]:=20 Username : testdude Password : ***** Full Name : The Test Dude Uid : 54321 Class :=20 Groups : devl=20 Home : /home/testdude Home Mode :=20 Shell : /bin/sh Locked : no OK? (yes/no): yes adduser: INFO: Successfully added (testdude) to the user database. Add another user? (yes/no): no Goodbye! #=20 # There we see a valid adduser and a home directory : # ls -lap /usr/home=20 total 35 drwxr-xr-x 5 root wheel 5 Apr 9 22:26 ./ drwxr-xr-x 16 root wheel 16 Feb 20 02:04 ../ drwxr-xr-x 4 admsys admsys 12 Mar 23 22:09 admsys/ drwxr-xr-x 8 dclarke devl 21 Apr 8 05:16 dclarke/ drwxr-xr-x 2 testdude devl 9 Apr 9 22:26 testdude/ #=20 Now delete the user and the home directory but with a wrong option : # pw userdel -n testdude -t pw: illegal option -- t # echo $? 0 # Above we clearly see a clean zero value exist status. # ls -lapb /usr/home total 35 drwxr-xr-x 5 root wheel 5 Apr 9 22:26 ./ drwxr-xr-x 16 root wheel 16 Feb 20 02:04 ../ drwxr-xr-x 4 admsys admsys 12 Mar 23 22:09 admsys/ drwxr-xr-x 8 dclarke devl 21 Apr 8 05:16 dclarke/ drwxr-xr-x 2 54321 devl 9 Apr 9 22:26 testdude/ #=20 # pw userdel -n testdude -r pw: no such user `testdude' # echo $? 67 #=20 # rm -rf /usr/home/testdude #=20 So yes the user was in fact deleted from the system but the command issues a strange message and a zero exit status whereas a more reasonable behavior would be to issue a non-zero exit status and do no change to the system.=20 --=20 Dennis Clarke RISC-V/SPARC/PPC/ARM/CISC UNIX and Linux spoken GreyBeard and suspenders optional I see different behavior on another system where the exit status is set to 67 but again the user is removed from the machine and the home directory remains :=20 # uname -apKU=20 FreeBSD callisto 13.0-RELEASE-p11 FreeBSD 13.0-RELEASE-p11 #0: Tue Apr 5 18:54:35 UTC 2022=20=20=20=20 root@amd64-builder.daemonology.net:/usr/obj/usr/src/amd64.amd64/sys/GENERIC= =20 amd64 amd64 1300139 1300139 #=20 # ls -lap /usr/home=20 total 27 drwxr-xr-x 5 root wheel 5 Apr 4 14:30 ./ drwxr-xr-x 16 root wheel 16 Feb 20 02:04 ../ drwxr-xr-x 4 admsys admsys 12 Mar 23 22:09 admsys/ drwxr-xr-x 8 dclarke devl 21 Apr 8 05:16 dclarke/ drwx------ 2 54321 testnfs 2 Apr 4 14:30 testdude/ #=20 # pw userdel -n testdude -t pw: illegal option -- t pw: no such user `testdude' # echo $? 67 #=20 # ls -lapb /usr/home=20 total 27 drwxr-xr-x 5 root wheel 5 Apr 4 14:30 ./ drwxr-xr-x 16 root wheel 16 Feb 20 02:04 ../ drwxr-xr-x 4 admsys admsys 12 Mar 23 22:09 admsys/ drwxr-xr-x 8 dclarke devl 21 Apr 8 05:16 dclarke/ drwx------ 2 54321 testnfs 2 Apr 4 14:30 testdude/ #=20 # pw userdel -n testdude -r pw: no such user `testdude' #=20 # ls -lapb /usr/home total 27 drwxr-xr-x 5 root wheel 5 Apr 4 14:30 ./ drwxr-xr-x 16 root wheel 16 Feb 20 02:04 ../ drwxr-xr-x 4 admsys admsys 12 Mar 23 22:09 admsys/ drwxr-xr-x 8 dclarke devl 21 Apr 8 05:16 dclarke/ drwx------ 2 54321 testnfs 2 Apr 4 14:30 testdude/ #=20 # rm -rf /usr/home/testdude/ # --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-263188-227-nmbxlQ9lZ2>