NetBSD Problem Report #45513
From www@NetBSD.org Sun Oct 23 10:13:10 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 BB33263D54F
for <gnats-bugs@gnats.NetBSD.org>; Sun, 23 Oct 2011 10:13:09 +0000 (UTC)
Message-Id: <20111023101308.7199B63D49B@www.NetBSD.org>
Date: Sun, 23 Oct 2011 10:13:08 +0000 (UTC)
From: netbsd@marino.st
Reply-To: netbsd@marino.st
To: gnats-bugs@NetBSD.org
Subject: pkgsrc DEINSTALL file doesn't have ${VARBASE} and other variables defined
X-Send-Pr-Version: www-1.0
>Number: 45513
>Category: pkg
>Synopsis: pkgsrc DEINSTALL file doesn't have ${VARBASE} and other variables defined
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: pkg-manager
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Oct 23 10:15:00 +0000 2011
>Closed-Date: Sun Oct 30 22:07:41 +0000 2011
>Last-Modified: Sun Oct 30 22:10:02 +0000 2011
>Originator: John Marino
>Release:
>Organization:
>Environment:
>Description:
If a package has a DEINSTALL script that deletes a file from ${VARBASE} (normally /var), you must use "/var" instead of ${VARBASE} because the latter is not expanded.
I assume this is not the intended behavior, otherwise the DEINSTALL script would fail when the $VARBASE is defined as something other than the standard /var.
The same effect is seen if ${PKG_DBDIR} is used as well, so the issue is not limited to $VARBASE.
>How-To-Repeat:
create a dummy file at /var/db/pkg/test.db (assumes $VARBASE = /var). Add the following DEINSTALL file for any package (I used biology/sewer) for testing purposes:
================================
# $NetBSD$
#
case ${STAGE} in
DEINSTALL)
${RM} ${VARBASE}/db/pkg/test.db
;;
esac
==============================
> bmake install clean
> pkg_delete name-of-testpackage-\*
confirm that pkg_delete emits an error when file "/db/pkg/test.db" isn't found.
repeat the process using this DEINSTALL file:
================================
# $NetBSD$
#
case ${STAGE} in
DEINSTALL)
${RM} /var/db/pkg/test.db
;;
esac
==============================
confirm that pkg_delete successfully removes all files, including /var/db/pkg/test.db
>Fix:
>Release-Note:
>Audit-Trail:
From: "OBATA Akio" <obache@netbsd.org>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: pkg/45513: pkgsrc DEINSTALL file doesn't have ${VARBASE} and
other variables defined
Date: Sun, 23 Oct 2011 19:46:42 +0900
On Sun, 23 Oct 2011 19:15:00 +0900, <netbsd@marino.st> wrote:
> If a package has a DEINSTALL script that deletes a file from ${VARBASE} (normally /var), you must use "/var" instead of ${VARBASE} because the latter is not expanded.
@VARBASE@ should be used in DEINSTALL script instead of neither ${VARBASE} nor /var.
It will be expanded at creating the package.
--
OBATA Akio / obache@NetBSD.org
From: John Marino <netbsd@marino.st>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: pkg/45513: pkgsrc DEINSTALL file doesn't have ${VARBASE} and
other variables defined
Date: Sun, 23 Oct 2011 13:52:04 +0200
On 10/23/2011 12:50 PM, OBATA Akio wrote:
> The following reply was made to PR pkg/45513; it has been noted by GNATS.
>
> From: "OBATA Akio"<obache@netbsd.org>
> To: gnats-bugs@netbsd.org
> Cc:
> Subject: Re: pkg/45513: pkgsrc DEINSTALL file doesn't have ${VARBASE} and
> other variables defined
> Date: Sun, 23 Oct 2011 19:46:42 +0900
>
> On Sun, 23 Oct 2011 19:15:00 +0900,<netbsd@marino.st> wrote:
>
> > If a package has a DEINSTALL script that deletes a file from ${VARBASE} (normally /var), you must use "/var" instead of ${VARBASE} because the latter is not expanded.
>
> @VARBASE@ should be used in DEINSTALL script instead of neither ${VARBASE} nor /var.
> It will be expanded at creating the package.
>
> --
> OBATA Akio / obache@NetBSD.org
>
Hi OBATA,
Thanks, I obviously didn't know it uses another expansion format.
Is that documented anywhere, say the pkgsrc guide, and I just missed it?
I'm not sure how I was supposed to know or guess @VARBASE@ is the
current form.
John
From: "OBATA Akio" <obache@netbsd.org>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: pkg/45513: pkgsrc DEINSTALL file doesn't have ${VARBASE} and
other variables defined
Date: Sun, 23 Oct 2011 21:20:53 +0900
On Sun, 23 Oct 2011 20:55:01 +0900, John Marino <netbsd@marino.st> wrote:
> Is that documented anywhere, say the pkgsrc guide, and I just missed it?
> I'm not sure how I was supposed to know or guess @VARBASE@ is the
> current form.
I cannot find it in the guide, but INSTALL/DEINSTALL script will be handled
same as System startup scripts, described in 15.3.
See "make help topic=FILES_SUBST".
--
OBATA Akio / obache@NetBSD.org
From: John Marino <netbsd@marino.st>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: pkg/45513: pkgsrc DEINSTALL file doesn't have ${VARBASE} and
other variables defined
Date: Mon, 24 Oct 2011 11:05:30 +0200
On 10/23/2011 2:25 PM, OBATA Akio wrote:>
> I cannot find it in the guide, but INSTALL/DEINSTALL script will be handled
> same as System startup scripts, described in 15.3.
>
> See "make help topic=FILES_SUBST".
Thanks!
I would prefer that this be documented in the pkgsrc guide, so this PR
should be forwarded to those that maintain the guide.
If people disagree with this preference, then go ahead and close the
ticket as the problem described has an acceptable solution.
John
From: David Holland <dholland-pbugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: pkg/45513: pkgsrc DEINSTALL file doesn't have ${VARBASE} and
other variables defined
Date: Tue, 25 Oct 2011 10:09:28 +0000
On Mon, Oct 24, 2011 at 09:10:05AM +0000, John Marino wrote:
>> I cannot find it in the guide, but INSTALL/DEINSTALL script will be handled
>> same as System startup scripts, described in 15.3.
>>
>> See "make help topic=FILES_SUBST".
>
> Thanks!
> I would prefer that this be documented in the pkgsrc guide, so this PR
> should be forwarded to those that maintain the guide.
Care to suggest where in the guide?
--
David A. Holland
dholland@netbsd.org
From: John Marino <netbsd@marino.st>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: pkg/45513: pkgsrc DEINSTALL file doesn't have ${VARBASE} and
other variables defined
Date: Tue, 25 Oct 2011 15:53:09 +0200
On 10/25/2011 12:10 PM, David Holland wrote:
> The following reply was made to PR pkg/45513; it has been noted by GNATS.
>
> Care to suggest where in the guide?
>
> --
> David A. Holland
> dholland@netbsd.org
>
I suggest section 11.5 OPTIONAL FILES
http://www.netbsd.org/docs/pkgsrc/components.html#components.optional
Under the DEINSTALL heading.
It's the only place this file is mentioned as far as I know although
section 15.1 is tangential to it.
John
State-Changed-From-To: open->closed
State-Changed-By: wiz@NetBSD.org
State-Changed-When: Sun, 30 Oct 2011 22:07:41 +0000
State-Changed-Why:
Described @FOO@ for INSTALL/DEINSTALL in the guide.
Thanks for the suggestion!
From: "Thomas Klausner" <wiz@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/45513 CVS commit: pkgsrc/doc/guide/files
Date: Sun, 30 Oct 2011 22:07:19 +0000
Module Name: pkgsrc
Committed By: wiz
Date: Sun Oct 30 22:07:19 UTC 2011
Modified Files:
pkgsrc/doc/guide/files: components.xml
Log Message:
Describe @FOO@ replacement in INSTALL/DEINSTALL. Addresses PR 45513 by John Marino.
To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 pkgsrc/doc/guide/files/components.xml
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
>Unformatted:
(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.