Subject: [PATCH v2 07/10] build: Rename activate-setuid-programs.

From: Tobias Geerinckx-Rice <[email-masked]>
Date: Sun, 16 Jul 2023 01:59:57 +0200

* gnu/build/activation.scm (activate-setuid-programs): Rename this…
(activate-privileged-programs): …to this.
Operate on a list of <privileged-program> records.
* gnu/services.scm (setuid-program->activation-gexp): Adjust caller.
---
 gnu/build/activation.scm | 24 ++++++++++++------------
 gnu/services.scm         |  2 +-
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/gnu/build/activation.scm b/gnu/build/activation.scm
index 7f4800bba1..84fbeda162 100644
--- a/gnu/build/activation.scm
+++ b/gnu/build/activation.scm
@@ -27,7 +27,7 @@
 
 (define-module (gnu build activation)
   #:use-module (gnu system accounts)
-  #:use-module (gnu system setuid)
+  #:use-module (gnu system privilege)
   #:use-module (gnu build accounts)
   #:use-module (gnu build linux-boot)
   #:use-module (guix build utils)
@@ -41,7 +41,7 @@ (define-module (gnu build activation)
   #:export (activate-users+groups
             activate-user-home
             activate-etc
-            activate-setuid-programs
+            activate-privileged-programs
             activate-special-files
             activate-modprobe
             activate-firmware
@@ -287,8 +287,8 @@ (define %privileged-program-directory
   ;; Place where privileged copies of programs are stored.
   "/run/privileged/bin")
 
-(define (activate-setuid-programs programs)
-  "Turn PROGRAMS, a list of file setuid-programs records, into privileged
+(define (activate-privileged-programs programs)
+  "Turn PROGRAMS, a list of file privileged-programs records, into privileged
 copies stored under %PRIVILEGED-PROGRAM-DIRECTORY."
   (define (ensure-empty-directory directory)
     (if (file-exists? directory)
@@ -325,11 +325,11 @@ (define (activate-setuid-programs programs)
   (for-each (lambda (program)
               (catch 'system-error
                 (lambda ()
-                  (let* ((program-name (setuid-program-program program))
-                         (setuid?      (setuid-program-setuid? program))
-                         (setgid?      (setuid-program-setgid? program))
-                         (user         (setuid-program-user program))
-                         (group        (setuid-program-group program))
+                  (let* ((program-name (privileged-program-program program))
+                         (setuid?      (privileged-program-setuid? program))
+                         (setgid?      (privileged-program-setgid? program))
+                         (user         (privileged-program-user program))
+                         (group        (privileged-program-group program))
                          (uid (match user
                                 ((? string?) (passwd:uid (getpwnam user)))
                                 ((? integer?) user)))
@@ -339,13 +339,13 @@ (define (activate-setuid-programs programs)
                     (make-privileged-program program-name setuid? setgid? uid gid)
                     (make-deprecated-wrapper program-name)))
                 (lambda args
-                  ;; If we fail to create a setuid program, better keep going
+                  ;; If we fail to create a privileged program, better keep going
                   ;; so that we don't leave %PRIVILEGED-PROGRAM-DIRECTORY empty
                   ;; or half-populated.  This can happen if PROGRAMS contains
                   ;; incorrect file names: <https://bugs.gnu.org/38800>.
                   (format (current-error-port)
-                          "warning: failed to make ~s setuid/setgid: ~a~%"
-                          (setuid-program-program program)
+                          "warning: failed to privilege ~s: ~a~%"
+                          (privileged-program-program program)
                           (strerror (system-error-errno args))))))
             programs))
 
diff --git a/gnu/services.scm b/gnu/services.scm
index eefe58b336..91584e64ca 100644
--- a/gnu/services.scm
+++ b/gnu/services.scm
@@ -882,7 +882,7 @@ (define (setuid-program->activation-gexp programs)
       #~(begin
           (use-modules (gnu system setuid))
 
-          (activate-setuid-programs (list #$@programs))))))
+          (activate-privileged-programs (list #$@programs))))))
 
 (define setuid-program-service-type
   (service-type (name 'setuid-program)
-- 
2.41.0