activation: Fix ‘mkdir-p/perms’ on the Hurd.

Fixes <https://issues.guix.gnu.org/77992>.

Fixes a bug whereby ‘mkdir-p/perms’ would throw an exception on the
Hurd:

  In gnu/build/activation.scm:
      97:20  1 (mkdir-p/perms _ #("ludo" "x" 1000 998 "Ludovic…" …) …)
  In unknown file:
	     0 (open "." 7340032 #<undefined>)

  ERROR: In procedure open:
  In procedure scm_fdes_to_port: requested file mode not available on fdes

This, in turn, would cause ‘user-homes’ to fail to start on the Hurd
since commit da741d8931.

* gnu/build/activation.scm (mkdir-p/perms): Add O_RDONLY to ‘open-flags’.

Reported-by: Yelninei <yelninei@tutamail.com>
Change-Id: I74f90599338772ba4341067215b864273aa30b3e
This commit is contained in:
Ludovic Courtès 2025-04-23 10:50:17 +02:00
parent e042751c32
commit 27e62d4481
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2012-2021, 2025 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org> ;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
;;; Copyright © 2013 Andreas Enge <andreas@enge.fr> ;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
;;; Copyright © 2015, 2018 Mark H Weaver <mhw@netris.org> ;;; Copyright © 2015, 2018 Mark H Weaver <mhw@netris.org>
@ -90,6 +90,7 @@ and bits are set according to the default behaviour of 'mkdir'."
;; By combining O_NOFOLLOW and O_DIRECTORY, this procedure automatically ;; By combining O_NOFOLLOW and O_DIRECTORY, this procedure automatically
;; verifies that no components are symlinks. ;; verifies that no components are symlinks.
(define open-flags (logior O_CLOEXEC ; don't pass the port on to subprocesses (define open-flags (logior O_CLOEXEC ; don't pass the port on to subprocesses
O_RDONLY ;needed on the Hurd, harmless on Linux
O_NOFOLLOW ; don't follow symlinks O_NOFOLLOW ; don't follow symlinks
O_DIRECTORY)) ; reject anything not a directory O_DIRECTORY)) ; reject anything not a directory