diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2022-09-20 19:20:53 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2022-09-20 19:24:31 +0200 |
| commit | 6abdcef4a68e98f538ab69fde096adc5f5ca4ff4 (patch) | |
| tree | 3a1937cce88b6efc8883ebfe154c27427ac44633 /gnu/build | |
| parent | 76c58ed59c05fa2ae14281109c9186e47ba810da (diff) | |
linux-container: 'container-excursion*' marks its FDs as FD_CLOEXEC.
Fixes <https://issues.guix.gnu.org/57827>.
Reported by Mathieu Othacehe <othacehe@gnu.org>.
Fixes a regression introduced with the Shepherd 0.9.2 upgrade in
1ba0e38267c9ff8bb476285091be6e297bbf136e, whereby IN and OUT would no
longer be closed when 'fork+exec-command/container' would call
'exec-command*' as part of the THUNK passed to 'container-excursion*'.
This is because the Shepherd 0.9.2 assumes file descriptors are properly
marked as O_CLOEXEC and, consequently, 'exec-command' no longer run the
close(2) loop prior to 'exec'.
* gnu/build/linux-container.scm (container-excursion*): Add calls to
'fcntl'.
Diffstat (limited to 'gnu/build')
| -rw-r--r-- | gnu/build/linux-container.scm | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/gnu/build/linux-container.scm b/gnu/build/linux-container.scm index a0c81747218..73db1279747 100644 --- a/gnu/build/linux-container.scm +++ b/gnu/build/linux-container.scm | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2015 David Thompson <davet@gnu.org> | 2 | ;;; Copyright © 2015 David Thompson <davet@gnu.org> |
| 3 | ;;; Copyright © 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org> | 3 | ;;; Copyright © 2017-2019, 2022 Ludovic Courtès <ludo@gnu.org> |
| 4 | ;;; | 4 | ;;; |
| 5 | ;;; This file is part of GNU Guix. | 5 | ;;; This file is part of GNU Guix. |
| 6 | ;;; | 6 | ;;; |
| @@ -442,6 +442,10 @@ return the exit status." | |||
| 442 | "Like 'container-excursion', but return the return value of THUNK." | 442 | "Like 'container-excursion', but return the return value of THUNK." |
| 443 | (match (pipe) | 443 | (match (pipe) |
| 444 | ((in . out) | 444 | ((in . out) |
| 445 | ;; Make sure IN and OUT are not inherited if THUNK forks + execs. | ||
| 446 | (fcntl in F_SETFD FD_CLOEXEC) | ||
| 447 | (fcntl out F_SETFD FD_CLOEXEC) | ||
| 448 | |||
| 445 | (match (container-excursion pid | 449 | (match (container-excursion pid |
| 446 | (lambda () | 450 | (lambda () |
| 447 | (close-port in) | 451 | (close-port in) |
