1 |
Hi all; I posted a message about this problem a few weeks ago. Since |
2 |
then I've looked at the code and traced it through, and verified my |
3 |
fears: Portage's dependency resolution method is only superficial. |
4 |
|
5 |
Consider this situation: |
6 |
|
7 |
cat/all/all-1.ebuild: DEPEND=" ~cat/first-1 ~cat/second-1 " |
8 |
|
9 |
cat/first/first-1.ebuild DEPEND=" cat/second " |
10 |
|
11 |
cat/second/second-1.ebuild DEPEND="" |
12 |
cat/second/second-2.ebuild DEPEND="" |
13 |
|
14 |
It's obvious that there is an acceptable way to install these packages |
15 |
when someone runs "emerge cat/all": |
16 |
|
17 |
cat/second-1 |
18 |
cat/first-1 |
19 |
cat/all-1 |
20 |
|
21 |
Unfortunately, Portage will not handle this properly (IMO). When you |
22 |
ask it to "emerge all", one of two things will happen depending on the |
23 |
order in which Portage decides to merge "first" and "second" (which is |
24 |
essentially random: IIUC the DEPEND list of cat/all is stored in a hash |
25 |
table). However I believe both results are incorrect. |
26 |
|
27 |
The first thing that may happen is the merge will go like this: |
28 |
|
29 |
cat/second-2 |
30 |
cat/first-1 |
31 |
cat/second-1 |
32 |
cat/all-1 |
33 |
|
34 |
The second thing that may happen is this: |
35 |
|
36 |
cat/second-1 |
37 |
cat/second-2 |
38 |
cat/first-1 |
39 |
cat/all-1 |
40 |
|
41 |
In the first case it's bad because first-1 is compiled against a newer |
42 |
version of a package, then an older version is installed. The second |
43 |
case is bad because all-1 asked for second-1 to be installed but by the |
44 |
time we get to building all-1, second-2 is what's installed. Most |
45 |
likely all-1 will fail to build. |
46 |
|
47 |
|
48 |
Why does this happen? It's because when Portage resolves dependencies |
49 |
it keeps no memory about restrictions other than those in the immediate |
50 |
parent. |
51 |
|
52 |
In the first case above the process goes like this: |
53 |
|
54 |
want cat/all (no version restriction) |
55 |
> the best match is cat/all-1 |
56 |
cat/all-1 wants cat/first-1 |
57 |
> the best match is cat/first-1 |
58 |
cat/first-1 wants cat/second (no version restriction) |
59 |
> the best match is cat/second-2 |
60 |
cat/second-2 has no dependencies |
61 |
< install cat/second-2 |
62 |
< install cat/first-1 |
63 |
cat/all-1 wants cat/second-1 |
64 |
> the best match is cat/second-1 |
65 |
< install cat/second-1 |
66 |
< install cat/all-1 |
67 |
|
68 |
In the second case, it goes like this: |
69 |
|
70 |
want cat/all (no version restriction) |
71 |
> the best match is cat/all-1 |
72 |
cat/all-1 wants cat/second-1 |
73 |
> the best match is cat/second-1 |
74 |
< install cat/second-1 |
75 |
cat/all-1 wants cat/first-1 |
76 |
> the best match is cat/first-1 |
77 |
cat/first-1 wants cat/second (no version restriction) |
78 |
> the best match is cat/second-2 |
79 |
cat/second-2 has no dependencies |
80 |
< install cat/second-2 |
81 |
< install cat/first-1 |
82 |
< install cat/all-1 |
83 |
|
84 |
Note how in each case when Portage tries to find the best match it ONLY |
85 |
examines the restrictions of the immediate predecessor. There is |
86 |
nothing in the database that marks various versions as being "out of |
87 |
bounds" due to some other package previously considered (in this case, |
88 |
cat/all-1). |
89 |
|
90 |
|
91 |
Before I spend much time writing about possible solutions to this |
92 |
problem (which I'm sure most everyone here could also see), is there any |
93 |
consensus that this is a problem, and that it should be fixed? |
94 |
|
95 |
Or, am I misunderstanding something or is this just the way Portage is |
96 |
supposed to work and people are OK with it as-is? |
97 |
|
98 |
-- |
99 |
------------------------------------------------------------------------------- |
100 |
Paul D. Smith <psmith@××××××××××××××.com> HASMAT: HA Software Mthds & Tools |
101 |
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist |
102 |
------------------------------------------------------------------------------- |
103 |
These are my opinions---Nortel Networks takes no responsibility for them. |
104 |
|
105 |
-- |
106 |
gentoo-dev@g.o mailing list |