From owner-freebsd-bugs@FreeBSD.ORG Sat Oct 8 20:50:14 2005 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 C7B9A16A41F for ; Sat, 8 Oct 2005 20:50:14 +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 3D37F43D46 for ; Sat, 8 Oct 2005 20:50:14 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j98KoEdW014680 for ; Sat, 8 Oct 2005 20:50:14 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j98KoEue014679; Sat, 8 Oct 2005 20:50:14 GMT (envelope-from gnats) Resent-Date: Sat, 8 Oct 2005 20:50:14 GMT Resent-Message-Id: <200510082050.j98KoEue014679@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, Seán Farley Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0504F16A41F for ; Sat, 8 Oct 2005 20:41:26 +0000 (GMT) (envelope-from sean@farley.org) Received: from mail.farley.org (farley.org [67.64.95.201]) by mx1.FreeBSD.org (Postfix) with ESMTP id EEA8243D6D for ; Sat, 8 Oct 2005 20:41:20 +0000 (GMT) (envelope-from sean@farley.org) Received: from thor.farley.org (thor.farley.org [IPv6:2001:470:1f01:290:1::5]) by mail.farley.org (8.13.1/8.13.1) with ESMTP id j98KgExB057010 for ; Sat, 8 Oct 2005 15:42:14 -0500 (CDT) (envelope-from sean@gw.farley.org) Received: from thor.farley.org (localhost [127.0.0.1]) by thor.farley.org (8.13.4/8.13.4) with ESMTP id j98KfjLt026830 for ; Sat, 8 Oct 2005 15:41:45 -0500 (CDT) (envelope-from sean@thor.farley.org) Received: (from sean@localhost) by thor.farley.org (8.13.4/8.13.3/Submit) id j98Kfjg4026829; Sat, 8 Oct 2005 15:41:45 -0500 (CDT) (envelope-from sean) Message-Id: <200510082041.j98Kfjg4026829@thor.farley.org> Date: Sat, 8 Oct 2005 15:41:45 -0500 (CDT) From: Seán Farley To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: bin/87136: pkg_version exits if the INDEX file is not found X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Seán Farley List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Oct 2005 20:50:15 -0000 >Number: 87136 >Category: bin >Synopsis: pkg_version exits if the INDEX file is not found >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Oct 08 20:50:13 GMT 2005 >Closed-Date: >Last-Modified: >Originator: Seán Farley >Release: FreeBSD 5.4-STABLE i386 >Organization: >Environment: System: FreeBSD thor.farley.org 5.4-STABLE FreeBSD 5.4-STABLE #0: Thu Sep 29 16:01:50 CDT 2005 root@thor.farley.org:/usr/obj/usr/src/sys/THOR i386 >Description: pkg_version exits if the INDEX file is not found although the -I option, which requires an INDEX file, was not given. I need pkg_version to not exit for my port manager (found here: http://www.farley.org/?page=software#pm) script to function correctly. >How-To-Repeat: Run pkg_version with an installed port that has been removed from /usr/ports. >Fix: Here is a patch to not exit if the INDEX file is not found and -I is not given. The result is that the package will be listed with a '?' as if it was not found within the INDEX file. The patch with and without whitespace changes can be found here: http://www.farley.org/freebsd/tmp/pkg_version.patch http://www.farley.org/freebsd/tmp/pkg_version-nows.patch diff -ruw /usr/src/usr.sbin/pkg_install/version/perform.c pkg_install/version/perform.c --- /usr/src/usr.sbin/pkg_install/version/perform.c Wed Jun 22 17:49:17 2005 +++ pkg_install/version/perform.c Sat Oct 8 15:26:06 2005 @@ -157,6 +157,10 @@ } } if (latest == NULL) { + /* Report package as not found in INDEX if the INDEX is not required. */ + if (IndexFile == NULL && !UseINDEXOnly) + show_version(plist.name, NULL, plist.origin); + else { /* We only pull in the INDEX once, if needed. */ if (SLIST_EMPTY(&Index)) { if (!IndexFile) @@ -222,6 +226,7 @@ show_version(plist.name, NULL, plist.origin); else show_version(plist.name, latest, "index"); + } } if (latest != NULL) free(latest); >Release-Note: >Audit-Trail: >Unformatted: