[PATCH shepherd]: Update required guile version, and remove some hacks

  • Done
  • quality assurance status badge
Details
3 participants
  • Carlo Zancanaro
  • Leo Famulari
  • Ludovic Courtès
Owner
unassigned
Submitted by
Carlo Zancanaro
Severity
normal
C
C
Carlo Zancanaro wrote on 26 Mar 2018 13:55
(address . guix-patches@gnu.org)
87lgefuk4o.fsf@zancanaro.id.au
These patches bring the Shepherd's Guile dependencies in line with
Guix, and remove some hacks that were required for old Guile
problems.

I'm not very familiar with autotools, but I think I got the
configure incantation right (I stole it from Guix).
From 8c812534137a5dc17dd8073706983c451d26f2db Mon Sep 17 00:00:00 2001
From: Carlo Zancanaro <carlo@zancanaro.id.au>
Date: Mon, 26 Mar 2018 14:44:18 +1100
Subject: [PATCH 1/3] Update Guile dependency to 2.0.13 or later

* README (Requirements): Change 2.x to 2.0.13 or later.
* configure.ac: Check for 2.0.13 or later if Guile 2.0 is detected.
---
README | 7 ++++---
configure.ac | 4 ++++
2 files changed, 8 insertions(+), 3 deletions(-)

Toggle diff (35 lines)
diff --git a/README b/README
index 88613aa..1237e2c 100644
--- a/README
+++ b/README
@@ -16,9 +16,10 @@ daemon-managing daemon.
** Requirements
This program requires Guile (the GNU Ubiquitous Intelligent Language
-for Extension), version 2.x. It uses GOOPS, but as GOOPS is part of
-Guile, a normal Guile installation is sufficient. It also uses
-readline, though it does not really depend on it.
+for Extension), version 2.0.13 or later (including 2.2.x). It uses
+GOOPS, but as GOOPS is part of Guile, a normal Guile installation is
+sufficient. It also uses readline, though it does not really depend
+on it.
GNU Make is required to build the Shepherd.
diff --git a/configure.ac b/configure.ac
index d768885..9d8c2aa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -27,6 +27,10 @@ GUILE_PKG([2.2 2.0])
dnl Checks for programs.
GUILE_PROGS
+if test "x$GUILE_EFFECTIVE_VERSION" = "x2.0"; then
+ PKG_CHECK_MODULES([GUILE], [guile-2.0 >= 2.0.13])
+fi
+
guilemoduledir="${datarootdir}/guile/site/$GUILE_EFFECTIVE_VERSION"
guileobjectdir="${libdir}/guile/$GUILE_EFFECTIVE_VERSION/site-ccache"
AC_SUBST([guilemoduledir])
--
2.16.2
From e11708aba0fbafd4c83273ee1fa5147e54d1c80e Mon Sep 17 00:00:00 2001
From: Carlo Zancanaro <carlo@zancanaro.id.au>
Date: Mon, 26 Mar 2018 14:49:18 +1100
Subject: [PATCH 2/3] Remove EINTR-safe, and all references to it.

* modules/shepherd/support.scm (EINTR-safe): Remove procedure and its export.
* modules/shepherd/service.scm (system*, system*): Remove now-unnecessary
procedures.
(waitpid*): Remove references to EINTR-safe.
* modules/shepherd.scm (main): Remove references to EINTR-safe.
---
modules/shepherd.scm | 7 +------
modules/shepherd/service.scm | 35 +++++++++++++----------------------
modules/shepherd/support.scm | 14 --------------
3 files changed, 14 insertions(+), 42 deletions(-)

