diff options
| author | Reepca Russelstein <reepca@russelstein.xyz> | 2026-02-15 12:39:34 -0600 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2026-02-27 23:54:00 +0100 |
| commit | 865cb0188c282726008c56319a853c7dd82c4057 (patch) | |
| tree | a6d6fa69b00786b734d7a2a704e19794c1984594 /tests | |
| parent | a1611ced6de6e58ec77641281a49ed368d7d8cef (diff) | |
daemon: Actually remove unreadable directories.
Fixes a regression introduced in 7173c2c0ca. Additional discussion at
https://codeberg.org/guix/guix/pulls/5977.
* nix/libutil/util.cc (_deletePathAt): chmod directory and retry open when it
fails with EACCES. Do this using an O_PATH file descriptor referenced via
/proc/self/fd whenever possible to avoid it being replaced by a
non-directory immediately before being chmod'ed.
* nix/libutil/util.hh (deletePath): document TOCTTOU race on non-linux systems
where hardlinks aren't protected.
* tests/derivations.scm ("unreadable directories in build tree can be
removed"): new test.
Fixes: guix/guix#5891
Reported-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
Change-Id: I749127fe5254ebabc8387a2f0ef47e3c116bfcc5
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Merges: #6460
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/derivations.scm | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/derivations.scm b/tests/derivations.scm index d4cca0f6058..b0d74ca50d1 100644 --- a/tests/derivations.scm +++ b/tests/derivations.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012-2025 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2012-2026 Ludovic Courtès <ludo@gnu.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -967,6 +967,20 @@ (build-derivations %store (list drv)) #f))) +(test-assert "unreadable directories in build tree can be removed" + ;; Unreadable directories created in the build tree should be removed + ;; without problem. See <https://codeberg.org/guix/guix/issues/5891>. + (let* ((drv (build-expression->derivation + %store + (string-append (number->string (random (expt 2 64) (%seed)) + 16) + "-unreadable-test") + '(begin + (mkdir "unreadable" #o000) + (mkdir %output))))) + (build-derivations %store (list drv)) + (file-is-directory? (derivation->output-path drv)))) + (define %coreutils (false-if-exception |
