Gentoo Archives: gentoo-user

From: Grant Taylor <gtaylor@×××××××××××××××××××××.net>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] links that behave differently per calling app?
Date: Wed, 13 Nov 2019 03:54:00
Message-Id: 202d3850-6e9d-3538-b101-207892e8ebe0@spamtrap.tnetconsulting.net
In Reply to: [gentoo-user] links that behave differently per calling app? by Caveman Al Toraboran
1 On 11/10/19 9:37 PM, Caveman Al Toraboran wrote:
2 > hi - is it possible to have some kind of fancy links that know the
3 > name of the process that is trying to access it, and based on its name,
4 > it links it to a file?
5
6 I've not heard of that specifically.
7
8 > e.g. `ln -s X Y` will create link Y that always refers to X whenever
9 > anyone tries to access Y. but is it possible to have a fancier linking
10 > that creates a linking file that contains some kind of access list,
11 > that specifies things like:
12 >
13 > - if accessing process is named P1, then direct it to X1.
14 > - if accessing process is named P2, then direct it to X2.
15 > - ...
16 > - if accessing process is named Pn, then direct it to Xn.
17 > - else, default to X0.
18
19 However, I have heard of something that might come close to what you
20 what I think you're asking about.
21
22 I've never heard of support for this in Linux. But I have heard of an
23 ability that /some/ other traditional Unixes have where a named sym-link
24 can point to a different file based on the contents of an environment
25 variable.
26
27 Think of it as something like this:
28
29 ln -s /usr/arch/$ARCH/bin /usr/bin
30
31 Thus
32
33 /usr/bin -> /usr/arch/x86/bin # on x86
34
35 -or-
36
37 /usr/bin -> /usr/arch/arm/bin # on ARM
38
39 Depending on what your architecture is and thus the value of the $ARCH
40 environment variable.
41
42 I /think/ this was done based on environment variables and / or
43 something else equally consistent in the kernel.
44
45 I have no idea what this type of link is called. But it is a well
46 established standard in the traditional Unix space. Though, I think
47 it's seldom used.
48
49 > i think if we have this, we can solve slotting in a simpler way.
50 > e.g. we install libs in their own non-conflicting locations, and
51 > then install for them such fancy sym links with access that routes
52 > accessing processes to the right version of the lib.
53
54 Interesting idea.
55
56 I'd need to know more about how the links are actually implemented and
57 more about slots to even fathom a guess if it would work. I'm sure it
58 would do something. I just can't say if we would like what it does or not.
59
60 I question if environment variables are what's used, mainly because of
61 the potential volatility of the environment; different interactive
62 shells, different ""shells in /etc/passwd (et al.) that bypass
63 interactive shells, remote commands, etc. I could envision how the
64 traditional environment variable might not behave as desired.
65
66 I also have concerns about the potential security implications of an end
67 user changing something in their interactive shell's environment, thus
68 altering where this type of link would point to.
69
70 > thoughts?
71
72 I would very much like to see this type of functionality come to Linux.
73 But I gave up hoping for it a long time ago.
74
75
76
77 --
78 Grant. . . .
79 unix || die
80
81
82
83
84
85 --
86 Grant. . . .
87 unix || die