From nobody@FreeBSD.org  Mon Feb 25 17:06:42 2008
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7065B16A401
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 25 Feb 2008 17:06:42 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 689B613C447
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 25 Feb 2008 17:06:42 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.2/8.14.2) with ESMTP id m1PH3xM7050189
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 25 Feb 2008 17:03:59 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.2/8.14.1/Submit) id m1PH3xdP050187;
	Mon, 25 Feb 2008 17:03:59 GMT
	(envelope-from nobody)
Message-Id: <200802251703.m1PH3xdP050187@www.freebsd.org>
Date: Mon, 25 Feb 2008 17:03:59 GMT
From: Joseph Terner <jtsn@gmx.de>
To: freebsd-gnats-submit@FreeBSD.org
Subject: pkg_add(1) does nothing and returns zero if called without arguments
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         121093
>Category:       bin
>Synopsis:       [patch] pkg_add(1) does nothing and returns zero if called without arguments
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    brooks
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Feb 25 17:10:04 UTC 2008
>Closed-Date:    Sun Oct 26 19:22:59 UTC 2008
>Last-Modified:  Sun Oct 26 19:22:59 UTC 2008
>Originator:     Joseph Terner
>Release:        FreeBSD 6.3-RELEASE
>Organization:
>Environment:
FreeBSD nexus 6.3-RELEASE FreeBSD 6.3-RELEASE #0: Wed Feb  6 02:58:38 CET 2008     root@nexus:/var/tmp/obj/usr/src/sys/NEXUS  i386
>Description:
According to the pkg_add(1) man page at least one argument is mandantory:

SYNOPSIS
     pkg_add [-vInfFrRMSK] [-t template] [-p prefix] [-P prefix]
             [-C chrootdir] pkg-name [pkg-name ...]

But if incorrectly called without arguments, no usage information is displayed and the return value is zero.

# pkg_add
# echo $?
0
#

pkg_delete(1) behaves correctly:

# pkg_delete
pkg_delete: missing package name(s)
usage: pkg_delete [-dDfGinrvxX] [-p prefix] pkg-name ...
       pkg_delete -a [flags]
# echo $?
1
#

>How-To-Repeat:

>Fix:


>Release-Note:
>Audit-Trail:

From: Volker <volker@vwsoft.com>
To: bug-followup@FreeBSD.org, jtsn@gmx.de
Cc:  
Subject: Re: misc/121093: pkg_add(1) does nothing and returns zero if called
 without arguments
Date: Tue, 26 Feb 2008 03:09:23 +0100

 This is a multi-part message in MIME format.
 --------------090208000807030901070300
 Content-Type: text/plain; charset=ISO-8859-1
 Content-Transfer-Encoding: 7bit
 
 Hi Joseph,
 
 using the attached patch, `pkg_add' now gives:
 pkg_add: missing package name(s)
 usage: pkg_add [-vInfFrRMSK] [-t template] [-p prefix] [-P prefix] [-C
 chrootdir]
                pkg-name [pkg-name ...]
 
 which I think should be correct behavior.
 
 The patch may be a few lines off but should otherwise apply cleanly.
 
 
 --------------090208000807030901070300
 Content-Type: text/x-patch;
  name="pkg_add.diff"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline;
  filename="pkg_add.diff"
 
 --- usr.sbin/pkg_install/add/main.c.orig	2008-02-26 03:02:35.000000000 +0100
 +++ usr.sbin/pkg_install/add/main.c	2008-02-26 03:02:48.000000000 +0100
 @@ -238,7 +238,7 @@
  	}
      }
      /* If no packages, yelp */
 -    else if (!ch) {
 +    if (!ch) {
  	warnx("missing package name(s)");
  	usage();
      }
 
 --------------090208000807030901070300--
State-Changed-From-To: open->feedback 
State-Changed-By: linimon 
State-Changed-When: Thu Feb 28 00:30:43 UTC 2008 
State-Changed-Why:  
To submitter: does the suggested patch solve your problem? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=121093 

From: Joseph Terner <jtsn@gmx.de>
To: bug-followup@freebsd.org, linimon@FreeBSD.org
Cc: Volker <volker@vwsoft.com>
Subject: Re: bin/121093: [patch] pkg_add(1) does nothing and returns zero if
 called without arguments
Date: Thu, 28 Feb 2008 10:47:43 +0100 (CET)

 On Thu, 28 Feb 2008, linimon@FreeBSD.org wrote:
 
 > To submitter: does the suggested patch solve your problem?
 
 The patch applies cleanly and resolves the issue.
 
 Thank you, Volker.
 
 Regards,
 Joseph
State-Changed-From-To: feedback->analyzed 
State-Changed-By: linimon 
State-Changed-When: Thu Feb 28 17:19:09 UTC 2008 
State-Changed-Why:  
Submitter confirms the suggested patch solves the problem. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=121093 
State-Changed-From-To: analyzed->patched 
State-Changed-By: brooks 
State-Changed-When: Fri Oct 17 15:10:45 UTC 2008 
State-Changed-Why:  
Committed to HEAD. 


Responsible-Changed-From-To: freebsd-bugs->brooks 
Responsible-Changed-By: brooks 
Responsible-Changed-When: Fri Oct 17 15:10:45 UTC 2008 
Responsible-Changed-Why:  
Committed to HEAD. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=121093 
State-Changed-From-To: patched->closed 
State-Changed-By: brooks 
State-Changed-When: Sun Oct 26 19:22:16 UTC 2008 
State-Changed-Why:  
Merged to 6 and 7 stable for 6.4 and 7.1. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=121093 
>Unformatted:
