unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* 'Segmentation fault' in example program
@ 2006-05-09 18:37 Frithjof
  2006-05-09 22:10 ` Neil Jerram
  2006-05-09 22:42 ` Kevin Ryde
  0 siblings, 2 replies; 4+ messages in thread
From: Frithjof @ 2006-05-09 18:37 UTC (permalink / raw)


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?

Yours,
Frithjof 


_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 'Segmentation fault' in example program
  2006-05-09 18:37 'Segmentation fault' in example program Frithjof
@ 2006-05-09 22:10 ` Neil Jerram
  2006-05-09 22:28   ` Marius Vollmer
  2006-05-09 22:42 ` Kevin Ryde
  1 sibling, 1 reply; 4+ messages in thread
From: Neil Jerram @ 2006-05-09 22:10 UTC (permalink / raw)
  Cc: bug-guile

Frithjof <frithjof@minet.uni-jena.de> 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 'Segmentation fault' in example program
  2006-05-09 22:10 ` Neil Jerram
@ 2006-05-09 22:28   ` Marius Vollmer
  0 siblings, 0 replies; 4+ messages in thread
From: Marius Vollmer @ 2006-05-09 22:28 UTC (permalink / raw)
  Cc: bug-guile

Neil Jerram <neil@ossau.uklinux.net> writes:

> You might like to try making the code for my-hostname safer, like
> this:

We should make the example safe as well...

-- 
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405


_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 'Segmentation fault' in example program
  2006-05-09 18:37 'Segmentation fault' in example program Frithjof
  2006-05-09 22:10 ` Neil Jerram
@ 2006-05-09 22:42 ` Kevin Ryde
  1 sibling, 0 replies; 4+ messages in thread
From: Kevin Ryde @ 2006-05-09 22:42 UTC (permalink / raw)
  Cc: bug-guile

Frithjof <frithjof@minet.uni-jena.de> writes:
>
> Is my system just not set up correctly or is this a bug in Guile or one in
> the example?

A bug in the example.  If you don't have a HOSTNAME variable then
getenv returns NULL, and scm_str2string can't cope with NULL.  I'll
change the manual.  Thanks.


_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-05-09 22:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-09 18:37 'Segmentation fault' in example program Frithjof
2006-05-09 22:10 ` Neil Jerram
2006-05-09 22:28   ` Marius Vollmer
2006-05-09 22:42 ` Kevin Ryde

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).