| Summary: | pkg_add (maybe other pkg_*) fails when /var is symlink | ||
|---|---|---|---|
| Product: | Base System | Reporter: | Ben Smithurst <ben> |
| Component: | bin | Assignee: | freebsd-bugs (Nobody) <bugs> |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | ||
| Priority: | Normal | ||
| Version: | 4.0-CURRENT | ||
| Hardware: | Any | ||
| OS: | Any | ||
State Changed From-To: open->closed Already fixed |
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. Fix: (apply in src/usr.sbin/pkg_install/lib, sorry about this not being a proper "cvs diff" type thing.) 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?).--A4cZFm30JhoTSuSQqwsgOltYFtTy3AYuwgjtYCEzPVM1KhmN Content-Type: text/plain; name="file.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="file.diff" --- 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; 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.)