W dniu pią, 10.11.2017 o godzinie 19∶21 -0500, użytkownik Michael
Orlitzky napisał:
> On 11/10/2017 04:36 PM, Damo Brisbane wrote:
> > 
> > Re for...keepdir, I found removing it then the /var/log/fabio folders
> > were not getting created, so keeping it in there.
> 
> You need to tell the ebuild to create that directory one way or another.
> The "dodir" function will create the directory, but without the ".keep"
> file inside of it. However that may be "illegal" in this case; see below.
> 
> 
> > http://www.calculate-linux.org/main/en/using_ebuild, says this of *keepdir*:
> > 
> > *Creates (if necessary) a |.keep| file in the given directory so that it
> > isn't auto-cleaned. Never create a |.keep| file yourself. If Portage
> > changes how |keepdir| works, then creating the file yourself will break
> > the package.*
> 
> To my knowledge, no package manager will remove a non-empty directory,
> nor will it remove anything that the package manager did not itself
> create. To me that raises a question: why would I ever want to keep
> around an (otherwise empty) directory that was created by the package
> manager?
> 
> I found this,
> 
>   https://dev.gentoo.org/~ulm/pms/head/pms.html#x1-15100013.2.2
> 
> which states
> 
>   Behaviour upon encountering an empty directory is undefined. Ebuilds
>   must not attempt to install an empty directory.
> 
> Certainly "keepdir" will make the directory non-empty, but with the
> additional (unwanted) side-effect that the directory won't be removed
> when the package is uninstalled. Thus "keepdir" doesn't seem like it was
> intended to address that technicality. So, I have two questions now...

Wrong. It creates a dotfile inside it, and removes it along with it.

> 
>   a) When would you want to use keepdir?

Because it works.

> 
>   b) What's the right way to prevent a directory from being empty? Touch
>      a dummy file?

Use keepdir.

> 
> and a meta-question,
> 
>   c) Seriously, empty directories are undefined behavior?

...and how could they be defined if a directory can be installed by
multiple packages and has no explicit ownership?

-- 
Best regards,
Michał Górny


Reply via email to