bin/54446: pkg_delete doesn't honour symlinks, portupgrades leads to failing services (i.e. squid)

Andreas Klemm andreas at
Sun Jul 13 10:00:35 PDT 2003

>Number:         54446
>Category:       bin
>Synopsis:       pkg_delete doesn't honour symlinks, portupgrades leads to failing services (i.e. squid)
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jul 13 10:00:32 PDT 2003
>Originator:     Andreas Klemm
>Release:        FreeBSD-current
System: FreeBSD 5.1-CURRENT FreeBSD 5.1-CURRENT #0: Sat Jul 12 16:46:09 CEST 2003 root at i386

FreeBSD 5.2-current and all other FreeBSD releases

Always happended to me when upgrading squid on a machine, since
I always use symlinks to move the cache to a larger directory than
/usr/local ...


Upgrade of squid port brings squid into non operational state,
if the toplevel of the data directory (/usr/local/squid) is a symlink
(to /var/squid for example) and not a real directory.

I assume the reason is, that pkg_delete doesn't honor symlinks.

The toplevel directory of squid data and logs (/usr/local/squid)
would normally not being removed by pkg_delete, if there are additional
files under /usr/local/squid/{cache, logs}. This is the case, if you
use squid for a while and then upgrade the port.

But if its a symlink then /usr/local/sqzid will be deleted and
the upgrade of the port installs the usual fresh/empty /usr/local/squid
data directory ...

The result is a dying squid that doesn't find its data directory.

This behaviour should be changed in pkg_delete to make upgrade of
ports more smoothly / reliable, if part of a large tree had to be moved

Since this could also be a subtree somewhere under /usr/local/squid,
pkg_delete should alway check, if file is a symlink and follow.


	install squid from ports
	mv /usr/local/squid /var/squid
	ln -s /var/squid /usr/local/squid
	squid -z
	Then remove and reinstall the squid port or
	portupgrade -af
	All squid ports of today and in the past have the negativ side
	effect, that the symlink /usr/local/squid to the real data
	directory /var/squid simply gets removed.


	no fix available at this time.

	I assume, that the pkg_delete is the culprit, it doesn't know about
	symlinks ....

More information about the freebsd-bugs mailing list