On 11/10/19 9:37 PM, Caveman Al Toraboran wrote:
hi - is it possible to have some kind of fancy links that know the name of the process that is trying to access it, and based on its name, it links it to a file?

I've not heard of that specifically.

e.g. `ln -s X Y` will create link Y that always refers to X whenever anyone tries to access Y. but is it possible to have a fancier linking that creates a linking file that contains some kind of access list, that specifies things like:

- if accessing process is named P1, then direct it to X1.
- if accessing process is named P2, then direct it to X2.
- ...
- if accessing process is named Pn, then direct it to Xn.
- else, default to X0.

However, I have heard of something that might come close to what you what I think you're asking about.

I've never heard of support for this in Linux. But I have heard of an ability that /some/ other traditional Unixes have where a named sym-link can point to a different file based on the contents of an environment variable.

Think of it as something like this:

    ln -s /usr/arch/$ARCH/bin /usr/bin

Thus

    /usr/bin -> /usr/arch/x86/bin   # on x86

-or-

    /usr/bin -> /usr/arch/arm/bin   # on ARM

Depending on what your architecture is and thus the value of the $ARCH environment variable.

I /think/ this was done based on environment variables and / or something else equally consistent in the kernel.

I have no idea what this type of link is called. But it is a well established standard in the traditional Unix space. Though, I think it's seldom used.

i think if we have this, we can solve slotting in a simpler way. e.g. we install libs in their own non-conflicting locations, and then install for them such fancy sym links with access that routes accessing processes to the right version of the lib.

Interesting idea.

I'd need to know more about how the links are actually implemented and more about slots to even fathom a guess if it would work. I'm sure it would do something. I just can't say if we would like what it does or not.

I question if environment variables are what's used, mainly because of the potential volatility of the environment; different interactive shells, different ""shells in /etc/passwd (et al.) that bypass interactive shells, remote commands, etc. I could envision how the traditional environment variable might not behave as desired.

I also have concerns about the potential security implications of an end user changing something in their interactive shell's environment, thus altering where this type of link would point to.

thoughts?

I would very much like to see this type of functionality come to Linux. But I gave up hoping for it a long time ago.



--
Grant. . . .
unix || die





--
Grant. . . .
unix || die

Reply via email to