From owner-freebsd-bugs@FreeBSD.ORG Mon Feb 6 00:30:09 2006 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7C57816A423 for ; Mon, 6 Feb 2006 00:30:09 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2469643D48 for ; Mon, 6 Feb 2006 00:30:05 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k160U4T3041142 for ; Mon, 6 Feb 2006 00:30:04 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k160U4Za041141; Mon, 6 Feb 2006 00:30:04 GMT (envelope-from gnats) Resent-Date: Mon, 6 Feb 2006 00:30:04 GMT Resent-Message-Id: <200602060030.k160U4Za041141@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Jo Rhett Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A948516A420 for ; Mon, 6 Feb 2006 00:20:23 +0000 (GMT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [216.136.204.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id 77F6843D45 for ; Mon, 6 Feb 2006 00:20:23 +0000 (GMT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.13.1/8.13.1) with ESMTP id k160KNRi029995 for ; Mon, 6 Feb 2006 00:20:23 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.13.1/8.13.1/Submit) id k160KNpM029994; Mon, 6 Feb 2006 00:20:23 GMT (envelope-from nobody) Message-Id: <200602060020.k160KNpM029994@www.freebsd.org> Date: Mon, 6 Feb 2006 00:20:23 GMT From: Jo Rhett To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-2.3 Cc: Subject: misc/92866: pkg_add should return a different result code if package is installed X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Feb 2006 00:30:09 -0000 >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: