NetBSD Problem Report #45078
From www@NetBSD.org Fri Jun 17 14:42:14 2011
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
by www.NetBSD.org (Postfix) with ESMTP id 4CD5963C6C2
for <gnats-bugs@gnats.NetBSD.org>; Fri, 17 Jun 2011 14:42:14 +0000 (UTC)
Message-Id: <20110617144213.6E05E63C1C3@www.NetBSD.org>
Date: Fri, 17 Jun 2011 14:42:13 +0000 (UTC)
From: tcort@minix3.org
Reply-To: tcort@minix3.org
To: gnats-bugs@NetBSD.org
Subject: pkgtools/pkg_install expand %D to destdir/pkgsrc_root
X-Send-Pr-Version: www-1.0
>Number: 45078
>Category: pkg
>Synopsis: pkgtools/pkg_install expand %D to destdir/pkgsrc_root
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: pkg-manager
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Jun 17 14:45:00 +0000 2011
>Closed-Date: Tue Jun 21 18:23:50 +0000 2011
>Last-Modified: Tue Jun 21 18:23:50 +0000 2011
>Originator: Thomas Cort
>Release: N/A
>Organization:
Minix3
>Environment:
Minix 192.168.122.210 3.2.0 i686
>Description:
PLIST files can have commands to be executed using the @exec directive.
Pkgin for instance uses "@exec ${MKDIR} %D/etc/pkgin". The %D is supposed
to be expanded to pkgsrc root. Earlier pkg_add would ignore the destdir
when expanding the %D. This changes pkg_add to expand %D to
destdir/pkgsrc_root.
This patch was moved from pkg/45047 so that the PR would
only deal with one problem.
>How-To-Repeat:
>Fix:
--- a/pkg_install/files/lib/plist.c Thu Jun 16 19:34:17 2011
+++ b/pkg_install/files/lib/plist.c Thu Jun 16 19:39:51 2011
@@ -514,6 +514,7 @@
int fail = SUCCESS;
Boolean preserve;
char tmp[MaxPathSize];
+ char cmd[MaxPathSize];
const char *prefix = NULL, *name = NULL;
if (!pkgdb_open(ReadWrite)) {
@@ -580,10 +581,12 @@
case PLIST_UNEXEC:
if (NoDeleteFiles)
break;
- format_cmd(tmp, sizeof(tmp), p->name, prefix, last_file);
- printf("Executing `%s'\n", tmp);
- if (!Fake && system(tmp)) {
- warnx("unexec command for `%s' failed", tmp);
+ (void) snprintf(tmp, sizeof(tmp), "%s%s%s",
+ destdir ? destdir : "", destdir ? "/" : "", prefix);
+ format_cmd(cmd, sizeof(cmd), p->name, tmp, last_file);
+ printf("Executing `%s'\n", cmd);
+ if (!Fake && system(cmd)) {
+ warnx("unexec command for `%s' failed", cmd);
fail = FAIL;
}
break;
>Release-Note:
>Audit-Trail:
From: Joerg Sonnenberger <joerg@britannica.bec.de>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: pkg/45078: pkgtools/pkg_install expand %D to destdir/pkgsrc_root
Date: Fri, 17 Jun 2011 19:08:28 +0200
On Fri, Jun 17, 2011 at 02:45:01PM +0000, tcort@minix3.org wrote:
> PLIST files can have commands to be executed using the @exec directive.
> Pkgin for instance uses "@exec ${MKDIR} %D/etc/pkgin". The %D is supposed
> to be expanded to pkgsrc root. Earlier pkg_add would ignore the destdir
> when expanding the %D. This changes pkg_add to expand %D to
> destdir/pkgsrc_root.
>
> This patch was moved from pkg/45047 so that the PR would
> only deal with one problem.
I don't think this actually helps. Most PLISTs that still use @exec are
certainly not ready for DESTDIR and +INSTALL/+DEINSTALL already get it
via environment. As such, the packages should be fixed to not use
@exec/@unexec. The case of pkgin is clear abuse, since MAKE_DIRS exists
for exactly this purpose. The above only works by chance since mkdir
exists outside the chroot as well.
Joerg
From: Thomas Cort <tcort@minix3.org>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: pkg/45078: pkgtools/pkg_install expand %D to
destdir/pkgsrc_root
Date: Mon, 20 Jun 2011 10:30:46 -0400
> > This changes pkg_add to expand %D to destdir/pkgsrc_root.
>
> Most PLISTs that still use @exec are certainly not ready for DESTDIR
> and +INSTALL/+DEINSTALL already get it via environment. As such,
> the packages should be fixed to not use @exec/@unexec.
Could you explain this a little more. Aren't there some instances where
the above patch would be useful?
> the packages should be fixed to not use @exec/@unexec
I created a problem report to fix pkgtools/pkgin so that it uses MAKE_DIRS.
The PR is pkgsrc/45085 and it contains a patch.
From: Joerg Sonnenberger <joerg@britannica.bec.de>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: pkg/45078: pkgtools/pkg_install expand %D to destdir/pkgsrc_root
Date: Mon, 20 Jun 2011 16:44:05 +0200
On Mon, Jun 20, 2011 at 02:35:01PM +0000, Thomas Cort wrote:
> > > This changes pkg_add to expand %D to destdir/pkgsrc_root.
> >
> > Most PLISTs that still use @exec are certainly not ready for DESTDIR
> > and +INSTALL/+DEINSTALL already get it via environment. As such,
> > the packages should be fixed to not use @exec/@unexec.
>
> Could you explain this a little more. Aren't there some instances where
> the above patch would be useful?
It only works if the called binary exists outside the DESTDIR and
doesn't change anything at an absolute path (e.g. in VARBASE). That
limits the usefulness a lot.
Joerg
From: Thomas Cort <tcort@minix3.org>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: pkg/45078: pkgtools/pkg_install expand %D to
destdir/pkgsrc_root
Date: Tue, 21 Jun 2011 07:40:47 -0400
> That limits the usefulness a lot.
The patch was only needed for pkgtools/pkgin during Minix release
building. Since pkgin was fixed via pkgsrc/45085, this patch is no
longer needed for us. Feel free to close this PR.
State-Changed-From-To: open->closed
State-Changed-By: wiz@NetBSD.org
State-Changed-When: Tue, 21 Jun 2011 18:23:50 +0000
State-Changed-Why:
Not needed any longer. Thanks for the update!
>Unformatted:
(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.