when the external EDITOR invoked by vipw fails (exits nonzero), vipw prints a message involving strerror(errno), instead of the exit status of the failed program. Fix: src/lib/libutil/pw_util.c:pw_edit and all its callers would have to be changed to allow it other error returns besides -1 setting errno. How-To-Repeat: bash-2.05# EDITOR=false vipw vipw: false: Operation not permitted vipw: /etc/master.passwd: unchanged bash-2.05#
It now says vipw: pw_edit(): No such file or directory which is not better
Created attachment 190815 [details] patch to lib/libutil/pw_util.c With this patch, we have a nicer output. The point is to return 0 (file not modified) if the processes exited abnormally. I think it is pretty much the correct behavior. With this patch, on -CURRENT, this is the output: # export EDITOR=false # vipw 'false' failed with error code 1: Operation not permitted vipw: no changes made # export EDITOR=/home/test/idontexist # vipw '/home/test/idontexist' failed with error code 2: No such file or directory vipw: no changes made # export EDITOR=vim # vipw (I write the file) vipw: password list updated # vipw (I do not write the file) vipw: no changes made The patch can me MFC'd to 11 cleanly.
Can anyone have a look at this? I'm willing to improve the patch if necessary. Cheers
I wasn't aware of this PR until now. This should be fixed by https://svnweb.freebsd.org/changeset/base/362430
It is, confirmed in 13-current r362494 Thanks