diff options
author | Farid Zakaria <fmzakari@google.com> | 2021-09-12 19:04:10 -0700 |
---|---|---|
committer | Farid Zakaria <fmzakari@google.com> | 2021-09-19 19:37:56 -0700 |
commit | 4687d7523bd068bcf0a87ed6ac4e4bfa6f7f4e11 (patch) | |
tree | b55edf905be767b63c2d9f330d43fcd829155d77 /doc/builders | |
parent | 86b4033b23d2cd892d11982ceb6337c5c3a9b362 (diff) |
glibc: add dependency on netbase /etc/protocols
Add an explicit dependency on netbase for /etc/protocols Certain functions in glibc look for files present in /etc such as getprotobyname which reads /etc/protocols. If you are using Nix over a Linux installation, this file may not be present, and therefore it will cause errors. - add netbase as a new package in nixpks - add a dependency in glibc on it using postPatchPhase and substitute the path Fixes #124401
Diffstat (limited to 'doc/builders')
-rw-r--r-- | doc/builders/packages/etc-files.section.md | 17 | ||||
-rw-r--r-- | doc/builders/packages/index.xml | 1 |
2 files changed, 18 insertions, 0 deletions
diff --git a/doc/builders/packages/etc-files.section.md b/doc/builders/packages/etc-files.section.md new file mode 100644 index 0000000000000..0b83793835911 --- /dev/null +++ b/doc/builders/packages/etc-files.section.md @@ -0,0 +1,17 @@ +# /etc files {#etc} + +Certain calls in glibc require access to runtime files found in /etc such as `/etc/protocols` or `/etc/services` -- [getprotobyname](https://linux.die.net/man/3/getprotobyname) is one such function. + +On non-NixOS distributions these files are typically provided by packages (i.e. [netbase](https://packages.debian.org/sid/netbase)) if not already pre-installed in your distribution. This can cause non-reproducibility for code if they rely on these files being present. + +If [iana-etc](https://hydra.nixos.org/job/nixos/trunk-combined/nixpkgs.iana-etc.x86_64-linux) is part of your _buildInputs_ then it will set the environment varaibles `NIX_ETC_PROTOCOLS` and `NIX_ETC_SERVICES` to the corresponding files in the package through a _setup-hook_. + +```bash +❯ nix-shell -p iana-etc + +[nix-shell:~]$ env | grep NIX_ETC +NIX_ETC_SERVICES=/nix/store/aj866hr8fad8flnggwdhrldm0g799ccz-iana-etc-20210225/etc/services +NIX_ETC_PROTOCOLS=/nix/store/aj866hr8fad8flnggwdhrldm0g799ccz-iana-etc-20210225/etc/protocols +``` + +Nixpkg's version of [glibc](https://hydra.nixos.org/job/nixos/trunk-combined/nixpkgs.glibc.x86_64-linux) has been patched to check for the existence of these environment variables. If the environment variable are *not set*, then it will attempt to find the files at the default location within _/etc_. diff --git a/doc/builders/packages/index.xml b/doc/builders/packages/index.xml index f5b05b0bbccfc..206e1e49f1f85 100644 --- a/doc/builders/packages/index.xml +++ b/doc/builders/packages/index.xml @@ -17,6 +17,7 @@ <xi:include href="kakoune.section.xml" /> <xi:include href="linux.section.xml" /> <xi:include href="locales.section.xml" /> + <xi:include href="etc-files.section.xml" /> <xi:include href="nginx.section.xml" /> <xi:include href="opengl.section.xml" /> <xi:include href="shell-helpers.section.xml" /> |