Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Feb 2006 00:20:23 GMT
From:      Jo Rhett <jrhett@svcolo.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/92866: pkg_add should return a different result code if package is installed
Message-ID:  <200602060020.k160KNpM029994@www.freebsd.org>
Resent-Message-ID: <200602060030.k160U4Za041141@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         92866
>Category:       misc
>Synopsis:       pkg_add should return a different result code if package is installed
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Feb 06 00:30:04 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Jo Rhett
>Release:        6.0
>Organization:
Silicon Valley Colocation
>Environment:
FreeBSD [hostname].meer.net 6.0-RELEASE FreeBSD 6.0-RELEASE #4: Fri Nov 11 13:29:33 PST 2005
>Description:
If you try to install a package using pkg_add, and check the return code, pkg_add returns the same result (1) if it can't install the package or the package is already installed.  This makes it problematic to script.

In particular, if you install with a URL, pkg_add will recursively attempt to install the dependancies.  So if you have a list

package1
package2
package3

And you install package1, which requires package2, then both are installed (yay)

However, when you go to the next item, pkg_add will fail and if you are checking error codes it will abort.  

If pkg_add returned a different error code for an already installed package it would be easier to script.


>How-To-Repeat:
pkg_add http://somesite/package1.tbz
package1 requires package2, which it downloads and installs.

pkg_add http://somesite/package2.tbz 
echo $?  (or $status)
>Fix:
Return a different error code if the package is already installed. either 2 or -1 come to mind...
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200602060020.k160KNpM029994>