From owner-freebsd-bugs Tue Mar 14 22:40:10 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id B500737B993 for ; Tue, 14 Mar 2000 22:40:02 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id WAA74891; Tue, 14 Mar 2000 22:40:02 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from Astrovan.cstone.net (mailstop.cstone.net [205.197.102.13]) by hub.freebsd.org (Postfix) with ESMTP id 14D1E37B99B for ; Tue, 14 Mar 2000 22:38:30 -0800 (PST) (envelope-from root@cstone.net) Received: from newbie.cho.cstone.net ([209.145.64.15]) by Astrovan.cstone.net (Post.Office MTA v3.5.3 release 223 ID# 0-59789U13500L1350S0V35) with ESMTP id net for ; Wed, 15 Mar 2000 01:33:33 -0500 Received: (from root@localhost) by newbie.cho.cstone.net (8.9.3/8.9.3) id BAA05794; Wed, 15 Mar 2000 01:38:27 -0500 (EST) (envelope-from root@mail.cstone.net) Message-Id: <200003150638.BAA05794@newbie.cho.cstone.net> Date: Wed, 15 Mar 2000 01:38:27 -0500 (EST) From: adrian@ubergeeks.com Reply-To: adrian@ubergeeks.com To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: bin/17386: pkg_create copy_file() use of cp(1) and flags problems Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 17386 >Category: bin >Synopsis: schg flag causes pkg_create cleaup problems >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Mar 14 22:40:02 PST 2000 >Closed-Date: >Last-Modified: >Originator: Adrian Filipi-Martin >Release: FreeBSD 3.4-RELEASE i386 >Organization: Ubergeeks Consulting >Environment: 3.4-RELEASE w/ports from 03/12/00. >Description: If extended file flags are set on the mtree files in /etc/mtree, pkg_create cannot remove its temp files, because of how pkg_create copies the mtree file to /var/tmp. It exec's cp(1) with '-p' which preserves the flags as well as the usual file metadata. Since the only files that are copied in this way are the pkg metadata files, e.g. +COMMENT, +DESCR, etc., it is of no great loss that the timestamps are not preserved in the created pacakge. It is a bother when pkg_create leaves garbage in /var/tmp that may not be easily removed. The preservation of the flags is lost in pkg since tarfiles cannot handle the file flags. FYI, This bug was actually encountered when running "make package" for the gmake port. >How-To-Repeat: # sh # cd /tmp # for i in DESCR COMMENT PLIST FOO; do echo FOO > $i; done # chflags schg /etc/mtree/BSD.local.dist # pkg_create -c COMMENT -d DESCR -f PLIST -p /tmp \ -m /etc/mtree/BSD.local.dist PKG.tgz rm: /var/tmp/instmp.Xk5440/+MTREE_DIRS: Operation not permitted rm: /var/tmp/instmp.Xk5440: Directory not empty pkg_create: couldn't remove temporary dir '/var/tmp/instmp.Xk5440' # ls -lo /var/tmp/instmp.go5393 total 5 -r--r--r-- 1 root wheel schg 4112 Dec 20 00:53 +MTREE_DIRS >Fix: Apply the following patch to usr.sbin/pkg_install/lib/file.c. Note, '-r' was replaced with '-R' per the cp(1) manpage's recommendatons. Since no recurssive copies were actually found in the code, it may be possible to remove '-R' altogether. --- file.c.orig Wed Mar 15 00:50:24 2000 +++ file.c Wed Mar 15 00:57:57 2000 @@ -412,9 +412,9 @@ char cmd[FILENAME_MAX]; if (fname[0] == '/') - snprintf(cmd, FILENAME_MAX, "cp -p -r %s %s", fname, to); + snprintf(cmd, FILENAME_MAX, "cp -R %s %s", fname, to); else - snprintf(cmd, FILENAME_MAX, "cp -p -r %s/%s %s", dir, fname, to); + snprintf(cmd, FILENAME_MAX, "cp -R %s/%s %s", dir, fname, to); if (vsystem(cmd)) { cleanup(0); errx(2, "could not perform '%s'", cmd); >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message