Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 Oct 1997 17:44:44 +0000
From:      aecolley@ois.ie
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   bin/4894: pkg_delete ignores @cwd because pkg_create removes it
Message-ID:  <E0xQyeC-0000Wn-00@faust.ois.ie>
Resent-Message-ID: <199710301750.JAA25940@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         4894
>Category:       bin
>Synopsis:       pkg_delete ignores @cwd because pkg_create removes it
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Oct 30 09:50:00 PST 1997
>Last-Modified:
>Originator:     Adrian Colley
>Organization:
Office Integrated Solutions
>Release:        FreeBSD 2.2.5-STABLE i386
>Environment:

	Last update via CTM to src-2.2.0486.
	RCS ID in usr.sbin/pkg_install/create/perform.c is:
	  Id: perform.c,v 1.32.2.4 1997/10/13 15:06:11 jkh Exp

>Description:

	When a port's pkg/PLIST contains an @cwd line followed by an @unexec
	line which includes %D, it is expected that %D will be replaced by
	the current directory name set by @cwd.

	However, when pkg_create is used to make PLIST into
	/var/db/pkg/(package)/+CONTENTS, the @cwds are stripped and replaced
	with a single @cwd $PREFIX.

	Consequently, if the package is later removed with pkg_delete, @unexec
	commands in +CONTENTS may fail because %D is replaced with the wrong
	value, or because the command is sensitive to its working directory.

>How-To-Repeat:

	Install comms/mgetty+sendfax from the ports collection (install with
	make -DBATCH install to avoid the questionnaire).  Then pkg_delete
	mgetty-1.0.0.  The pkg_delete will complain about /usr/local/fax being
	nonexistent.

	The pkg/PLIST of mgetty+sendfax includes the lines:
	@cd /var/spool
	@exec mkdir -p %D/fax/incoming
	@exec mkdir -p %D/fax/outgoing
	@exec chmod -R 775 %D/fax
	@unexec rm -r %D/fax

	After make install, /var/db/pkg/mgetty-1.0.0/+CONTENTS can be seen to have
	lost the @cd, which causes the @unexec to expand as "rm -r /usr/local/fax"
	instead of "rm -r /var/spool/fax"

>Fix:
	
	/usr/src/usr.sbin/pkg_install/create/perform.c, lines 99-103 contain the
	perpetrating code:

	/* Prefix should override the packing list */
	if (Prefix) {
	    delete_plist(&plist, FALSE, PLIST_CWD, NULL);
	    add_plist_top(&plist, PLIST_CWD, Prefix);
	}

	Perhaps there's a reason for the delete_plist call here, but I can't think
	what it is.  If the packing list contains @cwds which should be removed,
	then they should be removed from the actual packing lists.  If a packing
	list has a good reason to use @cwd, this should be respected.

>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E0xQyeC-0000Wn-00>