1 |
On Thu, 7 Mar 2013 17:25:23 +0100 |
2 |
Alexis Ballier <aballier@g.o> wrote: |
3 |
|
4 |
> On Mon, 4 Mar 2013 21:49:48 +0100 |
5 |
> Michał Górny <mgorny@g.o> wrote: |
6 |
> |
7 |
> > I'm afraid that's the first potential point of failure. Relying |
8 |
> > on argv[0] is a poor idea and means that any application calling |
9 |
> > exec() with changed argv[0] on a wrapped binary will fail terribly. |
10 |
> |
11 |
> Go tell that to those that wrote busybox, tex or git: They all use |
12 |
> that argv trick :) I'm sure there are plenty of other examples and |
13 |
> don't consider that a poor idea. Note that the wrapper does not lie on |
14 |
> argv: it just makes the binary think it has its original name (by |
15 |
> passing argv as is) while it has been moved to allow parallel |
16 |
> installation of different flavors of it. |
17 |
|
18 |
We're talking about two different tricks. |
19 |
|
20 |
Busybox checks argv to support symlinking for a standard tool. With |
21 |
invalid argv[0], it still runs as the standard busybox binary. You can |
22 |
use it that way, the 'safe way'. |
23 |
|
24 |
Unless I'm missing something, git checks argv to support symlinking |
25 |
into a few dozen tools which is optional. I doubt most of our users |
26 |
rely on that rather than using the 'git foo' syntax. |
27 |
|
28 |
A wrapper needs valid argv[0] to find the actual executable. Since |
29 |
argv[0] is unlikely to contain a path, that's either reinventing some |
30 |
logic or execvp() which is a bit fragile. Plus symlink resolution loop. |
31 |
Hard links do not work at all. |
32 |
|
33 |
And that's just theory. I may be missing some of the dangers. |
34 |
|
35 |
> > I'm afraid you are actually starting to go the other way. |
36 |
> > |
37 |
> > Global wrapper means that it is potentially useful to our users. |
38 |
> > However I don't really see people who want to compile 32-bit |
39 |
> > executables think of setting some custom variable like ABI. |
40 |
> |
41 |
> They will not: Users will call the name-suffixed version directly. If |
42 |
> they call the non-suffixed version then the above logic will run the |
43 |
> DEFAULT_ABI version. There's no variable to set. |
44 |
|
45 |
So there's no benefit from the wrapper to the users. We're talking |
46 |
about a solution which is purely disadvantageous to them. |
47 |
|
48 |
> The variable is more so that ebuilds/eclasses can set the variable and |
49 |
> be done. Exactly like EPYTHON I think. |
50 |
|
51 |
Python is almost a completely different issue. Most importantly, we |
52 |
support multiple Python versions, and have to maintain all of them. |
53 |
That support is extended to all packages in the tree, and is achieved |
54 |
with no major losses. |
55 |
|
56 |
We're talking about having multilib for a few chosen packages, and yet |
57 |
introducing a tree-wide solution to hack-around even less of them. |
58 |
A hack-around which has visible disadvantages. |
59 |
|
60 |
> [...] |
61 |
> > > That's why I asked for examples :) |
62 |
> > > qmake may do it, I don't think its sane, but that's life for now. |
63 |
> > > having glxinfo for each abi is useful from a user perspective (it |
64 |
> > > does not need the wrapper a priori though) |
65 |
> > |
66 |
> > Yep, I intended to just have the additional variant of glxinfo |
67 |
> > directly callable, with a name chosen specifically by the X11 team. |
68 |
> > Wrapper would be more confusing than beneficial here IMO. |
69 |
> |
70 |
> Having a wrapper or not, for the end user that does not know the |
71 |
> internal variable name, the end-result will be exactly the same :) |
72 |
|
73 |
Unless he symlinked the tool. Then it simply won't work for him anymore. |
74 |
|
75 |
> This is an extreme and stupid example, but without any wrapper and with |
76 |
> ABI-specific output used within ebuilds and build systems, you have to |
77 |
> be *very* careful that the correct tool is *always* called. |
78 |
> The wrapper is only a way to ensure that after all :) |
79 |
|
80 |
The main point is to enforce ebuild developers to be careful while |
81 |
handling multilib. This is the main difference from Tommy's solution -- |
82 |
I don't want people to switch the 'multilib' flag on ebuilds |
83 |
thoughtlessly and expect everything to work without changing the ebuild. |
84 |
|
85 |
-- |
86 |
Best regards, |
87 |
Michał Górny |