You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using libredirect on non-NixOS distro, e.g. Debian 9, LD_PRELOAD is propagated, so if wrapped application runs some system binary, there is an error:
sh: relocation error: /nix/store/sgjc1147vi5hd57ck9xgck5xjkydg5lz-glibc-2.25/lib/libdl.so.2: symbol _dl_catch_error, version GLIBC_PRIVATE not defined in file libc.so.6 with link time reference
I suppose this depends on the particular use case. I can imagine you to want to "sandbox" all child processes as well, because they are e.g. just parts of the same application.
For maximal flexibility, there could e.g. be a build-time parameter to libredirect – a list of paths, and it would deactivate itself when in a process outside those subtrees. But it seems useless to implement such a sledge-hammer until we know at least some particular use case.
There have been occassional complaints on IRC about the Teamspeak client (which uses libredirect) being unable to open links in Chromium because the inherited libredirect causes Chromium to crash.
sort: relocation error: /nix/store/bwax7l3946zn3l806727sd1fk8ssjgpv-glibc-2.25-49/lib/libdl.so.2: symbol _dl_catch_error, version GLIBC_PRIVATE not defined in file libc.so.6 with link time reference
ctags: cannot sort tag file : No such file or directory
I've worked around this issue by installing nixpkgs.coreutils, to get the sort command from nixpkgs.
It might be worth asking the glibc people if they'd be willing to have an option like ${glibc}/lib/ld-linux.so.2 --preload implemented in the dynamic linker similar to the --library-path option they have. Then instead of adding an environment variable, makeWrapper could prefix the command with an explicit call to the linker.
(I don't know offhand if this would break other things by e.g. affecting argv[0] or /proc/self/exe...)
Activity
vcunat commentedon Sep 7, 2017
That confuses me a bit. I thought the main point of libredirect is to avoid using LD_PRELOAD.vcunat commentedon Sep 7, 2017
I'm sorry, I confused those :-/
It certainly is possible to add a new variable for this. I wonder if it's a good idea; I don't see any caveats yet.
Mic92 commentedon Sep 7, 2017
One way to avoid this, is to unset LD_LIBRARY in the libredirect code.
So it will be only used by the actual process will pick it up.
dezgeg commentedon Sep 7, 2017
Well, it's a problem on NixOS as well that the redirect leaks to all possible child processes.
Maybe libredirect could remove itself from LD_PRELOAD on startup.
vcunat commentedon Sep 7, 2017
I suppose this depends on the particular use case. I can imagine you to want to "sandbox" all child processes as well, because they are e.g. just parts of the same application.
vcunat commentedon Sep 7, 2017
For maximal flexibility, there could e.g. be a build-time parameter to libredirect – a list of paths, and it would deactivate itself when in a process outside those subtrees. But it seems useless to implement such a sledge-hammer until we know at least some particular use case.
dezgeg commentedon Sep 7, 2017
There have been occassional complaints on IRC about the Teamspeak client (which uses libredirect) being unable to open links in Chromium because the inherited libredirect causes Chromium to crash.
knedlsepp commentedon Sep 27, 2017
Currently having this problem as well:
sublime3andctags.CTagspackage inside sublime.I've worked around this issue by installing
nixpkgs.coreutils, to get thesortcommand fromnixpkgs.Mic92 commentedon Sep 27, 2017
I just tested and
unsetenv("LD_PRELOAD");does not work reliable: https://stackoverflow.com/questions/3275015/ld-preload-affects-new-child-even-after-unsetenvld-preloadMaybe wrapping
execand do the cleanup should work.dezgeg commentedon Sep 27, 2017
It might be worth asking the glibc people if they'd be willing to have an option like
${glibc}/lib/ld-linux.so.2 --preloadimplemented in the dynamic linker similar to the--library-pathoption they have. Then instead of adding an environment variable,makeWrappercould prefix the command with an explicit call to the linker.(I don't know offhand if this would break other things by e.g. affecting
argv[0]or/proc/self/exe...)lf- commentedon Aug 19, 2021
If anyone is hitting this with Haskell
stackon non-NixOS distros, just use the nix integration for Stack:Put:
in your
~/.stack/config.yamlor project specificstack.yamland you're done.