1 |
On 5/26/20 10:16 AM, Alec Warner wrote: |
2 |
> On Tue, May 26, 2020 at 9:46 AM Zac Medico <zmedico@g.o |
3 |
> <mailto:zmedico@g.o>> wrote: |
4 |
> |
5 |
> On 5/26/20 1:43 AM, Alec Warner wrote: |
6 |
> > On Mon, May 25, 2020 at 9:34 PM Zac Medico <zmedico@g.o |
7 |
> <mailto:zmedico@g.o> |
8 |
> > <mailto:zmedico@g.o <mailto:zmedico@g.o>>> wrote: |
9 |
> > |
10 |
> > Since variables like A and AA can contain extremely large |
11 |
> values which |
12 |
> > may trigger E2BIG errors during attempts to execute |
13 |
> subprocesses, delay |
14 |
> > export until the last moment, and unexport when appropriate. |
15 |
> > |
16 |
> > |
17 |
> > So I think if you want to do this because PMS says: |
18 |
> > AA should not be visible in EAPI > 3. |
19 |
> > A should only be visible in src_*, pkg_nofetch. |
20 |
> > |
21 |
> > That part of the patch makes sense to me. The part that is |
22 |
> confusing to |
23 |
> > me is the 'delay' part; can you explain that further? When you say |
24 |
> > "delay until the last moment" what do you mean by that and what |
25 |
> value is |
26 |
> > it delivering? |
27 |
> |
28 |
> If we export an environment variable which contains an extremely large |
29 |
> value, then there's a vulnerability in execve which causes it to fail |
30 |
> with an E2BIG error. Since A and AA values can easily grow large enough |
31 |
> to trigger this vulnerability, portage can protect itself from execve |
32 |
> failures by delaying the export until the moment that it hands control |
33 |
> to the ebuild phase. |
34 |
> |
35 |
> |
36 |
> > Is it simply that we don't export these variables on the python side, |
37 |
> > and we only use them in the shell portion? |
38 |
> |
39 |
> That's correct. Here's a test case which demonstrates the E2BIG error, |
40 |
> and shows that 'export -n A' can suppress it: |
41 |
> |
42 |
> |
43 |
> I've run similar tests, but I'm less excited by this work around. I |
44 |
> think its reasonable to work toward eventually not exporting A and AA |
45 |
> (the latter already done in EAPIs > 3). Then when ebuilds encounter |
46 |
> problems, we can tell authors "Upgrade to EAPI X" (where X is >3 or >=8; |
47 |
> in the potential case of A.) Having a hard limit on A for EAPIs 0-7 and |
48 |
> a hard limit on AA for EAPIs 0-3 seems perfectly fine and we should |
49 |
> expect authors to refactor (as texlive did) in order to meet the |
50 |
> existing API limitations. |
51 |
> |
52 |
> Basically unless there are more practical use cases today, the delaying |
53 |
> of export seems like a feature no one will use and added complexity. I |
54 |
> dunno how large the go-mod use cases are yet; but I myself have not seen |
55 |
> any with this many deps. |
56 |
> |
57 |
> -A |
58 |
|
59 |
|
60 |
I'm in no rush to merge this patch. I wanted to create it as a proof of |
61 |
concept, so that we'd be prepared for a future EAPI where the size of A |
62 |
is practically unlimited. We only have to adjust the ___eapi_exports_A |
63 |
function to have a working EAPI extension. |
64 |
-- |
65 |
Thanks, |
66 |
Zac |