misc/92866: pkg_add should return a different result code if
package is installed
Jo Rhett
jrhett at svcolo.com
Sun Feb 5 16:30:09 PST 2006
>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:
More information about the freebsd-bugs
mailing list