Toggle diff (105 lines)
diff --git a/modules/shepherd.scm b/modules/shepherd.scm
index fede338..5d97598 100644
--- a/modules/shepherd.scm
+++ b/modules/shepherd.scm
@@ -241,12 +241,7 @@
;; Get commands from the standard input port.
(process-textual-commands (current-input-port))
;; Process the data arriving at a socket.
- (let ((sock (open-server-socket socket-file))
-
- ;; With Guile <= 2.0.9, we can get a system-error exception for
- ;; EINTR, which happens anytime we receive a signal, such as
- ;; SIGCHLD. Thus, wrap the 'accept' call.
- (accept (EINTR-safe accept)))
+ (let ((sock (open-server-socket socket-file)))
;; Possibly write out our PID, which means we're ready to accept
;; connections. XXX: What if we daemonized already?
diff --git a/modules/shepherd/service.scm b/modules/shepherd/service.scm
index 7b062a1..93d3779 100644
--- a/modules/shepherd/service.scm
+++ b/modules/shepherd/service.scm
@@ -590,13 +590,6 @@ results."
(apply action service the-action args))
which-services))))
-;; EINTR-safe versions of 'system' and 'system*'.
-
-(define system*
- (EINTR-safe (@ (guile) system*)))
-
-(define system
- (EINTR-safe (@ (guile) system)))
@@ -981,21 +974,19 @@ returned in unspecified."
(hashq-ref %services name '()))
(define waitpid*
- (let ((waitpid (EINTR-safe waitpid)))
- (lambda (what flags)
- "Like 'waitpid', but EINTR-safe, and return (0 . _) when there's no
-child left."
- (catch 'system-error
- (lambda ()
- (waitpid what flags))
- (lambda args
- ;; Did we get ECHILD or something? If we did, that's a problem,
- ;; because this procedure is supposed to be called only upon
- ;; SIGCHLD.
- (let ((errno (system-error-errno args)))
- (local-output "warning: 'waitpid' ~a failed unexpectedly: ~a"
- what (strerror errno))
- '(0 . #f)))))))
+ (lambda (what flags)
+ "Like 'waitpid', and return (0 . _) when there's no child left."
+ (catch 'system-error
+ (lambda ()
+ (waitpid what flags))
+ (lambda args
+ ;; Did we get ECHILD or something? If we did, that's a problem,
+ ;; because this procedure is supposed to be called only upon
+ ;; SIGCHLD.
+ (let ((errno (system-error-errno args)))
+ (local-output "warning: 'waitpid' ~a failed unexpectedly: ~a"
+ what (strerror errno))
+ '(0 . #f))))))
(define (handle-SIGCHLD signum)
"Handle SIGCHLD, possibly by respawning the service that just died, or
diff --git a/modules/shepherd/support.scm b/modules/shepherd/support.scm
index 380866e..9f02719 100644
--- a/modules/shepherd/support.scm
+++ b/modules/shepherd/support.scm
@@ -30,7 +30,6 @@
catch-system-error
with-system-error-handling
- EINTR-safe
with-atomic-file-output
mkdir-p
with-directory-excursion
@@ -127,19 +126,6 @@ turned into user error messages."
(lambda ()
body ...)))
-(define (EINTR-safe proc)
- "Wrap PROC so that if a 'system-error' exception with EINTR is raised (that
-was possible up to Guile 2.0.9 included) the call to PROC is restarted."
- (lambda args
- (let loop ()
- (catch 'system-error
- (lambda ()
- (apply proc args))
- (lambda args
- (if (= EINTR (system-error-errno args))
- (loop)
- (apply throw args)))))))
-
(define (with-atomic-file-output file proc) ;copied from Guix
"Call PROC with an output port for the file that is going to replace FILE.
Upon success, FILE is atomically replaced by what has been written to the
--
2.16.2
From 63bc9339d88d8f1bd8a9b366774ce8e33d76dd00 Mon Sep 17 00:00:00 2001
From: Carlo Zancanaro <carlo@zancanaro.id.au>
Date: Mon, 26 Mar 2018 14:55:32 +1100
Subject: [PATCH 3/3] Remove SIGALRM hack.

* modules/shepherd.scm (main): Remove SIGALRM hack for guile <= 2.0.9.
---
modules/shepherd.scm | 9 ---------
1 file changed, 9 deletions(-)

Toggle diff (22 lines)
diff --git a/modules/shepherd.scm b/modules/shepherd.scm
index 5d97598..69fd69d 100644
--- a/modules/shepherd.scm
+++ b/modules/shepherd.scm
@@ -207,15 +207,6 @@
(apply format #f (gettext (cadr args)) (caddr args))
(quit 1))))
- (when (provided? 'threads)
- ;; XXX: This terrible hack allows us to make sure that signal handlers
- ;; get a chance to run in a timely fashion. Without it, after an EINTR,
- ;; we could restart the accept(2) call below before the corresponding
- ;; async has been queued. See the thread at
- ;; <https://lists.gnu.org/archive/html/guile-devel/2013-07/msg00004.html>.
- (sigaction SIGALRM (lambda _ (alarm 1)))
- (alarm 1))
-
;; Stop everything when we get SIGINT. When running as PID 1, that means
;; rebooting; this is what happens when pressing ctrl-alt-del, see
;; ctrlaltdel(8).
--
2.16.2
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEE1lpncq7JnOkt+LaeqdyPv9awIbwFAlq435cACgkQqdyPv9aw
IbzM3BAAn0w/UcEcrJV7Du8/VsBr+8N47RMfMJBXAEq5GmnqDOJlWrbJ8BoqgQnA
dcL71fcFtr04XS2cjZr3+Rgxp93XBUzH3z2K38FIY5f5geYr0JHuXV4/JIMY+5Ik
ehByTgCFjb4jw1mTmHx199biEpM1LlKmK/ijEczOEUcQZectvzLsQAgDdooNaffC
9xAEBfZWOGBfCx/2ebIq+d1OSJibcdJpoSxmksVkzcGBn/vNgMulZHavIGayR0Xt
BXFA01y/ttOHkTC64yLhN74fI2UZ3nhFdWdnNFnzIDBQmrIaWFJSalwW0mGAfVuR
Rbb5ZOpvONxeLbKZt5t4IIHnFgO4C+GfWmuA36rktpIWU5ETXXlnsKXovMANksUg
1vN4j8RTmI5wQ9yXyBdBWpLjNOAXiku/VfZRvAuRSALLNNv6YiMVE8RdDY+qYXNb
LGVKrFGUqKF8vsva2rgl+DN07Dczy4MGNcNv056INx/cmUgMVR8qCd/YCdwfWtKx
za3v9FSFCfA2+95eeTKpvWiC4FV2K2Pg6rIBdsNXJiKF/FcB9TaOJu9X3t17PQ/R
yNzpyS2CXt3CKDOeJOVrDWzpKEHJC0szw0/OFdZe0H4QZ7tNatKcNiE27z6kMWH9
eUID2yUyNFwc1Pz3AJq9WWJ9ZMrzJZWXhOt/iVtZnwPtExtbZWM=
=VkiZ
-----END PGP SIGNATURE-----

L
L
Ludovic Courtès wrote on 29 Mar 2018 22:14
(name . Carlo Zancanaro)(address . carlo@zancanaro.id.au)(address . 30950@debbugs.gnu.org)
87605evdva.fsf@gnu.org
Hello!

Carlo Zancanaro <carlo@zancanaro.id.au> skribis:

Toggle quote (3 lines)
> I'm not very familiar with autotools, but I think I got the configure
> incantation right (I stole it from Guix).

Well done. :-)

Toggle quote (8 lines)
> From 8c812534137a5dc17dd8073706983c451d26f2db Mon Sep 17 00:00:00 2001
> From: Carlo Zancanaro <carlo@zancanaro.id.au>
> Date: Mon, 26 Mar 2018 14:44:18 +1100
> Subject: [PATCH 1/3] Update Guile dependency to 2.0.13 or later
>
> * README (Requirements): Change 2.x to 2.0.13 or later.
> * configure.ac: Check for 2.0.13 or later if Guile 2.0 is detected.

LGTM.

Toggle quote (11 lines)
> From e11708aba0fbafd4c83273ee1fa5147e54d1c80e Mon Sep 17 00:00:00 2001
> From: Carlo Zancanaro <carlo@zancanaro.id.au>
> Date: Mon, 26 Mar 2018 14:49:18 +1100
> Subject: [PATCH 2/3] Remove EINTR-safe, and all references to it.
>
> * modules/shepherd/support.scm (EINTR-safe): Remove procedure and its export.
> * modules/shepherd/service.scm (system*, system*): Remove now-unnecessary
> procedures.
> (waitpid*): Remove references to EINTR-safe.
> * modules/shepherd.scm (main): Remove references to EINTR-safe.

LGTM.

Toggle quote (27 lines)
> From 63bc9339d88d8f1bd8a9b366774ce8e33d76dd00 Mon Sep 17 00:00:00 2001
> From: Carlo Zancanaro <carlo@zancanaro.id.au>
> Date: Mon, 26 Mar 2018 14:55:32 +1100
> Subject: [PATCH 3/3] Remove SIGALRM hack.
>
> * modules/shepherd.scm (main): Remove SIGALRM hack for guile <= 2.0.9.
> ---
> modules/shepherd.scm | 9 ---------
> 1 file changed, 9 deletions(-)
>
> diff --git a/modules/shepherd.scm b/modules/shepherd.scm
> index 5d97598..69fd69d 100644
> --- a/modules/shepherd.scm
> +++ b/modules/shepherd.scm
> @@ -207,15 +207,6 @@
> (apply format #f (gettext (cadr args)) (caddr args))
> (quit 1))))
>
> - (when (provided? 'threads)
> - ;; XXX: This terrible hack allows us to make sure that signal handlers
> - ;; get a chance to run in a timely fashion. Without it, after an EINTR,
> - ;; we could restart the accept(2) call below before the corresponding
> - ;; async has been queued. See the thread at
> - ;; <https://lists.gnu.org/archive/html/guile-devel/2013-07/msg00004.html>.
> - (sigaction SIGALRM (lambda _ (alarm 1)))
> - (alarm 1))

Unfortunately I think the problem remains. That’s one of the reasons
for using signalfd(2).

Can you create an account on Savannah so I can add you to the group and
let you push the first two patches? :-)

Thank you!

Ludo’.
L
L
Leo Famulari wrote on 29 Mar 2018 22:31
(name . Ludovic Courtès)(address . ludo@gnu.org)
20180329203125.GA19903@jasmine.lan
On Thu, Mar 29, 2018 at 10:14:01PM +0200, Ludovic Courtès wrote:
Toggle quote (3 lines)
> Can you create an account on Savannah so I can add you to the group and
> let you push the first two patches? :-)

Welcome! Please make sure to read the HACKING file in our Git repo :)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEsFFZSPHn08G5gDigJkb6MLrKfwgFAlq9TRwACgkQJkb6MLrK
fwhsjA/+MMx3znf5pBZegVOCM3eOXBnwD1QEJ0TL4OzJMeLiZuuxjcNqDP1LRTDj
bTyz30pXggdou4qJAxAHxjY6KBjsBUzbPU2g8xGrPNunTCLe/PO5IFpWdqSmiuQC
hDySK3H6TScULTunidCa/AajjRU2uZSIWtZZGSZ0SE6HqQL38WjNS4Vho/d3dyRJ
P/MTISzD+Se9Cg16RAPTSBgxnXwUKRX+yYY72GQii2nJjxz8fPaX1TqKYIsKAyCN
Y9G6mN23kuJeYIn2HXxJfbwJkHK4yg/3yX9zmNHIHEiGJNY8ibZMsQtfATy2uZ9D
B4C5jo4O2icDbcCjJD0aEk3RO54VCxe7by7OOUIhsmI3Qn2AKxFo/x+PauIsXImU
+BuxxAteD7sqDNZIwyUd2HVruEvUH81QZJi1yL4ah3jgdVHIkH8PtwIBcfrSXUk9
e60URunQO8emPgxBnpGRe0eVzgg/JmXHwiBH4fgPMgmHYUAfFQB+nRU+QN/I1ADV
I8UbRAK/8jWxHUhWbKxBFZ72zcWzJQgaihDWMjaFNAm1n+lKg677cIhZAKAcqbAk
aYig8j9AKaraYGmTetxmNgEioz2m9i5freydVXs5/ohSgdJ3DugyjG8vcKNfEThe
VSnbgUsFvhTjC80X6aBPM0crxrfvejJk3XQBnE47+TIRlthTFeY=
=0gV3
-----END PGP SIGNATURE-----


C
C
Carlo Zancanaro wrote on 29 Mar 2018 23:27
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 30950@debbugs.gnu.org)
87r2o2d12q.fsf@zancanaro.id.au
On Thu, Mar 29 2018, Ludovic Courtès wrote:
Toggle quote (3 lines)
> Can you create an account on Savannah so I can add you to the
> group and let you push the first two patches? :-)

I'm working on this. Something has gone wrong, and now I can't
activate my account (because apparently I have the password
wrong), and I can't reset my password (because my account isn't
activated yet). I'll let you know when I get it sorted out.

Carlo
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEE1lpncq7JnOkt+LaeqdyPv9awIbwFAlq9Wk4ACgkQqdyPv9aw
IbxZABAAqmYhNN3+e6zXjF7FsHx9WWj1TFGFvFSj5TB8GBHHax7j7h+8uzqVzqgz
lazpCAzzGlksf0kxx+HOYfZOPgrBSSZGw9Ez34QiI90mWhuBOXcM5lIpYfUp9IAG
hQOkRHPDMc4ac+SBUwEIvaewQJ8JjpVTDrDLclPKGcDNuNAQlCpX/MCpb5rsJG90
bNRKGDyOE3Q7pvVSZGcHjL+c3ounNX3b6UNuafVDGs6ZFvmq+3rY4nsTKpk7i6PU
707d+jv8uikBllPRj27mMG14tFYbvoBymuKsJDqGDeIVjY5V4wSBzLzYxVpHg41A
cMqw2PEV5aefa506k7ngtVf18J/CiUUIjCbJw+1eEfEPIk7sDFgN1yIJ3FC7FA54
9c0kMS7jE5wnUoRFWHxvvjCS5Oz4z4Yg4O5sOAbO/3NIfuCbb29yiNTYCAZFK63d
Yniqol+9uKak7gj32+LkP6P1axFl6+IybHJA2/JGc7SdRm/u0/F6BHG6NbJobBrn
dq2Uw/4VUUH3bxRUcsujSSVkbMUx9meEc5606kUjFGkxE0T4vdxOQ+zy/9v5MSkz
YswfH1p2FSU+OHhpTn7hVkpoGv3Fdicy+pHXUTt/k4L3KHmJa10WDM9LX0JcZeq3
1Hn4106DpZKCMOjOF/Mt1QsOiKAMSoUeYrp3SbgxM2QCNWc2I+8=
=hIjX
-----END PGP SIGNATURE-----

C
C
Carlo Zancanaro wrote on 29 Mar 2018 23:36
(name . Leo Famulari)(address . leo@famulari.name)
87po3md0nv.fsf@zancanaro.id.au
On Thu, Mar 29 2018, Leo Famulari wrote:
Toggle quote (3 lines)
> Welcome! Please make sure to read the HACKING file in our Git
> repo :)

