all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
blob f72f7329f62e1146830d2410f0d9c9d2c527534f 1576 bytes (raw)
name: gnu/packages/patches/shepherd-set-supplementary-groups.patch 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
 
diff --git a/modules/shepherd/service.scm b/modules/shepherd/service.scm
index bd7e379..74fed23 100644
--- a/modules/shepherd/service.scm
+++ b/modules/shepherd/service.scm
@@ -758,6 +758,28 @@ daemon writing FILE is running in a separate PID namespace."
               (try-again)
               (apply throw args)))))))
 
+(define (supplementary-gids user)
+  "Return a vector with the gid for each supplementary group USER belongs to.
+USER is the user name as a string."
+  ;; TODO: To find them, we loop through the group database, but maybe using
+  ;; glibc’s getgrouplist would be better.  But it is not exported from Guile
+  ;; and it seems it is not part of POSIX (?).
+  (list->vector
+   (delete-duplicates
+    (dynamic-wind
+        (lambda () (setgrent))
+        (lambda ()
+          (let loop ((supgids '()))
+            (let ((group (getgrent)))
+              (define (user-among-group? group)
+                (member user (group:mem group)))
+              (match group
+                     (#f supgids)
+                     ((? user-among-group?)
+                      (loop (cons (group:gid group) supgids)))
+                     (else (loop supgids))))))
+        (lambda () (endgrent))))))
+
 (define* (exec-command command
                        #:key
                        (user #f)
@@ -826,6 +848,7 @@ false."
      (when user
        (catch #t
          (lambda ()
+           (setgroups (supplementary-gids user))
            (setuid (passwd:uid (getpw user))))
          (lambda (key . args)
            (format (current-error-port)

debug log:

solving f72f7329f6 ...
found f72f7329f6 in https://yhetil.org/guix/20191204113239.immmcpixu2achory@pelzflorian.localdomain/

applying [1/1] https://yhetil.org/guix/20191204113239.immmcpixu2achory@pelzflorian.localdomain/
diff --git a/gnu/packages/patches/shepherd-set-supplementary-groups.patch b/gnu/packages/patches/shepherd-set-supplementary-groups.patch
new file mode 100644
index 0000000000..f72f7329f6

1:14: trailing whitespace.
 
Checking patch gnu/packages/patches/shepherd-set-supplementary-groups.patch...
Applied patch gnu/packages/patches/shepherd-set-supplementary-groups.patch cleanly.
warning: 1 line adds whitespace errors.

index at:
100644 f72f7329f62e1146830d2410f0d9c9d2c527534f	gnu/packages/patches/shepherd-set-supplementary-groups.patch

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.