Subject: dynamic-link hangs on error

From: noxdafox <[email-masked]>
Date: Sun, 12 Nov 2017 20:16:35 +0200

Greetings,

I am trying to call some C function which seems not to be included in 
Guile library (fnmatch).

If dynamic-link is given wrong library objects, it will hang forcing the 
user to kill the VM as it becomes unresponsive.

I could find at least 2 ways to reproduce it:

1. Calling dynamic-link on a wrong object

2. Calling dynamic-link subsequently on 2 non existing objects

Here's an example:

GNU Guile 2.2.2
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.
scheme@(guile-user)> (use-modules (system foreign))
scheme@(guile-user)> (define libc-obj (dynamic-link "nonexisting"))
ERROR: In procedure dynamic-link:
ERROR: In procedure dynamic-link: file: "nonexisting", message: "file 
not found"

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
scheme@(guile-user) [1]> (define libc-obj (dynamic-link "nonexisting"))

^^^ here the VM becomes unresponsive.