Does the Guix HACKING file apply to the Shepherd, too? In
particular, it doesn't look like commits on the Shepherd are
signed?

Carlo
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEE1lpncq7JnOkt+LaeqdyPv9awIbwFAlq9XGQACgkQqdyPv9aw
IbxdvhAAupaMUYUBFMC6X9mO5cPbvz/X77DsjyshQlJiCipOA0cJjInMIuHdVwdK
GBABvJqyd9TNGul67yF6D/vecYdzfuW4l96nQsvgo+D6Z/ydG0WqqS7ZQWwURYEv
klS+R7mjz7NoGFpM1I/3A4rZ9QldX/oeAYWNwiuhEFC3UEuzUepVJXQ7MTbZ2lkp
7Gn8MbHzZMi99XfcyjUa069QZDrC03Z85V+j7W/2eKGuYNYHslFLE44rVwP+ceHb
6xORsfdzxYq8xVl9a5gxHXxyFNEcFNiKn00x3exlYDkSKAHQSTs8sKK0tfW7ZCUy
1Hvdk+jZd28UdC7AJ5AUVPustzH+k5dFJ6V/dfYVHgsS/QLslifMxDBpXAjsOzDm
rXjo0Wewsx7ETZM4Z5GMSgWyOGW7IhHk2t8zRWFlGeVDmtWOEi0iMo0PXMbWuSsA
sQNi74Y2x5PDL5DIPoPqtyjLjenIx2MKwbEfWc5ZFWSDCj1aOpLR0kxkKGpAQC3k
9z732t9Petl3ejpMtSy4GWgGakljTK6XLZLXbvGpjxoyc9gCyI0ItO2YMD+9JoxF
vk6IjT51LARSc3/XkLUy431bCBEoTKCFFyUKvEv6bjo4tbrc4Gyt3IF7PuvvFcbX
ThLVb3Z5W5GVTc9mgFBTN87MUMIdvUw/6v3vq1Rg8jBiOF+5f6A=
=2fkd
-----END PGP SIGNATURE-----

