Bug 194971 - [patch] pw(8): wrong error message when using -V dir
Summary: [patch] pw(8): wrong error message when using -V dir
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Baptiste Daroussin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-12 20:18 UTC by Freddy DISSAUX
Modified: 2014-11-12 22:31 UTC (History)
0 users

See Also:


Attachments
patch for pw.c (633 bytes, patch)
2014-11-12 20:18 UTC, Freddy DISSAUX
no flags Details | Diff
test fake dir for -V flag (408 bytes, text/plain)
2014-11-12 20:20 UTC, Freddy DISSAUX
no flags Details
activate pw_etcdir.sh (395 bytes, patch)
2014-11-12 20:21 UTC, Freddy DISSAUX
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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