unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#55619] [PATCH] gnu: smlnj: Fix use of Ctrl-c in sml REPL.
@ 2022-05-25  1:44 Foo Chuan Wei
  2022-06-05  1:12 ` bug#55619: " Tobias Geerinckx-Rice via Guix-patches via
  0 siblings, 1 reply; 2+ messages in thread
From: Foo Chuan Wei @ 2022-05-25  1:44 UTC (permalink / raw)
  To: 55619

* gnu/packages/sml.scm (smlnj): Fix use of Ctrl-c in sml REPL.
---
Related mailing list thread:
https://lists.gnu.org/archive/html/guix-devel/2022-05/msg00209.html
("Why does sh in the build environment ignore SIGINT and SIGQUIT?")


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

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





^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#55619: [PATCH] gnu: smlnj: Fix use of Ctrl-c in sml REPL.
  2022-05-25  1:44 [bug#55619] [PATCH] gnu: smlnj: Fix use of Ctrl-c in sml REPL Foo Chuan Wei
@ 2022-06-05  1:12 ` Tobias Geerinckx-Rice via Guix-patches via
  0 siblings, 0 replies; 2+ messages in thread
From: Tobias Geerinckx-Rice via Guix-patches via @ 2022-06-05  1:12 UTC (permalink / raw)
  To: 55619-done

[-- Attachment #1: Type: text/plain, Size: 433 bytes --]

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 247 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-06-05  1:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-25  1:44 [bug#55619] [PATCH] gnu: smlnj: Fix use of Ctrl-c in sml REPL Foo Chuan Wei
2022-06-05  1:12 ` bug#55619: " Tobias Geerinckx-Rice via Guix-patches via

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).