2

In Debian Jessie's /etc/cron.d/ there's a file called .placeholder, the contents of which claim:

# DO NOT EDIT OR REMOVE
# This file is a simple placeholder to keep dpkg from removing this directory

Now, .placeholder files are mentioned various places, but under what conditions would one be necessary? When would dpkg decide to delete an empty directory under /etc?

3

This is probably left over from historical behaviour in dpkg. Nowadays removal is handled in remove.c, and directories are removed only if they are empty and the current package (being removed) is the only one using them (this is determined in help.c, in dir_is_used_by_others() and dir_is_used_by_pkg()).

Looking at the cron package reveals the placeholders were introduced in 2004 as a remedy to bug #217760; it's possible that at the time, dpkg didn't check things as thoroughly as it does now, in such a way that if removing a package caused a directory to become empty, that directory would be deleted as well. So cron would install /etc/cron.d, but no file inside that directory; then another package would drop a file there, and removing that package would delete the file and also the directory (since it then became empty). This broke cron, so to avoid the bug a placeholder was added.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.