From Jim.Pirzyk@disney.com  Fri Nov 24 11:48:44 2000
Return-Path: <Jim.Pirzyk@disney.com>
Received: from mail.disney.com (mail.disney.com [204.128.192.15])
	by hub.freebsd.org (Postfix) with ESMTP id 4A94737B4CF
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 24 Nov 2000 11:48:44 -0800 (PST)
Received: from pain10.corp.disney.com (root@pain10.corp.disney.com [153.7.110.100])
	by mail.disney.com (Switch-2.0.1/Switch-2.0.1) with SMTP id eAOJmYp11694
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 24 Nov 2000 11:48:34 -0800 (PST)
Received: from louie.fa.disney.com by pain.corp.disney.com with ESMTP for FreeBSD-gnats-submit@freebsd.org; Fri, 24 Nov 2000 11:49:16 -0800
Received: from plio.fan.fa.disney.com (plio.fan.fa.disney.com [153.7.118.2])
	by louie.fa.disney.com (8.9.2/8.9.2) with ESMTP id LAA16291
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 24 Nov 2000 11:48:35 -0800 (PST)
	(envelope-from Jim.Pirzyk@fa.disney.com)
Received: from snoopy.fan.fa.disney.com (snoopy.fan.fa.disney.com [172.30.228.110])
	by plio.fan.fa.disney.com (8.9.2/8.9.2) with ESMTP id LAA20090
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 24 Nov 2000 11:48:35 -0800 (PST)
	(envelope-from Jim.Pirzyk@fa.disney.com)
Received: (from Jim.Pirzyk@localhost)
	by snoopy.fan.fa.disney.com (8.11.1/8.9.3) id eAOJmZ304495;
	Fri, 24 Nov 2000 11:48:35 -0800 (PST)
	(envelope-from Jim.Pirzyk@fa.disney.com)
Message-Id: <200011241948.eAOJmZ304495@snoopy.fan.fa.disney.com>
Date: Fri, 24 Nov 2000 11:48:35 -0800 (PST)
From: Jim.Pirzyk@disney.com
Reply-To: Jim.Pirzyk@disney.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: pkg_add does not return the correct error code
X-Send-Pr-Version: 3.2

>Number:         23083
>Category:       bin
>Synopsis:       pkg_add returns 0 even if the package is not found
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pirzyk
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Nov 24 11:50:01 PST 2000
>Closed-Date:    Mon Jun 4 14:35:25 PDT 2001
>Last-Modified:  Mon Jun 04 14:35:51 PDT 2001
>Originator:     Jim Pirzyk
>Release:        FreeBSD 4.2-RELEASE i386
>Organization:
>Environment:

	FreeBSD 4.2-RELEASE

>Description:

	If pkg_add is given a package name that it cannot locate the file, it
	fails with a warning message "pkg_add: can't find package 'foo'" but
	returns 0 to the shell.

>How-To-Repeat:

	pkg_add foo
	echo $status 

>Fix:
>Release-Note:
>Audit-Trail:

From: Maxime Henrion <mux@qualys.com>
To: freebsd-gnats-submit@FreeBSD.org
Cc: Jim.Pirzyk@disney.com
Subject: Re: bin/23083: pkg_add returns 0 even if the package is not found
Date: Fri, 22 Dec 2000 19:30:01 +0100

 --dc+cDN39EJAMEtIO
 Content-Type: multipart/mixed; boundary="n8g4imXOkfNTN/H1"
 Content-Disposition: inline
 
 
 --n8g4imXOkfNTN/H1
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable
 
 Attached is a patch which solve this problem.
 
 Regards,
 Maxime Henrion
 --=20
 Don't be fooled by cheap finnish imitations ; BSD is the One True Code
 
 --n8g4imXOkfNTN/H1
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="pkg_add.diff"
 
 *** /usr/src/usr.sbin/pkg_install/add/main.c	Tue Jul 18 03:50:09 2000
 --- main.c	Fri Dec 22 19:25:14 2000
 ***************
 *** 151,157 ****
   		    pkgs[ch] = realpath(*argv, pkgnames[ch]);
   		else {		/* look for the file in the expected places */
   		    if (!(cp = fileFindByPath(NULL, *argv)))
 ! 			warnx("can't find package '%s'", *argv);
   		    else
   			pkgs[ch] = strcpy(pkgnames[ch], cp);
   		}
 --- 151,158 ----
   		    pkgs[ch] = realpath(*argv, pkgnames[ch]);
   		else {		/* look for the file in the expected places */
   		    if (!(cp = fileFindByPath(NULL, *argv)))
 ! 			/* let pkg_do() fail later, so that error is reported */
 ! 			pkgs[ch] = strcpy(pkgnames[ch], *argv);
   		    else
   			pkgs[ch] = strcpy(pkgnames[ch], cp);
   		}
 
 --n8g4imXOkfNTN/H1--
 
 --dc+cDN39EJAMEtIO
 Content-Type: application/pgp-signature
 Content-Disposition: inline
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.0.4 (FreeBSD)
 Comment: For info see http://www.gnupg.org
 
 iEYEARECAAYFAjpDnakACgkQq1Ae8oy+mdbk3ACfa1yntArbzbvrz5X+07sjOLLA
 8IcAoMIJOU0bOkyl1tGJTDsNYZjxiIWX
 =vWUM
 -----END PGP SIGNATURE-----
 
 --dc+cDN39EJAMEtIO--
 
Responsible-Changed-From-To: freebsd-bugs->pirzyk 
Responsible-Changed-By: pirzyk 
Responsible-Changed-When: Mon Jun 4 12:39:51 PDT 2001 
Responsible-Changed-Why:  
Picked up another of my open PR's 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=23083 
State-Changed-From-To: open->closed 
State-Changed-By: pirzyk 
State-Changed-When: Mon Jun 4 14:35:25 PDT 2001 
State-Changed-Why:  
Applied patch, MFC after 2 weeks. 


http://www.FreeBSD.org/cgi/query-pr.cgi?pr=23083 
>Unformatted:
