From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Neil Jerram Newsgroups: gmane.lisp.guile.bugs Subject: Re: 'Segmentation fault' in example program Date: Tue, 09 May 2006 23:10:44 +0100 Message-ID: <871wv2n923.fsf@ossau.uklinux.net> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1147212668 2708 80.91.229.2 (9 May 2006 22:11:08 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 9 May 2006 22:11:08 +0000 (UTC) Cc: bug-guile@gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Wed May 10 00:11:03 2006 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FdaQ1-0000ue-CI for guile-bugs@m.gmane.org; Wed, 10 May 2006 00:11:01 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FdaQ0-0001Rz-QL for guile-bugs@m.gmane.org; Tue, 09 May 2006 18:11:00 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FdaPw-0001RV-AY for bug-guile@gnu.org; Tue, 09 May 2006 18:10:56 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FdaPv-0001RI-Gt for bug-guile@gnu.org; Tue, 09 May 2006 18:10:55 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FdaPv-0001RF-Ca for bug-guile@gnu.org; Tue, 09 May 2006 18:10:55 -0400 Original-Received: from [80.84.72.33] (helo=mail3.uklinux.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FdaR4-0003oW-JP for bug-guile@gnu.org; Tue, 09 May 2006 18:12:06 -0400 Original-Received: from laruns (host86-129-134-171.range86-129.btcentralplus.com [86.129.134.171]) by mail3.uklinux.net (Postfix) with ESMTP id 86995409FE6; Tue, 9 May 2006 22:10:54 +0000 (UTC) Original-Received: from laruns (laruns [127.0.0.1]) by laruns (Postfix) with ESMTP id E428D6F70A; Tue, 9 May 2006 23:10:44 +0100 (BST) Original-To: Frithjof In-Reply-To: (frithjof@minet.uni-jena.de's message of "Tue, 09 May 2006 20:37:49 +0200") User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) X-BeenThere: bug-guile@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:3241 Archived-At: Frithjof writes: > Hey, > when trying to compile the example from chapter "2.3.3 Linking > Guile into Programms" in the Reference Manual with gcc 3.3.5 I get the > following: > > gcc -o simple-guile simple-guile.c -lguile -pthread \ > -Wl,-rpath,/usr/local/lib > > (gdb) run > Starting program: /home/frithjof/krams/guile/simple-guile > [Thread debugging using libthread_db enabled] > [New Thread 1076640096 (LWP 3660)] > [New Thread 1087372208 (LWP 3663)] > guile> (* 3 3) > 9 > guile> (version) > "1.8.0" > guile> (my-hostname) > > Program received signal SIGSEGV, Segmentation fault. > [Switching to Thread 1076640096 (LWP 3660)] > 0x40180363 in strlen () from /lib/tls/libc.so.6 > (gdb) > > Is my system just not set up correctly or is this a bug in Guile or one in > the example? Perhaps the HOSTNAME environment variable is not defined in the shell where you tried this, and so getenv("HOSTNAME") is NULL? You might like to try making the code for my-hostname safer, like this: static SCM my_hostname (void) { char *val = getenv ("HOSTNAME"); return (val ? scm_str2string (val) : SCM_BOOL_F); } Regards, Neil _______________________________________________ Bug-guile mailing list Bug-guile@gnu.org http://lists.gnu.org/mailman/listinfo/bug-guile