L
L
Ludovic Courtès wrote on 30 Mar 2018 10:09
(name . Carlo Zancanaro)(address . carlo@zancanaro.id.au)
87bmf6q91f.fsf@gnu.org
Hello,

Carlo Zancanaro <carlo@zancanaro.id.au> skribis:

Toggle quote (6 lines)
> On Thu, Mar 29 2018, Leo Famulari wrote:
>> Welcome! Please make sure to read the HACKING file in our Git repo
>> :)
>
> Does the Guix HACKING file apply to the Shepherd, too?

Yeah, I think we should follow the same rules, roughly.

Toggle quote (3 lines)
> In particular, it doesn't look like commits on the Shepherd are
> signed?

Indeed, now’s the time to fix it!

Ludo’.
C
C
Carlo Zancanaro wrote on 6 Apr 2018 06:23
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 30950@debbugs.gnu.org)
877eplj742.fsf@zancanaro.id.au
Hey Ludo!

On Thu, Mar 29 2018, Ludovic Courtès wrote:
Toggle quote (8 lines)
>> * modules/shepherd.scm (main): Remove SIGALRM hack for guile <=
>> 2.0.9.
>>
>> ...
>
> Unfortunately I think the problem remains. That’s one of the
> reasons for using signalfd(2).

I must not understand this problem. Can you explain what the
problem is, and how this solves it? Reading the linked email
didn't help me to understand. I've read a number of other things
about Guile and how it handles signals and they haven't helped me
to understand, either.

