NetBSD Problem Report #29749

From kre@delta.noi.kre.to  Sun Mar 20 21:00:35 2005
Return-Path: <kre@delta.noi.kre.to>
Received: from fuchsia.home (unknown [202.12.74.196])
	by narn.netbsd.org (Postfix) with ESMTP id EFCF963B116
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 20 Mar 2005 21:00:32 +0000 (UTC)
Message-Id: <200503202058.j2KKw0qw004084@delta.noi.kre.to>
Date: Mon, 21 Mar 2005 03:58:00 +0700 (ICT)
From: kre@munnari.OZ.AU
To: gnats-bugs@netbsd.org
Subject: minor pkg_comp enhancement
X-Send-Pr-Version: 3.95

>Number:         29749
>Category:       pkg
>Synopsis:       minor pkg_comp enhancement
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    jmmv
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun Mar 20 21:01:00 +0000 2005
>Closed-Date:    Mon Jun 06 18:51:23 +0000 2005
>Last-Modified:  Mon Jun 06 18:56:01 +0000 2005
>Originator:     Robert Elz
>Release:        NetBSD 2.0.1   (pkgsrc reasonably current)
>Organization:
	Prince of Songkla University
>Environment:
System: NetBSD delta.noi.kre.to 2.0.1 NetBSD 2.0.1 (DELTA-1.11-20050129) #1: Sat Jan 29 15:31:14 ICT 2005 kre@lilac.noi.kre.to:/usr/obj/2.0/kernels/DELTA i386
Architecture: i386
Machine: i386
>Description:
	I find myself doing
		pkg_comp chroot pkg_delete xxx
	or
		pkg_comp chroot pkg_chk ...
	or
		(various similar, pkg_add, ...)
	fairly frequently for one reason or other.

	I know I could do

		pkg_comp chroot

	and leave a shell i the chroot, at which to type
	commands (pkg_delete, ...) but for various reasons that
	isn't always convenient.

	The "chroot" word in the above commands is essentially
	useless, not doing that would be not using pkg_comp at all.

	So, I thoughit I'd see how hard it would be to make the
	chroot optional, when the next command is a pkg_* type
	command (it could be made optional for all unrecognised
	following commands, but that makes it less effective at
	catching common typos, so I thought that may be a bit too far)
>How-To-Repeat:
	Use pkg_comp a lot, get frustrated by keepig forgetting to
	type "chroot" in svery 2nd or third command...
>Fix:
	The patch below adds the functionality I desired.
	The change is trivial.

	There's also a (probably lame) addition to the man page.
	Someone who understands mdoc should check that, I have no
	idea what I'm doing in that macro package.

	And, for good measure, I also corrected a minor typo in the
	man page that I happened to notice while checking.

Index: pkg_comp.8
===================================================================
RCS file: /cvsroot/NetBSD/pkgsrc/pkgtools/pkg_comp/files/pkg_comp.8,v
retrieving revision 1.23
diff -u -r1.23 pkg_comp.8
--- pkg_comp.8	29 Dec 2004 22:16:22 -0000	1.23
+++ pkg_comp.8	20 Mar 2005 20:35:26 -0000
@@ -445,6 +445,11 @@
 If no arguments are given,
 .Va ROOTSHELL
 is executed, otherwise whatever you typed.
+If the arguments begin with a word that begins
+.Li pkg_
+then the
+.Ql chroot
+argument can be omitted (it is implied).
 .It removeroot
 Remove the entire chroot tree.
 You should do it with this target because it
@@ -464,7 +469,7 @@
 .Sy AUTO_PACKAGES
 or pass package names through the command line.
 .Pp
-If the magic work
+If the magic word
 .Ql resume
 is passed as the unique argument to this target,
 .Nm
Index: pkg_comp.sh
===================================================================
RCS file: /cvsroot/NetBSD/pkgsrc/pkgtools/pkg_comp/files/pkg_comp.sh,v
retrieving revision 1.22
diff -u -r1.22 pkg_comp.sh
--- pkg_comp.sh	12 Dec 2004 01:04:27 -0000	1.22
+++ pkg_comp.sh	20 Mar 2005 20:27:22 -0000
@@ -886,8 +886,10 @@
     conffile="$confdir/default.conf"
 fi

-target="$1"
-shift
+case "$1" in
+pkg_*)		target=chroot;;
+*)		target="$1"; shift;;
+esac
 args="$*"

 # readconf

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: pkg-manager->jmmv
Responsible-Changed-By: jmmv@netbsd.org
Responsible-Changed-When: Sun, 20 Mar 2005 22:03:31 +0000
Responsible-Changed-Why:
My call.


State-Changed-From-To: open->closed
State-Changed-By: jmmv@netbsd.org
State-Changed-When: Mon, 06 Jun 2005 18:51:23 +0000
State-Changed-Why:
Feature implemented; thanks.  (Note that I changed the code style of your
patch.)


From: "Julio M. Merino Vidal" <jmmv@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: PR/29749 CVS commit: pkgsrc/pkgtools/pkg_comp
Date: Mon,  6 Jun 2005 18:50:07 +0000 (UTC)

 Module Name:	pkgsrc
 Committed By:	jmmv
 Date:		Mon Jun  6 18:50:07 UTC 2005

 Modified Files:
 	pkgsrc/pkgtools/pkg_comp: Makefile
 	pkgsrc/pkgtools/pkg_comp/files: pkg_comp.8 pkg_comp.sh

 Log Message:
 Update to 1.21:
 - Make the EXTRA_MK variable be a list of files rather a single one.
   From brook at biology.nmsu.edu in PR pkg/30099.
 - Directly recognize pkg_* commands to be executed within the sandbox
   (i.e., no need to use the chroot keyword).
   From Robert Elz in PR pkg/29749.
 - Fix a typo in the manual page.


 To generate a diff of this commit:
 cvs rdiff -r1.28 -r1.29 pkgsrc/pkgtools/pkg_comp/Makefile
 cvs rdiff -r1.24 -r1.25 pkgsrc/pkgtools/pkg_comp/files/pkg_comp.8
 cvs rdiff -r1.22 -r1.23 pkgsrc/pkgtools/pkg_comp/files/pkg_comp.sh

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.