GNU bug report logs - #18065
guile hangs if strerror is called with invalid (non-int) argument

Previous Next

Package: guile;

Reported by: "Glenn Michaels" <gmichaels <at> Safe-mail.net>

Date: Sun, 20 Jul 2014 17:51:03 UTC

Severity: normal

Done: Mark H Weaver <mhw <at> netris.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 18065 in the body.
You can then email your comments to 18065 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guile <at> gnu.org:
bug#18065; Package guile. (Sun, 20 Jul 2014 17:51:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Glenn Michaels" <gmichaels <at> Safe-mail.net>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Sun, 20 Jul 2014 17:51:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Glenn Michaels" <gmichaels <at> Safe-mail.net>
To: bug-guile <at> gnu.org
Subject: guile hangs if strerror is called with invalid (non-int) argument
Date: Sun, 20 Jul 2014 11:25:11 -0400
Calling strerror with a non-integer argument causes guile to hang.
e.g.:

(strerror 1.5)

It's a locking issue, which is solved by the following trivial patch:

--- a/libguile/error.c
+++ b/libguile/error.c
@@ -121,10 +121,12 @@ SCM_DEFINE (scm_strerror, "strerror", 1, 0, 0,
 #define FUNC_NAME s_scm_strerror
 {
   SCM ret;
+  int errnum;
   scm_dynwind_begin (0);
+  errnum = scm_to_int (err);
   scm_i_dynwind_pthread_mutex_lock (&scm_i_misc_mutex);
 
-  ret = scm_from_locale_string (strerror (scm_to_int (err)));
+  ret = scm_from_locale_string (strerror (errnum));
 
   scm_dynwind_end ();
   return ret;




Information forwarded to bug-guile <at> gnu.org:
bug#18065; Package guile. (Fri, 01 Aug 2014 19:48:02 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ian Price <ianprice90 <at> googlemail.com>
To: bug-guile <at> gnu.org
Cc: 18065 <at> debbugs.gnu.org
Subject: Re: bug#18065: guile hangs if strerror is called with invalid
 (non-int) argument
Date: Fri, 01 Aug 2014 20:47:02 +0100
Your patch does solve this issue, but I'm not 100% why the problem
occurs in the first place, as the lock should have been unlocked when
the throw occurred.

If I catch the wrong type error explicitly, then there is no problem.

scheme@(guile-user)> (catch #t (lambda () (strerror 1.5)) list)
$1 = (wrong-type-arg #f "Wrong type (expecting ~A): ~S" ("exact integer" 1.5) (1.5))

My thinking is that the a pre-unwind handler in the repl tries to lock
the same mutex, but I haven't looked into this deeply enough.

-- 
Ian Price -- shift-reset.com

"Programming is like pinball. The reward for doing it well is
the opportunity to do it again" - from "The Wizardy Compiled"





Information forwarded to bug-guile <at> gnu.org:
bug#18065; Package guile. (Fri, 01 Aug 2014 19:48:03 GMT) Full text and rfc822 format available.

Reply sent to Mark H Weaver <mhw <at> netris.org>:
You have taken responsibility. (Wed, 12 Nov 2014 06:08:02 GMT) Full text and rfc822 format available.

Notification sent to "Glenn Michaels" <gmichaels <at> Safe-mail.net>:
bug acknowledged by developer. (Wed, 12 Nov 2014 06:08:03 GMT) Full text and rfc822 format available.

Message #16 received at 18065-done <at> debbugs.gnu.org (full text, mbox):

From: Mark H Weaver <mhw <at> netris.org>
To: "Glenn Michaels" <gmichaels <at> Safe-mail.net>
Cc: 18065-done <at> debbugs.gnu.org
Subject: Re: bug#18065: guile hangs if strerror is called with invalid
 (non-int) argument
Date: Wed, 12 Nov 2014 01:05:53 -0500
Fixed in fda17c20a3d088fccab1671c8881bd217d83d5f6 on the stable-2.0
branch, which will become Guile 2.0.12.

     Thanks,
       Mark




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 10 Dec 2014 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 140 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.