NetBSD Problem Report #29687

From kuebart@mathematik.uni-ulm.de  Sun Mar 13 10:13:41 2005
Return-Path: <kuebart@mathematik.uni-ulm.de>
Received: from mout1.freenet.de (mout1.freenet.de [194.97.50.132])
	by narn.netbsd.org (Postfix) with ESMTP id 9249E63B116
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 13 Mar 2005 10:13:40 +0000 (UTC)
Message-Id: <E1DAQ6K-0005ZR-DH@jaja>
Date: Sun, 13 Mar 2005 11:13:36 +0100
From: Joachim Kuebart <kuebart@mathematik.uni-ulm.de>
Reply-To: kuebart@mathematik.uni-ulm.de
To: gnats-bugs@netbsd.org
Subject: pkg_add cannot pass the empty view to pkg_view
X-Send-Pr-Version: 3.95

>Number:         29687
>Category:       bin
>Synopsis:       when pkg_add is called with -w "", pkg_view complains about its usage
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Mar 13 10:14:01 +0000 2005
>Originator:     Joachim Kuebart
>Release:        NetBSD 2.99.16
>Organization:
>Environment:
System: NetBSD jaja 2.99.16 NetBSD 2.99.16 (ALPHA-$Revision: 1.201 $) #0: Fri Mar 11 19:29:41 CET 2005 joki@jaja:/usr/obj/usr/src/sys/arch/alpha/compile/JAJA alpha
Architecture: alpha
Machine: alpha
>Description:
	Whenn installing a depoted package with pkg_add and passing the
	empty view explicitly via -w "", pkg_view gets called with the -w
	option, but without an argument. It consequently complains with a
	usage message.

>How-To-Repeat:
	Use a depoted package, for example, digest-20021220, and run

		pkg_add -w "" digest-20021220

	pkg_add will then call pkg_view with the following arguments:

		pkg_view -w add digest-20021220

	and the package is not added to the default (empty) view.

>Fix:
	This patch also fixes additional blanks as noted by me in
	<http://mail-index.netbsd.org/tech-pkg/2005/03/12/0004.html>.

	This solution uses
	     1) no -w argument to pkg_view if -w was not specified on
		the pkg_add command line (View == NULL)

	     2) an argument of --view= if -w "" was specified on the
		pkg_add command line. This is necessary to bypass argument
		deletion by fexec_skipempty().

	     3) arguments -w <View> if a non-empty view was specified on
		the pkg_add command line.

	If the nested ?: construct is deemed too convoluted, I'm happy to
	think of another solution.

cvs diff: Diffing .
Index: perform.c
===================================================================
RCS file: /pub/NetBSD-CVS/src/usr.sbin/pkg_install/add/perform.c,v
retrieving revision 1.106
diff -u -p -r1.106 perform.c
--- perform.c	4 Feb 2005 09:03:02 -0000	1.106
+++ perform.c	13 Mar 2005 10:08:46 -0000
@@ -936,9 +936,10 @@ ignore_replace_depends_check:
 		}

 		fexec_skipempty(BINDIR "/pkg_view", "-d", dbdir,
-				View ? "-w " : "", View ? View : "",
-				Viewbase ? "-W " : "", Viewbase ? Viewbase : "",
-				Verbose ? "-v " : "", "add", PkgName, NULL);
+				View ? (View[0] ? "-w" : "--view=") : "",
+				View && View[0] ? View : "",
+				Viewbase ? "-W" : "", Viewbase ? Viewbase : "",
+				Verbose ? "-v" : "", "add", PkgName, NULL);
 	}

 	goto success;

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.