public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Michael Orlitzky <mjo@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Subject: Re: [gentoo-dev] Help testing ebuilds? golang/Fabio load balancer
Date: Sat, 11 Nov 2017 12:31:15 -0500	[thread overview]
Message-ID: <f5b72223-8236-df5a-25b6-3e967cabef8a@gentoo.org> (raw)
In-Reply-To: <1510387105.1210.2.camel@gentoo.org>

On 11/11/2017 02:58 AM, Michał Górny wrote:
>>
>> 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.
> 
> Wrong. It creates a dotfile inside it, and removes it along with it.

Gotcha, I never tested my assumption that keepdir would keep the dir =P

FWIW, `man 5 ebuild` says keepdir "Tells portage to leave directories
behind..." It's not at all apparent that the "left behind" refers to the
unmerge of some other, unrelated, package.


>>   a) When would you want to use keepdir?
> 
> Because it works.

Makes sense now, thanks.



>> 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?

I see the problem, but the package manager knows which packages are
using a given directory. (Portage does, and it is at least easy to
record that information.)

Empty directories could be installed normally, and then during an
unmerge, the package manager could check to see if the empty directory
is used by any package. If it is, leave it -- if not, remove it. You
might object that this would slow down the unmerge process, but a clever
lookup scheme would let you map directory names to packages quickly.

In fact, such a lookup scheme is already implemented in the filesystem
itself, leading me full circle to the following idea: if the package
manager is about to install an empty directory, it could create the
".keep" file itself. Then "ls -a $dir" is your lookup function that
determines whether or not a directory is in use by a package.

Having the package manager handle empty directories solves two problems,

  1) Use of "keepdir" is inconsistent, because portage is happy to let
     you create an empty directory without it (even though that
     operation is illegal).

  2) The build systems of many packages will create empty directories
     during "make install", and it's unreasonable to expect developers
     to "keepdir" them all.

Essentially,we have two commands to create a directory, "dodir" and
"do-empty-dir" (which we call "keepdir"). The latter is only necessary
due to an implementation detail, so it doesn't belong in the user
interface -- the PM should figure out what to do.

As far as the actual implementation goes, I'm not sure that
automatically-generated ".keep" files are better than having the package
manager maintain its own database. The latter would be more complex, but
would avoid littering everyone's filesystems with ".keep" files.


  reply	other threads:[~2017-11-11 17:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-10  4:08 [gentoo-dev] Help testing ebuilds? golang/Fabio load balancer Damo Brisbane
2017-11-10 12:59 ` Michael Orlitzky
2017-11-10 21:36   ` Damo Brisbane
2017-11-11  0:21     ` Michael Orlitzky
2017-11-11  7:58       ` Michał Górny
2017-11-11 17:31         ` Michael Orlitzky [this message]
2017-11-11 19:26           ` Michał Górny
2017-11-12 12:53             ` Michael Orlitzky
2017-11-12 13:43               ` Michał Górny
2017-11-13 15:10                 ` Michael Orlitzky
2017-11-12 15:21               ` Ulrich Mueller
2017-11-13 15:16                 ` Michael Orlitzky
2017-11-11 19:54           ` Brian Dolbec

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f5b72223-8236-df5a-25b6-3e967cabef8a@gentoo.org \
    --to=mjo@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox