Gentoo Archives: gentoo-portage-dev

From: tvali <qtvali@×××××.com>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] DB and binary dependency
Date: Fri, 24 Mar 2006 14:25:07
Message-Id: cea53e3c0603240624n74c6e03ej@mail.gmail.com
In Reply to: Re: [gentoo-portage-dev] DB and binary dependency by Paul de Vrieze
1 On 24/03/06, Paul de Vrieze <pauldv@g.o> wrote:
2 > On Friday 24 March 2006 12:40, tvali wrote:
3 > >
4 > > Interface can be made somewhat automatically checkable.
5 > >
6 > > For example:
7 > > void a(int);
8 > > void b(int, int);
9 > > void b(int, char);
10 > >
11 > > Is compatible with:
12 > > void a(int);
13 > > void b(int, int);
14 > >
15 > Unfortunately, your wrong. This only makes sure that you have the right
16 > slots to put your squares, triangles and circles in. It does not say that
17 > b(int,int) from the first lib actually does the same thing as b(int,int)
18 > from the second library.
19
20 Sorry i thought about it for a moment, then left out later as broken
21 design cases didnt seems so important. Versioning of distinct
22 functions would be good, anyway not automatic.
23
24 > To make it worse, suppose that header file 1 defines the following macro:
25 > #define c(x,y) { int A = x; int B = y; if (A<B) { b(A,B); } else
26 > { b(B,A); }
27 >
28 > And header file 2 defines the following macro
29 > #define c(x,y) { int A = x; int B = y; if (A>B) { b(A,B); } else
30 > { b(B,A); }
31 >
32 > And the semantics of B are such that one is supposed to use c(x,y) to call
33 > b, and b1 accordingly expects the first argument to be smaller, and b2
34 > expects the second one to be smaller. On the source level, this macro
35 > makes it transparent. The libraries, although they may seem different,
36 > are incompatible. While they implement the same source interface, they do
37 > NOT implement the same binary interface. On a binary (read compiled)
38 > level, they can not be exchanged for eachother.
39 >
40 > While the above example is clearly broken design, this does happen enough
41 > in actual libraries in way more subtle ways. And that is disregarding the
42 > fact that the linux/elf ABI does not include argument lists in symbol
43 > linking. As such b(int,char) is indistinguishable from b(int,int). To
44 > overcome this C++ uses name mangling which creates names based on the
45 > signature.
46
47 Ok, assuming broken design it's harder. Anyway, how would binary deps
48 solve this? This seems to be humans work in all cases.
49
50 > > And this can be checked automatically - real header must have all
51 > > headings that interface describes. Microsoft has actually done good
52 > > work in C# on that topic -- first place where i saw something like
53 > > that after thinking about it myself :) This MS version is feature of a
54 > > language, of course, not a feature of compiler. Anyway, that might
55 > > give an idea.
56 >
57 > There is a reason that MS implements it on the language level, in C#. It
58 > is impossible to do while keeping the (admittedly extremely poor)
59 > semantics of C and C++. Unfortunately the linux ABI (Application Binary
60 > Interface) is based on C. As such one has to take C into account.
61
62 Thats true that C# has much more clearness in it's language about what is what.
63
64 Anyway, as .h files have become as well as standard, you may show in
65 code as well as in bin, which functions are needed.
66
67 Is there any advantage of bin dep over code dep is a question for me
68 ..some here suggest that there is, i think that everything can be done
69 as well with code deps.
70
71 > > I'm actually sure that this all can be calculated up from sourcecode
72 > > and bindep would be after that a check if cpu didnt calculate
73 > > something wrong :P Another question, how difficult it is and is it
74 > > worth the time.
75 >
76 > Perhaps you should read up your knowledge of the C language. After you
77 > found that the C language is a mess, try C++, it makes things worse.
78 > After that's finished take a look at solving this problem for ALL
79 > languages.
80
81 I actually know c++, but dont know c. Anyway, what i mean is that if
82 you have .h files, you may make up automatic check if interfaces fit
83 each other. I have to think about if c++ is a mess :)
84
85 > Automatic source analysis for dependency calculation is a dead end. Even
86 > if you manage to find the proper interfaces (oops, the package had it's
87 > own gl.h instead of using the system one), you don't know anything about
88 > the semantics of those interfaces. Two things with the same name may very
89 > well have very different behaviours.
90
91 I think it should be solved with:
92 // system's header
93 #include <...>
94 // own header
95 #include "..."
96
97 But, yes, not in all cases.
98
99 Ok -- i agree that there are several problems, which have to be solved
100 before taking this topic up again and that they are possibly
101 unsolvable in many cases and possibly too much work in many others.
102
103 > Paul
104 >
105 > --
106 > Paul de Vrieze
107 > Gentoo Developer
108 > Mail: pauldv@g.o
109 > Homepage: http://www.devrieze.net
110 >
111 >
112 >
113
114
115 --
116 tvali
117
118 If I had eight hours to chop down a tree, I'd spend six sharpening my
119 axe. -Abraham Lincoln
120
121 http://www.kuro5hin.org/story/2005/1/28/32622/4244
122
123 --
124 gentoo-portage-dev@g.o mailing list

Replies

Subject Author
Re: [gentoo-portage-dev] DB and binary dependency tvali <qtvali@×××××.com>
Re: [gentoo-portage-dev] DB and binary dependency Paul de Vrieze <pauldv@g.o>