[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Removing conffiles AND directories in /etc



On Sun, 26 Oct 2014, Santiago Vila wrote:
> > So, dpkg-maintscripthelper seems to do "Removing obsolete conffile"
> > after dpkg tries to delete old directories, so dpkg fails.
> > 
> > I'd be surprised if I were the first to encounter this problem: what is
> > the appropriate and clean way to get rid of *all* conffiles for a
> > package, including the directory that contains them?
> 
> I have never used dpkg-maintscripthelper myself, but the documentation
> suggests that dpkg-maintscripthelper is not able to do that (the
> directory part) yet:
> 
>   Current implementation: in the preinst, it checks if the conffile was modified and renames it either to
>   conffile.dpkg-remove  (if  not modified) or to conffile.dpkg-backup (if modified). In the postinst, the
>   latter file is renamed to conffile.dpkg-bak and kept for reference as it  contains  user  modifications
>   but the former will be removed. If the package upgrade aborts, the postrm reinstalls the original conf‐
>   file. During purge, the postrm will also delete the .dpkg-bak file kept up to now.
> 
> I would report this as a dpkg bug.

It is actually trivial to work around this in maintainer scripts, as "rmdir
/etc/foo/bar/ >/dev/null 2>&1 || true"  is always a safe operation...

...*provided* that we actually never issue it on a directory that should
never be deleted when empty!

So, while it is indeed something we could (and should) fix in
dpkg-maintscripthelper if at all possible, we should first map any possible
exceptions (directories that should not be removed when empty) in order to
fully understand the problem.

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh


Reply to: