From owner-freebsd-bugs@FreeBSD.ORG Tue Feb 13 13:30:08 2007 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 159A416A402 for ; Tue, 13 Feb 2007 13:30:08 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [69.147.83.40]) by mx1.freebsd.org (Postfix) with ESMTP id EABCA13C4AC for ; Tue, 13 Feb 2007 13:30:07 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id l1DDU7ZQ019226 for ; Tue, 13 Feb 2007 13:30:07 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id l1DDU7Pb019223; Tue, 13 Feb 2007 13:30:07 GMT (envelope-from gnats) Resent-Date: Tue, 13 Feb 2007 13:30:07 GMT Resent-Message-Id: <200702131330.l1DDU7Pb019223@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Constantin Stefanov Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 97DA716A511 for ; Tue, 13 Feb 2007 13:21:12 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [69.147.83.33]) by mx1.freebsd.org (Postfix) with ESMTP id 49BAD13C4B6 for ; Tue, 13 Feb 2007 13:21:12 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.13.1/8.13.1) with ESMTP id l1DDLB71021168 for ; Tue, 13 Feb 2007 13:21:11 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.13.1/8.13.1/Submit) id l1DDLBG7021167; Tue, 13 Feb 2007 13:21:11 GMT (envelope-from nobody) Message-Id: <200702131321.l1DDLBG7021167@www.freebsd.org> Date: Tue, 13 Feb 2007 13:21:11 GMT From: Constantin Stefanov To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.0 Cc: Subject: bin/109134: [patch] pkg_add replaces symlink in path to installed file for ordinary directory X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Feb 2007 13:30:08 -0000 >Number: 109134 >Category: bin >Synopsis: [patch] pkg_add replaces symlink in path to installed file for ordinary directory >Confidential: no >Severity: serious >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Feb 13 13:30:07 GMT 2007 >Closed-Date: >Last-Modified: >Originator: Constantin Stefanov >Release: FreeBSD 6.1-RELEASE-p3 >Organization: SRCC MSU >Environment: FreeBSD stat.srcc.msu.ru 6.1-RELEASE-p3 FreeBSD 6.1-RELEASE-p3 #2: Wed Jul 26 14:29:50 MSD 2006 coctic@stat.srcc.msu.ru:/opt/obj/opt/src/sys/STAT i386 >Description: I have /usr/local symlinked to /opt/local (created with mkdir -p /opt/local; cd /usr; rmdir local; ln -s ../opt/local local). I have some other parts of file hierarchy symlinked into /opt which is a separate filesystem. When I try to install DrWeb Enterprise Suite package (got on ftp://ftp.drweb.com/pub/drweb/esuite/drweb-es-433-1-200609270-unix-freebsd6.1-i386.tbz link), it fails. After failing I see that /usr/local is not a symlink any more, but is a real directory. In my case installation failed because the package depends on some software installed in my symlinked /usr/local, and it disappeared during installation. As I can understand, this package has "@cwd /" in +CONTENTS file, and some usr/local/... files after that @cwd. And tar that is invoked from pkg_add deletes all symlinks in path where it installs files to and changes it for ordinary directories. Packages from FreeBSD collection are not affected by the issue because they (at least all I looked into) have "@cwd /usr/local" in +CONTENTS. And I did not find any guidelines why it is not correct to have "@cwd /" in package and to install files in /usr/local with it. >How-To-Repeat: Get fresh FreeBSD 6.1-RELEASE (I also checked 6.2-RELEASE, it has the same issue). mkdir /opt mkdir /opt/local cd /usr rmdir local ln -s ../opt/local local Install latest iconv (it is a dependency which is not registered in the package). Run pkg_add ftp://ftp.drweb.com/pub/drweb/esuite/drweb-es-433-1-200609270-unix-freebsd6.1-i386.tbz Press Enter three times, then accept license agreement. When user selection table is shown, run ls -l /usr in another console. You'll see that /usr/local is not a symlink now, but is an ordinary directory. >Fix: My fix was to add -P switch to tar which is invoked from pkg_add when putting package files into place (see attached patch). After the fix the package did install. Patch attached with submission follows: --- src/usr.sbin/pkg_install/add/extract.c.orig Mon Feb 12 14:47:06 2007 +++ src/usr.sbin/pkg_install/add/extract.c Mon Feb 12 14:47:15 2007 @@ -34,7 +34,7 @@ #define PUSHOUT(todir) /* push out string */ \ if (where_count > (int)sizeof(STARTSTRING)-1) { \ - strcat(where_args, "|/usr/bin/tar --unlink -xpf - -C "); \ + strcat(where_args, "|/usr/bin/tar --unlink -xpPf - -C "); \ strcat(where_args, todir); \ if (system(where_args)) { \ cleanup(0); \ >Release-Note: >Audit-Trail: >Unformatted: