lix/src
Eelco Dolstra c536e00c9d Move pseudoterminal slave open to child
Hopefully this fixes "unexpected EOF" failures on macOS
(#3137, #3605, #7242, #7702).

The problem appears to be that under some circumstances, macOS
discards the output written to the slave side of the
pseudoterminal. Hence the parent never sees the "sandbox initialized"
message from the child, even though it succeeded. The conditions are:

* The child finishes very quickly. That's why this bug is likely to
  trigger in nix-env tests, since that uses a builtin builder. Adding
  a short sleep before the child exits makes the problem go away.

* The parent has closed its duplicate of the slave file
  descriptor. This shouldn't matter, since the child has a duplicate
  as well, but it does. E.g. moving the close to the bottom of
  startBuilder() makes the problem go away. However, that's not a
  solution because it would make Nix hang if the child dies before
  sending the "sandbox initialized" message.

* The system is under high load. E.g. "make installcheck -j16" makes
  the issue pretty reproducible, while it's very rare under "make
  installcheck -j1".

As a fix/workaround, we now open the pseudoterminal slave in the
child, rather than the parent. This removes the second condition
(i.e. the parent no longer needs to close the slave fd) and I haven't
been able to reproduce the "unexpected EOF" with this.
2023-03-15 10:58:37 +01:00
..
build-remote Remove FormatOrString and remaining uses of format() 2023-03-02 15:57:54 +01:00
libcmd Fix uninitialized readFromStdIn variable 2023-03-08 13:53:20 +01:00
libexpr Revert "Disable GC during coroutine execution + test" 2023-03-08 20:47:52 +01:00
libfetchers Merge pull request #7854 from aameen-tulip/patch-1 2023-03-01 18:24:53 +01:00
libmain Merge pull request #7889 from sidkshatriya/sorted-fetch-paths 2023-03-07 11:58:10 +01:00
libstore Move pseudoterminal slave open to child 2023-03-15 10:58:37 +01:00
libutil Simplify commonChildInit() 2023-03-14 18:58:12 +01:00
nix print-dev-env: stop inadvertently adding . to PATH 2023-03-12 22:40:47 +11:00
nix-build Remove FormatOrString and remaining uses of format() 2023-03-02 15:57:54 +01:00
nix-channel A setting to follow XDG Base Directory standard 2023-02-10 20:14:06 +04:00
nix-collect-garbage Fix nix-collect-garbage -d with the new profile location 2023-03-07 13:08:04 +01:00
nix-copy-closure Remove FormatOrString and remaining uses of format() 2023-03-02 15:57:54 +01:00
nix-env Remove FormatOrString and remaining uses of format() 2023-03-02 15:57:54 +01:00
nix-instantiate Revert to copyStore = true for nix-instantiate and nix-env 2022-08-23 14:40:27 +02:00
nix-store Fix another uninitialized variable 2023-03-09 15:30:53 +01:00
resolve-system-dependencies Remove FormatOrString and remaining uses of format() 2023-03-02 15:57:54 +01:00
toml11 Replace cpptoml with toml11 2021-12-17 22:03:33 +01:00