Toggle quote (3 lines)
> Can you create an account on Savannah so I can add you to the
> group and let you push the first two patches? :-)

I have an activated account, finally! I'm czan there.

Carlo
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEE1lpncq7JnOkt+LaeqdyPv9awIbwFAlrG9j0ACgkQqdyPv9aw
Ibzofw/+L0BP5F57I+IkygZfW5h9hTmip5UVHP4SZEw3YKOmgpCzQto0WXrRue6Y
yCuK6eScHqG7LgrOlgYSiQ5Xpanhfb8AbRzjc3c54UIY4TBW/lBOSAiBlqSb/6eg
24fZakvsMBN8S+Fy/DL0VXw6NlFAl7DHBk8ufD/m0Z2kj/EsQi3aDn6fs2Io48Fh
goCOgrkImfdmB2O2gwvYuHd+fBE02plkfP/mg7qLK/vPI3m8A+k/migYhTFUkroj
O4HCl4SaXa1sicPNyZSx8yCijLPIpAkTKO7kC1U4mTRPc0j/9KvZgX+tfQ5XdKAe
v4nlLCk+YmIdLoY9sMnJ3rctE5SxMcCGnVkBlL6yWNnTsW7yhcbneOLGR3v0Xjo4
HFmqefAEz5ExyTgpNjrIXtsIqRguDoKnk+QTp5msg938/SKAul2lQHL8gBXmUpTL
sTwmOmVCbaNzlP1hopCXWELWKIy/+EIAtoejIzejZU+Kn4yXt+ycoO5G/nC7WhEg
mZZCGPqmahO1UEyWPJRIEsVFRCNvzjTc0sTJz+8cXk49XzPlbiqMvGSvZC1/c9Ze
qYnHmGClaob3Nc7bTOTeyv1bhYgTSrhf+meZizuSj2SRR6hxPfPkg2awic1eSENF
EoAPy0Ncb+eKoPZdBfP8F6ixo7SuNxeo6aefXpHe685oiyRRcY0=
=xgLJ
-----END PGP SIGNATURE-----

L
L
Ludovic Courtès wrote on 6 Apr 2018 11:31
(name . Carlo Zancanaro)(address . carlo@zancanaro.id.au)(address . 30950@debbugs.gnu.org)
87efjs1y1p.fsf@gnu.org
Hi Carlo,

Carlo Zancanaro <carlo@zancanaro.id.au> skribis:

Toggle quote (14 lines)
> On Thu, Mar 29 2018, Ludovic Courtès wrote:
>>> * modules/shepherd.scm (main): Remove SIGALRM hack for guile <=
>>> 2.0.9.
>>>
>>> ...
>>
>> Unfortunately I think the problem remains. That’s one of the
>> reasons for using signalfd(2).
>
> I must not understand this problem. Can you explain what the problem
> is, and how this solves it? Reading the linked email didn't help me to
> understand. I've read a number of other things about Guile and how it
> handles signals and they haven't helped me to understand, either.

It’s a limitation/bug in how Guile handles signals. Scheme signal
handlers are added to a queue of “system asyncs” (info "(guile)
Asyncs"). As the name implies, those asyncs get executed
asynchronously; this is what the ‘handle-interrupts’ instructions that
we see here are for:

Toggle snippet (25 lines)
scheme@(guile-user)> ,compile (lambda (x) (+ 1 x))
Disassembly of <unnamed function> at #xe8:

0 (assert-nargs-ee/locals 1 1) ;; 2 slots (0 args) at (unknown file):139:9
1 (make-non-immediate 0 39) ;; #<procedure 12fea68 at <unknown port>:139:9 (x)>
3 (handle-interrupts)
4 (return-values 2) ;; 1 value


Disassembly of <unnamed function> at #xfc:

0 (assert-nargs-ee/locals 2 0) ;; 2 slots (1 arg) at (unknown file):139:9
1 (add/immediate 0 0 1) at (unknown file):139:21
2 (handle-interrupts)
3 (return-values 2) ;; 1 value


Disassembly of <unnamed function> at #x10c:

0 (assert-nargs-ee/locals 1 1) ;; 2 slots (0 args) at (unknown file):139:21
1 (static-patch! 32 -5)
4 (make-short-immediate 0 2052) ;; #<unspecified>
5 (return-values 2) ;; 1 value

The problem is that if you have a loop around the ‘select’ syscall, you
could have a situation like this:

1. You receive SIGCHLD; an async is queued by the C signal handler in
libguile, and select(2) exits with EINTR.

2. The Scheme code that called the ‘select’ procedure runs and loops
back to the ‘select’ call.

3. We’re now back in select(2) but we haven’t executed our signal
handler (async), and we know it won’t run until we’ve returned from
select(2), which could be hours away.

That’s roughly the story. I would need to “page it in” again to think
about what can be done.

Toggle quote (5 lines)
>> Can you create an account on Savannah so I can add you to the group
>> and let you push the first two patches? :-)
>
> I have an activated account, finally! I'm czan there.

Awesome, you’re a member now, you can unleash your hacking power. :-)

Cheers,
Ludo’.
L
L
Ludovic Courtès wrote on 28 Apr 2018 23:27
control message for bug #30950
(address . control@debbugs.gnu.org)
87o9i381j1.fsf@gnu.org
tags 30950 fixed
close 30950
?