tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: ld.elf_so(1): LD_PRELOAD



Le Tue, May 09, 2023 at 01:24:10PM +0300, Valery Ushakov a écrit :
> On Tue, May 09, 2023 at 11:12:39 +0200, tlaronde%polynum.com@localhost wrote:
> 
> > In the man page ld.elf_so(1), how is this to be interpreted:
> > 
> >    LD_PRELOAD   A colon or space separated list of shared object
> >                 filenames to be loaded after the main program but before
> >                 its shared object dependencies.  Space is allowed as a
> >                 separator for backwards compatibility only.  Support may
> >                 be removed in a future release and should not be relied
> >                 upon.
> > 
> > I mean precisely this sentence : "Support may be removed in a future
> > release and should not be relied upon."
> > 
> > Does it mean support for "space separated list" or support for the env
> > var LD_PRELOAD?
> 
> I think it's intended as the former, though I'm quite surpised we have
> been claiming for the last 20+ years that the space is deprecated.
> Solaris "Linkers and Libraries" only mentions space as a separator.
> 
> PS: Don't have time to RTFS right now, the "or" in "space or colon" is
> kinda misleading.  Is "a b:c" a list of (a, b, c), ("a b", "c") or
> ("a" "b:c")?

FWIW, answering to this one: load.c uses strsep(3) with " :", hence
meaning "a b:c" is (a, b, c).

Obviously, this does mean that one can not put spaces in dir names (I'm
NOT saying that one should; I'm only saying it is so) and that if, in
"LD_PRELOAD", one gives one or more dir with spaces in there, it will
not achieve the user expected result. (Guessing that it is perhaps why
the "support" for spaces was flagged as susceptible to disappear one
day.)
-- 
        Thierry Laronde <tlaronde +AT+ polynum +dot+ com>
                     http://www.kergis.com/
                    http://kertex.kergis.com/
Key fingerprint = 0FF7 E906 FBAF FE95 FD89  250D 52B1 AE95 6006 F40C


Home | Main Index | Thread Index | Old Index