[PATCH] gnu: smlnj: Fix use of Ctrl-c in sml REPL.

DoneSubmitted by Foo Chuan Wei.
Details
2 participants
  • Foo Chuan Wei
  • Tobias Geerinckx-Rice
Owner
unassigned
Severity
normal
F
F
Foo Chuan Wei wrote on 25 May 03:44 +0200
(address . guix-patches@gnu.org)
PU1PR01MB21558F43DCE101CA76C722DA8DD69@PU1PR01MB2155.apcprd01.prod.exchangelabs.com
* gnu/packages/sml.scm (smlnj): Fix use of Ctrl-c in sml REPL.
---
Related mailing list thread:
("Why does sh in the build environment ignore SIGINT and SIGQUIT?")


gnu/packages/sml.scm | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)

Toggle diff (35 lines)
diff --git a/gnu/packages/sml.scm b/gnu/packages/sml.scm
index 04411c02c3..94a65961d6 100644
--- a/gnu/packages/sml.scm
+++ b/gnu/packages/sml.scm
@@ -175,10 +175,22 @@ function interface, and a symbolic debugger.")
                        "sml.boot.amd64-unix/SMLNJ-BASIS/.cm/amd64-unix/basis-common.cm"))
 
              ;; Build.
-             (invoke "./config/install.sh" "-default"
-                     (if (string=? "i686-linux" ,(%current-system))
-                       "32"
-                       "64"))
+             ;; The `sml` executable built by this package somehow inherits the
+             ;; signal dispositions of the shell where it was built. If SIGINT
+             ;; is ignored in the shell, the resulting `sml` will also ignore
+             ;; SIGINT. This will break the use of Ctrl-c for interrupting
+             ;; execution in the SML/NJ REPL.
+             ;; Here, we use Guile's `system` procedure instead of Guix's
+             ;; `invoke` because `invoke` uses Guile's `system*`, which causes
+             ;; SIGINT and SIGQUIT to be ignored.
+             (let ((exit-code
+                     (system (string-append "./config/install.sh -default "
+                                            (if (string=? "i686-linux"
+                                                          ,(%current-system))
+                                              "32"
+                                              "64")))))
+               (unless (zero? exit-code)
+                 (error (format #f "Exit code: ~a" exit-code))))
 
              ;; Undo the binary patch.
              (for-each

base-commit: d129d962e437fd215c5e9428fc1b26e2d72ffbda
-- 
2.25.1
T
T
Tobias Geerinckx-Rice wrote on 5 Jun 03:12 +0200
(address . 55619-done@debbugs.gnu.org)
87tu8zhpnu@nckx
Hi!

Thanks for the patch and the perfect comment.

The only thing I tweaked was the commit message, to reflect the
‘what’ rather than (just) the ‘why’:

* gnu/packages/sml.scm (smlnj): Replace INVOKE with SYSTEM
which has more favourable signal dispositions.

Tested on a Guix System that could reproduce the original bug &
pushed as 62da327848311a75723f16642c20d2925919237e.

Kind regards,

T G-R
-----BEGIN PGP SIGNATURE-----

iIMEARYKACsWIQT12iAyS4c9C3o4dnINsP+IT1VteQUCYpwE1Q0cbWVAdG9iaWFz
LmdyAAoJEA2w/4hPVW155vwBAJecdxeov2MqL00C+tjxkQ5fw3wJaNq3sYUGBm2E
3xuqAQCrqCk06Q93oKJz6XzMz3lc/S9Tmv4Q79gtNoKLSFB9Bg==
=93Ai
-----END PGP SIGNATURE-----

Closed
?
Your comment

This issue is archived.

To comment on this conversation send email to 55619@debbugs.gnu.org