From owner-freebsd-bugs Thu Feb 17 15:30: 6 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 D568937B86C for ; Thu, 17 Feb 2000 15:30:03 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id PAA70724; Thu, 17 Feb 2000 15:30:03 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from scientia.demon.co.uk (scientia.demon.co.uk [212.228.14.13]) by hub.freebsd.org (Postfix) with ESMTP id A56A137B871 for ; Thu, 17 Feb 2000 15:27:11 -0800 (PST) (envelope-from ben@scientia.demon.co.uk) Received: from platinum.scientia.demon.co.uk ([192.168.91.38] ident=exim) by scientia.demon.co.uk with esmtp (Exim 3.12 #1) id 12LYju-000NWn-00 for FreeBSD-gnats-submit@freebsd.org; Thu, 17 Feb 2000 21:45:34 +0000 Received: (from ben) by platinum.scientia.demon.co.uk (Exim 3.12 #7) id 12LYju-000Cwk-00 for FreeBSD-gnats-submit@freebsd.org; Thu, 17 Feb 2000 21:45:34 +0000 Message-Id: Date: Thu, 17 Feb 2000 21:45:34 +0000 From: Ben Smithurst Reply-To: ben@scientia.demon.co.uk To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: bin/16795: pkg_add (maybe other pkg_*) fails when /var is symlink Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 16795 >Category: bin >Synopsis: pkg_add (maybe other pkg_*) fails when /var is symlink >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: Thu Feb 17 15:30:02 PST 2000 >Closed-Date: >Last-Modified: >Originator: Ben Smithurst >Release: FreeBSD 4.0-CURRENT i386 >Organization: >Environment: >Description: If /var is a symlink (e.g., to /usr/var to keep /var off the root partition when there are just / and /usr partitions), pkg_add will fail to record data into /var/db/pkg. This is because isdir(), called by make_hierarchy() uses lstat() to determine if a path is a directory without checking if it is a symlink or not. >How-To-Repeat: mv /var /var.old && ln -s /var.old /var pkg_add (I'm not guaranteeing this will show the failure, but it certainly fails in my case (it should), and doing this is probably easier for people to check than moving all of /var to another filesystem.) >Fix: (apply in src/usr.sbin/pkg_install/lib, sorry about this not being a proper "cvs diff" type thing.) --- file.c.orig Thu Feb 17 21:36:42 2000 +++ file.c Thu Feb 17 21:39:12 2000 @@ -47,7 +47,7 @@ { struct stat sb; - if (lstat(fname, &sb) != FAIL && S_ISDIR(sb.st_mode)) + if (stat(fname, &sb) != FAIL && S_ISDIR(sb.st_mode)) return TRUE; else return FALSE; this may have other effects somewhere else, though it shouldn't (why should anything in pkg_* care if something is a directory as opposed to a symlink to one?). >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message