Date: Thu, 17 Feb 2000 21:45:34 +0000 From: Ben Smithurst <ben@scientia.demon.co.uk> To: FreeBSD-gnats-submit@freebsd.org Subject: bin/16795: pkg_add (maybe other pkg_*) fails when /var is symlink Message-ID: <E12LYju-000Cwk-00@platinum.scientia.demon.co.uk>
next in thread | raw e-mail | index | archive | help
>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 <something> (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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E12LYju-000Cwk-00>