automake
[Top][All Lists]
Advanced

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

Re: FEATURE REQUEST: make uninstall should delete empty directories.


From: Hans Deragon
Subject: Re: FEATURE REQUEST: make uninstall should delete empty directories.
Date: Wed, 03 Mar 2004 09:18:49 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040116

Eric Siegerman wrote:
On Tue, Mar 02, 2004 at 08:34:19AM -0600, Bob Friesenhahn wrote:

If a package supports creating the directory /usr/local (as Automake
does by default) should this directory be recursively removed if a
package is uninstalled?


Absolutely not!  (I rather suspect the question was rhetorical,
but I'm answering it anyway :-)

One should only remove an empty directory if it is in some sense
"owned" by the package in question:
    /usr/local/libexec/myPackage - yes
    /usr/local/libexec - no, no, no!

That's the ideal anyway.

The problem is, I doubt that Automake has enough information to
know which directories the package "owns", and which directories
it only "borrows". [1]  So the question is, which is the worse
deviation from the ideal: to delete directories that the package
doesn't own, or to fail to delete ones that it does own?  IMO,
the former is far worse -- it risks losing important information
(manually adjusted permissions and ownership of the directories
in question), whereas the latter just leaves around harmless
clutter.

I get your point regarding permissions and ownership. But of what use is an empty directory?

Actually, there could be cases where removing empty directories could lead to problems. I have no examples, but dynamically created files could be one. If for example, /var/tmp would be empty, it would be deleted, but later on a running application might want to write to /var/tmp a temporary file.

Then again, why would a package install something in /var/tmp and would then be removed when uninstalled? I cannot imagine a concrete example.

As far as I know, any application that want to install itself in specific directories should be able to create them if they are non-existant. So removing /usr/local/libexec when it is empty should not be an issue as the next installed application will recreate it.

What if we reckognize some directories as to be never deleted? For instance, /, /usr/bin, /usr/local, /var, /tmp, /bin, /sbin, /usr/share, and many others would never be deleted, even if empty. Others not in the list would be. This would be easy to implement.

This issue is that I do not find it clean when I install a package in a special directory using --prefix, and then find all the directories still there after uninstalling it.

Note that I am not 100% backing up my own idea, since I do reckognize that their might be some unexpected consequences of what I am proposing. But I would like for the discussion to continue so that we either convince ourselves that it is a bad idea, or maybe not.

Thus, if I'm right that Automake doesn't know which directories
the package owns, it should should err on the side of caution: it
should *not* try to delete any empty directories at uninstall
time.  Neither should Automake try to guess -- guesses involving
the "rm" command, especially as root, are a really dangerous
idea!

"rmdir -p" command for removing directories. Not "rm -rf", which is dangerous (you probably agree with me on this).

Note that this issue is orthogonal to the question of creating a
standalone uninstall script, which I actually find very
appealing.

Thanks for the support for my other idea. You are right, it is orthogonal to the other and this is why I created two distinct emails.

[1] By contrast, things like RPM *do* have enough information: if
    a directory is (or becomes) empty during uninstall, it should
    be removed iff it is mentioned in the RPM spec file.  Note
    that the spec file is (intended to be) hand-written, or at
    least hand-tuned; so decisions about which directories to
    list in it are made by a human, not by code.

Would there be a way to record this information? Maybe in the uninstall script I suggest? If the package created the directory, it would record this fact in the uninstall script.


Best regards,
Hans Deragon
--
Consultant en informatique/Software Consultant
Deragon Informatique inc.     Open source:
http://www.deragon.biz        http://autopoweroff.sourceforge.net
mailto://address@hidden     (Automatically poweroff home servers)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]