guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: debugging guile test failure and segfault.


From: Dan McMahill
Subject: Re: debugging guile test failure and segfault.
Date: Thu, 07 Jun 2007 01:09:39 -0400
User-agent: Mail/News 1.5.0.10 (X11/20070512)

Ludovic Courtès wrote:
Hi,

Dan McMahill <address@hidden> writes:



Running r4rs.test
[1]   Segmentation fault      ${dir}${tst}
FAIL: check-guile

I guess you'll have to send us a stack trace.  :-)  So you need to make
sure you compile Guile with the `-g' flags (e.g., by running "make
CFLAGS=-g"); then you can run "gdb libguile/.libs/lt-guile core",
assuming a `core' file was generated when it segfaulted.

ok, I turned off -O2 to avoid any compiler strange behaviour, got the core file and ran

gdb libguile/.libs/guile guile.core

a back trace showed that around line 834 of libguile/posix.c there is a call to ttyname() which is returning NULL. Unfortunately that NULL pointer is used a few lines later by some functions which try to run strlen() on it. Thats where the segfault is.

I tried configuring with --without-threads to see if turning off threading support made a difference and it didn't.

I also added a call to isatty(fd) in there to see it returns true and it does so I don't know whats up. Perhaps there is some other bug on my system. Either way, there should probably be some better error checking in posix.c. There is some error checking but not until after "result" is used.

The error is "No such file or directory". I wonder if perhaps this is related to running in a chroot environment.

--- libguile/posix.c.orig       2006-10-04 03:35:07.000000000 +0000
+++ libguile/posix.c
@@ -831,14 +831,20 @@ SCM_DEFINE (scm_ttyname, "ttyname", 1, 0
   scm_i_scm_pthread_mutex_lock (&scm_i_misc_mutex);
   SCM_SYSCALL (result = ttyname (fd));
   err = errno;
-  ret = scm_from_locale_string (result);
-  scm_i_pthread_mutex_unlock (&scm_i_misc_mutex);

   if (!result)
     {
       errno = err;
       SCM_SYSERROR;
+      ret = scm_from_locale_string ("unknown");
+    }
+  else
+    {
+      ret = scm_from_locale_string (result);
     }
+
+  scm_i_pthread_mutex_unlock (&scm_i_misc_mutex);
+
   return ret;
 }
 #undef FUNC_NAME


with this patch instead of a segfault I get:

Running r4rs.test
ERROR: In procedure ttyname:
ERROR: No such file or directory

unfortunately the testsuite still stops running so I don't know what all else may still be failing. After moving aside r4rs.test I make it to:

Running regexp.test
Segmentation fault (core dumped)


#0  0x00000001600d6bb4 in scm_is_pair (x=0x10001202cbd60) at inline.h:272
#1 0x0000000160086434 in scm_sloppy_assq (key=0x1200673a0, alist=0x10001202cbd60) at alist.c:53 #2 0x00000001600d2a58 in scm_hash_fn_get_handle (table=0x120321ac0, obj=0x1200673a0, hash_fn=0x1600d15ec <scm_ihashq>,
    assoc_fn=0x160086408 <scm_sloppy_assq>, closure=0x0) at hashtab.c:428
#3 0x00000001600d2e20 in scm_hash_fn_ref (table=0x12009aba0, obj=0x1200673a0, dflt=0x4, hash_fn=0x1600d15ec <scm_ihashq>,
    assoc_fn=0x160086408 <scm_sloppy_assq>, closure=0x0) at hashtab.c:500
#4 0x00000001600d3304 in scm_hashq_ref (table=0x12009aba0, key=0x1200673a0, dflt=0x4) at hashtab.c:613 #5 0x00000001600dc904 in module_variable (module=0x12009ab40, sym=0x1200673a0) at modules.c:289 #6 0x00000001600dcabc in scm_eval_closure_lookup (eclo=0x1200f56d0, sym=0x1200673a0, definep=0x4) at modules.c:337 #7 0x00000001600dcf38 in scm_sym2var (sym=0x1200673a0, proc=0x1200f56d0, definep=0x4) at modules.c:461 #8 0x00000001600a2d6c in scm_lookupcar1 (vloc=0x12071b1e0, genv=0x120228620, check=1) at eval.c:2861 #9 0x00000001600a73b0 in ceval (x=0x12071b1e0, env=0x120228620) at eval.c:4027 #10 0x00000001600a4d54 in ceval (x=0x1202286d0, env=0x120228620) at eval.c:3557 #11 0x00000001600a3cb4 in ceval (x=0x12071adc0, env=0x12071aa10) at eval.c:3384 #12 0x00000001600aa168 in scm_apply (proc=0x1201522c0, arg1=0x404, args=0x12071aa30) at eval.c:4997
#13 0x00000001600a90b0 in scm_call_0 (proc=0x12071aaa0) at eval.c:4651


After moving aside regexp.test the remaining tests finish with:

Totals for this test run:
passes:                 10091
failures:               1
unexpected passes:      0
expected failures:      25
unresolved test cases:  12
untested test cases:    0
unsupported test cases: 17
errors:                 0

-Dan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]