From owner-freebsd-bugs Thu Oct 30 09:50:04 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id JAA25949 for bugs-outgoing; Thu, 30 Oct 1997 09:50:04 -0800 (PST) (envelope-from owner-freebsd-bugs) Received: (from gnats@localhost) by hub.freebsd.org (8.8.7/8.8.7) id JAA25940; Thu, 30 Oct 1997 09:50:02 -0800 (PST) (envelope-from gnats) Resent-Date: Thu, 30 Oct 1997 09:50:02 -0800 (PST) Resent-Message-Id: <199710301750.JAA25940@hub.freebsd.org> Resent-From: gnats (GNATS Management) Resent-To: freebsd-bugs Resent-Reply-To: FreeBSD-gnats@FreeBSD.ORG, aecolley@ois.ie Received: from ios.internet-ireland.ie (ios.internet-ireland.ie [195.17.130.2]) by hub.freebsd.org (8.8.7/8.8.7) with SMTP id JAA25359 for ; Thu, 30 Oct 1997 09:45:23 -0800 (PST) (envelope-from aecolley@ois.ie) Received: from gate.ois.ie (oisgw.ois.ie [195.17.130.66]) by ios.internet-ireland.ie (8.6.12/8.6.12) with ESMTP id RAA03484 for ; Thu, 30 Oct 1997 17:45:06 GMT Received: from faust.ois.ie (faust.ois.ie [192.168.0.254]) by gate.ois.ie (8.8.7/8.6.12) with SMTP id RAA27667 for ; Thu, 30 Oct 1997 17:44:44 GMT Received: from aecolley by faust.ois.ie with local (Exim 1.70 #1) id 0xQyeC-0000Wn-00; Thu, 30 Oct 1997 17:44:44 +0000 Message-Id: Date: Thu, 30 Oct 1997 17:44:44 +0000 From: aecolley@ois.ie Reply-To: aecolley@ois.ie To: FreeBSD-gnats-submit@FreeBSD.ORG X-Send-Pr-Version: 3.2 Subject: bin/4894: pkg_delete ignores @cwd because pkg_create removes it Sender: owner-freebsd-bugs@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk >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: