From b70a26a7875e0d1106290d583ee34db7159bbf60 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Tue, 31 Jul 2018 21:52:42 +0100 Subject: Break match, with some added debugging. Runinng this gives me: ;;; ("FORK" 273) ;;; ("PID SHOULD BE 0") ;;; ("FORK" 0) ;;; ("PID SHOULD BE 0") [ 3.380838] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000000 --- gnu/services/version-control.scm | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/gnu/services/version-control.scm b/gnu/services/version-control.scm index 2afdf4a29f..1a4adf28c8 100644 --- a/gnu/services/version-control.scm +++ b/gnu/services/version-control.scm @@ -303,7 +303,8 @@ access to exported repositories under @file{/srv/git}." #$home "/" (basename (strip-store-file-name admin-pubkey))))) - (use-modules (guix build utils)) + (use-modules (ice-9 match) + (guix build utils)) (simple-format #t "guix: gitolite: installing ~A\n" #$rc-file) (copy-file #$rc-file #$(string-append home "/.gitolite.rc")) @@ -328,24 +329,25 @@ access to exported repositories under @file{/srv/git}." ;; admin pubkey if specified. The admin pubkey is required for ;; initial setup, and will replace the previous key if run after ;; initial setup - (let ((pid (primitive-fork))) - (if (eq? pid 0) - ;; Exit with a non-zero status code if an exception is thrown. - (dynamic-wind - (const #t) - (lambda () - (setenv "HOME" (passwd:dir user-info)) - (setenv "USER" #$user) - (setgid (passwd:gid user-info)) - (setuid (passwd:uid user-info)) - (primitive-exit - (system* #$(file-append package "/bin/gitolite") - "setup" - "-m" "gitolite setup by GNU Guix" - "-pk" pubkey-file))) - (lambda () - (primitive-exit 1))) - (waitpid pid))) + (match (peek "FORK" (primitive-fork)) + (0 + ;; Exit with a non-zero status code if an exception is thrown. + (dynamic-wind + (const #t) + (lambda () + (setenv "HOME" (passwd:dir user-info)) + (setenv "USER" #$user) + (setgid (passwd:gid user-info)) + (setuid (passwd:uid user-info)) + (peek "PID SHOULD BE 0") + (primitive-exit + (system* #$(file-append package "/bin/gitolite") + "setup" + "-m" "gitolite setup by GNU Guix" + "-pk" pubkey-file))) + (lambda () + (primitive-exit 1)))) + (pid (waitpid (peek "WAITING FOR PID ->" pid)))) (when (file-exists? pubkey-file) (delete-file pubkey-file)))))) -- cgit v1.2.3