Bug 194971

Summary: [patch] pw(8): wrong error message when using -V dir
Product: Base System Reporter: Freddy DISSAUX <bugzilla>
Component: binAssignee: Baptiste Daroussin <bapt>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: ---    
Version: CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
patch for pw.c
none
test fake dir for -V flag
none
activate pw_etcdir.sh none

Description Freddy DISSAUX 2014-11-12 20:18:39 UTC
Created attachment 149333 [details]
patch for pw.c

When using -V dir flag, pw(8) display wrong error message if dir 
not exists

# pw -V /this_directory_does_not_exists usershow root
pw: no such user `root'
# echo $?
67

After patch:
# /usr/obj/usr/src/usr.sbin/pw/pw -V /this_directory_does_not_exists usershow root
pw: no such directory `/this_directory_does_not_exists'
# echo $?
72
Comment 1 Freddy DISSAUX 2014-11-12 20:20:51 UTC
Created attachment 149334 [details]
test fake dir for -V flag
Comment 2 Freddy DISSAUX 2014-11-12 20:21:34 UTC
Created attachment 149335 [details]
activate pw_etcdir.sh
Comment 3 commit-hook freebsd_committer 2014-11-12 22:28:05 UTC
A commit references this bug:

Author: bapt
Date: Wed Nov 12 22:27:54 UTC 2014
New revision: 274453
URL: https://svnweb.freebsd.org/changeset/base/274453

Log:
  Fix wrong message when using pw -V with a non existent directory
  Add a regression test about it

  PR:		194971
  Submitted by:	Freddy DISSAUX <bugzilla@dsx.bsdsx.fr>

Changes:
  head/usr.sbin/pw/pw.c
  head/usr.sbin/pw/tests/Makefile
  head/usr.sbin/pw/tests/pw_etcdir.sh
Comment 4 Baptiste Daroussin freebsd_committer 2014-11-12 22:29:08 UTC
Committed with minor fixes regarding style