1 |
On Sat, 9 Mar 2013 11:10:11 +0100 |
2 |
Alexis Ballier <aballier@g.o> wrote: |
3 |
|
4 |
> On Fri, 8 Mar 2013 17:30:10 +0100 |
5 |
> Michał Górny <mgorny@g.o> wrote: |
6 |
> |
7 |
> > We're talking about two different tricks. |
8 |
> > |
9 |
> > Busybox checks argv to support symlinking for a standard tool. With |
10 |
> > invalid argv[0], it still runs as the standard busybox binary. You can |
11 |
> > use it that way, the 'safe way'. |
12 |
> > |
13 |
> > Unless I'm missing something, git checks argv to support symlinking |
14 |
> > into a few dozen tools which is optional. I doubt most of our users |
15 |
> > rely on that rather than using the 'git foo' syntax. |
16 |
> > |
17 |
> > A wrapper needs valid argv[0] to find the actual executable. Since |
18 |
> > argv[0] is unlikely to contain a path, that's either reinventing some |
19 |
> > logic or execvp() which is a bit fragile. Plus symlink resolution |
20 |
> > loop. Hard links do not work at all. |
21 |
> > |
22 |
> > And that's just theory. I may be missing some of the dangers. |
23 |
> |
24 |
> abiwrapper with invalid argv will print a standard help message too :) |
25 |
|
26 |
Help message won't help users. |
27 |
|
28 |
We're very sorry, that won't work. Don't bother reporting it to |
29 |
upstream, it's Gentoo-specific hack, they'll just WONTFIX them. Feel |
30 |
free to report it here, we may be able to clean the mess up someday. |
31 |
|
32 |
We're basically talking about opt-out. We introduce a trick which fails |
33 |
in corner cases by default, hoping those cases won't happen. People |
34 |
start to rely on it. Then the corner case happens and we need to |
35 |
opt-out, and we need to fix everything that started to rely |
36 |
on the common case working. |
37 |
|
38 |
> I don't see why you consider execvp fragile: Don't tell me you run all |
39 |
> your binaries with full path. |
40 |
> |
41 |
> Of course you can break it, but the question is more: Is it likely to |
42 |
> break in a real life situation? |
43 |
|
44 |
I think that was one of the things that were pointed out in the initial |
45 |
python-exec implementation. It's not broken that much as a bit |
46 |
inconsistent by design. As in, wrapper /usr/bin/foo-config doesn't |
47 |
guarantee that /usr/bin/foo-config-${ARCH} will be called (maybe |
48 |
something in /usr/local/bin or somewhere completely different?). |
49 |
|
50 |
> If you consider the argv trick fragile, which is understandable, the |
51 |
> same wrapper idea can be used differently: If you want to wrap a |
52 |
> binary foo, move it to foo_${abi} and build a wrapper with hardcoded |
53 |
> 'foo' instead of argv[0] that you install as foo. You can even hardcode |
54 |
> its path and use execv instead of execvp. That would invalidate all |
55 |
> your above objections I think :) |
56 |
|
57 |
Well, yes. In the worst case we could go that way, although it's a bit |
58 |
of overkill, don't you think? While we're talking about a few programs |
59 |
which will actually need it, and even less which will require |
60 |
modification in more than one place. |
61 |
|
62 |
> Let alone qmake, how do you suggest dealing with *-config scripts? |
63 |
> Some packages are just not written with multilib in mind, or have |
64 |
> to maintain historical compatibility which was not, wrapping the |
65 |
> problematic binaries is one solution to this. I've not seen any other |
66 |
> solution. |
67 |
|
68 |
Choose optimal solution per-package. In case of freetype, the solution |
69 |
is simple enough: make multilib-aware packages use pkg-config. |
70 |
fontconfig does exactly that, and in the earlier version it was enough |
71 |
to export something like FREETYPE_CONFIG='pkg-config freetype2' |
72 |
(or ac_cv...). |
73 |
|
74 |
In LLVM, for example, we were considering just calling the proper |
75 |
config by hand. It's a single multilib package which will need it now, |
76 |
so it's not that problematic. |
77 |
|
78 |
If you have any specific -config scripts in mind, please point me |
79 |
to them. By the way, from what I recall Tommy said that llvm is |
80 |
basically the only -config script being actually compiled executable. |
81 |
|
82 |
-- |
83 |
Best regards, |
84 |
Michał Górny |