Subject: bug#32367: 2.2.4 hangs when a script uses a module that calls sigaction

From: Derek Upham <[email-masked]>
Date: Sat, 04 Aug 2018 17:47:09 -0700

This is with guile-2.2 (2.2.4+1-1) and guile-2.2-libs (2.2.4+1-1) on Debian unstable, for the amd64 architecture.

Create the following one-line script file:

  (use-modules (scsh))

Call it (for example) “foo”.

Create a file named “scsh.scm” in a location where the above “use-modules” form will find it.  I use “/usr/share/guile/site/scsh.scm”.  In “scsh.scm”, put:

  (define-module (scsh))

  (display "setting SIGCHILD to SIG_DFL...")
  (newline)
  (sigaction SIGCHLD SIG_DFL)
  (display "setting SIGCHILD to SIG_DFL...done")
  (newline)

Invoke guile as follows:

  /usr/bin/guile < foo

This is reading commands from stdin.  You should see the expected output:

  GNU Guile 2.2.4
  Copyright (C) 1995-2017 Free Software Foundation, Inc.

  Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
  This program is free software, and you are welcome to redistribute it
  under certain conditions; type `,show c' for details.

  Enter `,help' for help.
  setting SIGCHILD to SIG_DFL...
  setting SIGCHILD to SIG_DFL...done

and a command-line prompt.  Invoke guile as a script:

  /usr/bin/guile -s foo

I see just the following:

  setting SIGCHILD to SIG_DFL...

Guile hangs at this point.

Reverting Guile to 2.2.3 from the Debian testing distribution (guile-2.2-dev_2.2.3+1-3+b1_amd64.deb, guile-2.2-doc_2.2.3+1-3_all.deb, guile-2.2-libs_2.2.3+1-3+b1_amd64.deb, guile-2.2_2.2.3+1-3+b1_amd64.deb) fixes the problem:

  % /usr/bin/guile -s foo 
  setting SIGCHILD to SIG_DFL...
  setting SIGCHILD to SIG_DFL...done

Note that moving the sigaction call from “scsh.scm” to “foo” does not trigger the problem.  It only happens when a script uses a module that calls sigaction.