Gentoo Archives: gentoo-user

From: "Poison BL." <poisonbl@×××××.com>
To: gentoo-user <gentoo-user@l.g.o>
Subject: Re: [gentoo-user] links that behave differently per calling app?
Date: Tue, 12 Nov 2019 14:05:21
Message-Id: CAOTuDKqfr8JJ8pp1+rvH53RjhR2jr6qtCJ1mHWzZtiQXs__60w@mail.gmail.com
In Reply to: [gentoo-user] links that behave differently per calling app? by Caveman Al Toraboran
1 On Sun, Nov 10, 2019 at 11:37 PM Caveman Al Toraboran
2 <toraboracaveman@××××××××××.com> wrote:
3 >
4 > hi - is it possible to have some kind of fancy links that
5 > know the name of the process that is trying to access
6 > it, and based on its name, it links it to a file?
7
8 Yes, and that's used pretty extensively in busybox. Symlinks named any
9 of its tools that point to it directly call into *that* tool.
10
11 > i think if we have this, we can solve slotting in a simpler
12 > way. e.g. we install libs in their own non-conflicting
13 > locations, and then install for them such fancy sym links
14 > with access that routes accessing processes to the right
15 > version of the lib.
16
17 I'm not entirely sure about the library level. Your goal sounds like
18 one link to many library versions instead of many links to one
19 library. A symlink itself can only point at one thing, so the
20 filesystem level can't do that. So you would have to have a shim
21 library that gets loaded, then loads the version the calling process
22 needs... based on either an exhaustive table of the mappings of every
23 binary to the versions they need, or some other magic.You wouldn't be
24 able to just pick any version of a library and hand it back to a
25 process, since major versions on libraries tend to break the
26 interfaces they present, so you would end up having a 1:1 mapping of
27 any particular binary calling a singular library version. That already
28 happens based on the linker, and even works for less specific
29 versioning in many cases with symlinks from, say, libc.so.6 and
30 libc.so.6.2 pointing to libc.so.6.2.13 (which is actually a many links
31 to one library technique that's already used). To change what
32 interface a calling process *can* work with will require rebuilding it
33 against the new major version of the library, and if it's one of those
34 circular situations where it's part of the build process, you have to
35 have both the old and new library available (one of the reason slots
36 exist). The binary itself should contain enough detail to load the
37 version *it* needs already, and then should be requesting that from
38 the dynamic linker already...
39
40 --
41 Poison [BLX]
42 Joshua M. Murphy