-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
glibc: allow use ld-nix.so.conf #209753
base: staging
Are you sure you want to change the base?
glibc: allow use ld-nix.so.conf #209753
Conversation
Writing library paths into
Other nixpkgs mechanisms plagued by this are That usually causes libc load load failures of sorts with missing symbol errors (good, easy to diagnose). Worst case you get SIGSEGVs for simently broken ABI (bad, hard to debug). Things are a lot worse when programs load libraries a while after they start. Don't know if anything tries to load NSS as soon as possible at start. I would guess no, it's lazy. Otherwise every program in system would pay the cost of NSS. Would anything prevent |
No, this will be a big footgun, i don't think it's a good idea. |
I don't know so much about how glibc works. I was looking for a possible way to load the necessary modules for tcb to work. |
System-wide plugins are very hard in If we were to take your approach as is we would want to key path similar to It will still have corner cases, like missing entries when you run non-active glibc. But it's arguably not as bad as loading incompatible libraries. Would be nice to have an agreed design in this space. Your use case is a great example where it's badly needed. |
Which variable can be used to pull the path to package? |
This varaint not working: diff --git a/pkgs/development/libraries/glibc/common.nix b/pkgs/development/libraries/glibc/common.nix
index 80ff28c2b1e..3fccbfb3000 100644
--- a/pkgs/development/libraries/glibc/common.nix
+++ b/pkgs/development/libraries/glibc/common.nix
@@ -115,6 +115,9 @@ stdenv.mkDerivation ({
# Ensure that `__nss_files_fopen` can still be wrapped by `libredirect`.
sed -i -e '/libc_hidden_def (__nss_files_fopen)/d' nss/nss_files_fopen.c
sed -i -e '/libc_hidden_proto (__nss_files_fopen)/d' include/nss_files.h
+
+ substituteInPlace sysdeps/generic/dl-cache.h \
+ --replace '# define LD_SO_CACHE SYSCONFDIR "/ld.so.cache"' '# define LD_SO_CACHE "/etc/${lib.head (lib.splitString "-" (lib.elemAt (lib.splitString "/" "$out") 3))}/ld.so.cache"'
''
# FIXME: find a solution for infinite recursion in cross builds.
# For now it's hopefully acceptable that IDN from libc doesn't reliably work.
diff --git a/pkgs/development/libraries/glibc/dont-use-system-ld-so-cache.patch b/pkgs/development/libraries/glibc/dont-use-system-ld-so-cache.patch
index 0f852f6e632..40018de2769 100644
--- a/pkgs/development/libraries/glibc/dont-use-system-ld-so-cache.patch
+++ b/pkgs/development/libraries/glibc/dont-use-system-ld-so-cache.patch
@@ -36,16 +36,3 @@ index d29bdd69..c7124a65 100644
unsigned int index = 0;
static const char *system_dirs = SYSTEM_DIRS "\0";
-diff --git a/sysdeps/generic/dl-cache.h b/sysdeps/generic/dl-cache.h
-index df385dca..b907c214 100644
---- a/sysdeps/generic/dl-cache.h
-+++ b/sysdeps/generic/dl-cache.h
-@@ -35,7 +35,7 @@
- #endif
-
- #ifndef LD_SO_CACHE
--# define LD_SO_CACHE SYSCONFDIR "/ld.so.cache"
-+# define LD_SO_CACHE "/etc/ld-nix.so.cache"
- #endif
-
- #ifndef add_system_dir Error:
Is there another way or how to fix this variant? |
Instead of |
Weird, result with this variant
I thought there would be an variant:
This variant not working -
|
Also requires a method to locate the
|
89df0d5
to
e8d9684
Compare
I filed https://github.com/nixpkgs-architecture/issues/issues/15 to consider developing blessed way to handle plugins. |
How do you think about #248777 ? |
There is not enough free space on the virtual machine to rebuild the system and check. |
I'm not aware of a reasonable way of implementing plugins against immutable packages with uncontrolled locations. No insights in #295035 either. As there is no interest from others it sounds like you have to pave the path of designing something that works (which is not a great answer). |
Sent an email to [email protected]. Maybe they will suggest some solution. |
Description of changes
This PR allows libraries to be loaded via the `/etc/ld-nix.so.conf' configuration file. Loading of NSS modules is supported.
Example.
Add to nixos configuration:
Generate cache:
Checking loaded libraries:
cc @flokli @NickCao @SuperSandro2000 @trofi
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)nixos/doc/manual/md-to-db.sh
to update generated release notes