1 |
W dniu sob, 11.11.2017 o godzinie 12∶31 -0500, użytkownik Michael |
2 |
Orlitzky napisał: |
3 |
> > > and a meta-question, |
4 |
> > > |
5 |
> > > c) Seriously, empty directories are undefined behavior? |
6 |
> > |
7 |
> > ...and how could they be defined if a directory can be installed by |
8 |
> > multiple packages and has no explicit ownership? |
9 |
> |
10 |
> I see the problem, but the package manager knows which packages are |
11 |
> using a given directory. (Portage does, and it is at least easy to |
12 |
> record that information.) |
13 |
> |
14 |
> Empty directories could be installed normally, and then during an |
15 |
> unmerge, the package manager could check to see if the empty directory |
16 |
> is used by any package. If it is, leave it -- if not, remove it. You |
17 |
> might object that this would slow down the unmerge process, but a clever |
18 |
> lookup scheme would let you map directory names to packages quickly. |
19 |
> |
20 |
> In fact, such a lookup scheme is already implemented in the filesystem |
21 |
> itself, leading me full circle to the following idea: if the package |
22 |
> manager is about to install an empty directory, it could create the |
23 |
> ".keep" file itself. Then "ls -a $dir" is your lookup function that |
24 |
> determines whether or not a directory is in use by a package. |
25 |
|
26 |
What about a directory that is installed empty by multiple different |
27 |
packages, and non-empty by some other packages? |
28 |
|
29 |
> Having the package manager handle empty directories solves two problems, |
30 |
> |
31 |
> 1) Use of "keepdir" is inconsistent, because portage is happy to let |
32 |
> you create an empty directory without it (even though that |
33 |
> operation is illegal). |
34 |
|
35 |
It is not. It is just not guaranteed to be meaningful. |
36 |
|
37 |
> |
38 |
> 2) The build systems of many packages will create empty directories |
39 |
> during "make install", and it's unreasonable to expect developers |
40 |
> to "keepdir" them all. |
41 |
|
42 |
Not all of those directories are really meaningful. |
43 |
|
44 |
> Essentially,we have two commands to create a directory, "dodir" and |
45 |
> "do-empty-dir" (which we call "keepdir"). The latter is only necessary |
46 |
> due to an implementation detail, so it doesn't belong in the user |
47 |
> interface -- the PM should figure out what to do. |
48 |
> |
49 |
> As far as the actual implementation goes, I'm not sure that |
50 |
> automatically-generated ".keep" files are better than having the package |
51 |
> manager maintain its own database. The latter would be more complex, but |
52 |
> would avoid littering everyone's filesystems with ".keep" files. |
53 |
|
54 |
Do you care enough to spec this properly, introduce EAPI-conditional |
55 |
behavior for it and prepare patches for the package managers? |
56 |
|
57 |
-- |
58 |
Best regards, |
59 |
Michał Górny |