Gentoo Archives: gentoo-dev

From: Alexis Ballier <aballier@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Pre-GLEP RFC: Automated enforcing of REQUIRED_USE constraints
Date: Sun, 09 Jul 2017 12:20:31
Message-Id: 20170709142014.0117fd89@gentoo.org
In Reply to: Re: [gentoo-dev] Pre-GLEP RFC: Automated enforcing of REQUIRED_USE constraints by "Michał Górny"
1 On Sun, 09 Jul 2017 13:36:16 +0200
2 Michał Górny <mgorny@g.o> wrote:
3
4 > On nie, 2017-07-09 at 11:29 +0200, Alexis Ballier wrote:
5 > > You don't seem to get how normalizing and constant
6 > > propagation/elimination works.
7 > >
8 > > Basically, reordering would be:
9 > > And(list) -> And( forced(list) + free(list) + masked(list) )
10 > > Or(list) -> Or( ... . )
11 > > etc.
12 > >
13 > > While normalizing is:
14 > > And(list) -> False if False appears in a normalize(x) for x in list,
15 > > True if normalize(x) for x in list is empty or all
16 > > True, And(normalize(x) for x in list if != True and != False)
17 > > etc.
18 > >
19 > > That's described in one point: Apply boolean algebra rules.
20 >
21 > Last I checked, implementing a full-fledged boolean algebra processor
22 > with reductions and other magic is a non-goal here.
23
24
25 That is not a goal for auto solving required use, but catching
26 uninstallable packages is probably more important than that...
27
28
29 > > What I don't like about reordering is that it is too tightly
30 > > coupled to the following solving algorithm and the restricted
31 > > syntax, while really, having REQUIRED_USE constraints asking you to
32 > > enable a masked flag is something we ought to kill even without
33 > > solving as they hide broken deps and make all our QA checks less
34 > > useful.
35 >
36 > It's irrelevant since we kill the unsupported syntax anyway.
37
38 Your logic is flawed. You kill unsupported syntax because you fail to
39 get it right with all the complexity you're carrying, not the other way
40 around.
41
42
43 > > Finally, reordering, being essentially a local thing, does not have
44 > > the proper behavior in a general AST:
45 > > '|| ( ( a b ) c )' with 'a' and 'b' masked will be left invariant by
46 > > reordering and the resulting expanded form will be rejected while
47 > > constant propagation/elimination will reduce that to 'c' and be
48 > > good.
49 >
50 > Handling a rejected syntax is irrelevant.
51
52 Rejected by PMS ?
53
54 > > Hence, the reordering check cannot be used as a good input for
55 > > checking for broken REQUIRED_USE: I really think things like
56 > > 'vulkan? ( || ( video_cards_i965 video_cards_radeonsi ) )' should
57 > > be a repoman error on stable profiles where both those video cards
58 > > are masked and vulkan is not. For that, we need to support the
59 > > whole PMS-defined syntax, not a reduced one.
60 >
61 > No, we don't. It works just fine. The only difference is that it stops
62 > on the first erroneous constraint.
63
64 Don't you think it's a bit of an understatement saying that an
65 optional auto solver might need to enable masked useflag when in fact
66 there is a useflag that can never be enabled, auto solver or not ?
67
68 This also makes CI/repoman dep checks fail to catch broken cases: As of
69 today, nothing will catch a game depending on mesa[vulkan] and being
70 ~arm. Good luck installing such a game on arm though.
71
72
73 > > > No, it is not. You do not have the values of all the items inside
74 > > > the group, just some of them. Depending on how many of them do you
75 > > > have and what are them, you need to transform the group
76 > > > appropriately, e.g. by removing items, replacing the group or
77 > > > failing entirely.
78 > >
79 > > Yes, that's boolean algebra rules. You propagate constants from
80 > > leaves to root in the AST and if some 'False' appears in your AST
81 > > when you've reached the root you fail. I agree one needs some
82 > > practice on recursive structures to understand that quickly and
83 > > easily though.
84 >
85 > Except that we're dealing with structures which don't strictly follow
86 > boolean algebra rules, as you've already noticed.
87
88 Hmmm. No ?
89
90
91 > > > > > > One big advantage of working on ASTs is that it becomes
92 > > > > > > trivial to suggest a proper reordering.
93 > > > > >
94 > > > > > Reordering is never a trivial problem. Unless I'm missing
95 > > > > > something, it is technically possible that a 'reordering' will
96 > > > > > actually require a sub- item being moved out of the containing
97 > > > > > group.
98 > > > >
99 > > > > Not if done at the AST level.
100 > > > >
101 > > > > > And to be honest, I find the output of the verification
102 > > > > > script in this regard quite useful. That is, it saying 'X
103 > > > > > affects Y, so it needs to go before it' is quite clear to me.
104 > > > > > I don't think most developers would actually need to script
105 > > > > > to pinpoint a specific location for every single
106 > > > > > constraint.
107 > > > >
108 > > > > In most cases this is sufficient.
109 > > > > Think of a more complex case:
110 > > > > A -> B
111 > > > > B -> C
112 > > > > A -> D
113 > > > > D -> C
114 > > > >
115 > > > > |-> B -|
116 > > > > A -| |->C
117 > > > > |-> D -|
118 > > > >
119 > > > > It's starting to be a more complex mental exercise to get the
120 > > > > proper ordering when given the 1st form only.
121 > > > >
122 > > > >
123 > > > > Actually, considering people rant against git merges because
124 > > > > they want linear history in the graph log but fail to
125 > > > > understand 'git log' is precisely about displaying such a
126 > > > > linear ordering, I'm ready to bet someone will rant :)
127 > > >
128 > > > We can discuss this when you have a working algorithm. Right now,
129 > > > it's a purely theoretical exercise unless someone can come up with
130 > > > a reasonable way of implementing it.
131 > >
132 > > Hmmm. lol ?
133 > > May I suggest you spend 30 minutes on wikipedia about what
134 > > topological sorting is, what it does and what purpose it serves?
135 >
136 > I was referring to doing all the work on AST level, especially
137 > detecting problems.
138
139 The common prefix trick is similar to working on AST, except it
140 gives less readable output. The ordering step is identical.
141
142 For less readable output, I mean: 'foo1? ( bar )' must come before
143 'foo1? ( baz )' when your input in 'foo? ( baz bar )'. Working on AST
144 it'd be straightforward to say 'bar must come before baz in 'foo? ( baz
145 bar )', with common prefix either the merge-back step is left to the
146 reader or there needs to be a post processing step.
147
148 > > It's a bit annoying to see you completely lost every time it comes
149 > > up.
150 >
151 > I find almost every your mail annoying because of your inability to
152 > focus outside one thing you've convinced yourself is the only solution
153 > to every problem that ever comes, and to accept that there could be
154 > alternative solutions that would work as well.
155 >
156 > But that's completely irrelevant to the topic at hand and I don't see
157 > how pointing out how every one of us is irritating is going to help
158 > solve anything.
159
160 Considering you're completely skipping the step and leaving an ordering
161 to be manually inferred, I'm not sure what you mean by "there could be
162 alternative solutions that would work as well". Please explain if I've
163 missed something.
164
165
166 > > > Except it doesn't because it's extremely uncommon (and even
167 > > > unlikely) and I am successfully exterminating the last
168 > > > occurrences. Implementing support for something that will be
169 > > > never used is a waste of time.
170 > >
171 > > Except you're already wasting your time exterminating some cases for
172 > > which support is already written. You still don't know whether your
173 > > restricted syntax will be accepted in PMS (which mostly depends if
174 > > people feel comfortable with its expressivity), so you don't know if
175 > > you won't have to plug support for it later. May I remind you the
176 > > numbers I ran? Among all the rejected "too complex" usages of
177 > > requse, only *1* could have led to an invalid solution by the
178 > > solver.
179 >
180 > May I remind you the numbers that are in the GLEP? Every single case
181 > could have been expressed in a more readable way using a much simpler
182 > syntax. The developers approached about that agreed with it.
183
184 Everybody agrees the restricted syntax is more readable I think, at
185 least I do and have always said so. An algorithm or a spec does not care
186 if it's readable or not.
187
188 > I really don't like the idea of arguing on the basis of 'someone may
189 > figure out some really complex case to prove you wrong one day'.
190 > People weren't able to come up with a good use case for 6.5yr. What
191 > makes you believe they will suddenly need it now?
192
193 The fact that no-one has felt the need to restrict it in PMS and
194 clean-up crappy corner cases left for historical reasons.
195
196 It's a bit of a chicken and egg problem since now the corner cases are
197 more clear but I think it's almost mandatory to get the restrictions
198 approved and put in PMS.
199
200 > > > > > > - keeping the specification and implementation relatively
201 > > > > > > simple: You already define everything for working without
202 > > > > > > restriction. Plus, unlimited implication nesting has the
203 > > > > > > same complexity.
204 > > > > >
205 > > > > > No, I don't. I don't cover the meaning of nested groups and
206 > > > > > things just explode when they come into game.
207 > > > >
208 > > > >
209 > > > > You mostly do with the rewriting part, you're only refusing to
210 > > > > admit it :)
211 > > >
212 > > > You mean the transform? It doesn't cover the possibility of those
213 > > > groups containing anything but plain flags. As we've already
214 > > > established, the results become non-trivial when they do and those
215 > > > cases are certainly not covered here.
216 > >
217 > > That's why I said mostly. The missing parts are really small, trust
218 > > me.
219 >
220 > It's funny how you insist on claiming your ideas to be 'small'. Yet my
221 > implementation takes a single 23-line function and yours takes around
222 > 10 times that much, not counting all the out-of-place alterations you
223 > have done which I don't really consider even worth counting.
224 >
225 > Oh, and my code is more readable and easier to comprehend.
226 >
227 > If you really want to true, then please argue with real arguments
228 > and not run-around theory.
229 >
230
231 So, you're comparing quick n dirty POC to get some numbers and
232 investigate if an idea is worth it and something you've worked on
233 cleaning up ? Also, considering your usual rejection of anything
234 that you've not invented, I don't feel the need to waste my time
235 on getting something clean.
236
237 Alexis.