unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: David Kastrup <dak@gnu.org>
To: Mark H Weaver <mhw@netris.org>
Cc: 20209@debbugs.gnu.org
Subject: bug#20209: GUILE 2.0.11: crash in set_port_filename_x for bytevector ports
Date: Fri, 27 Mar 2015 09:18:48 +0100	[thread overview]
Message-ID: <87bnje26qf.fsf@fencepost.gnu.org> (raw)
In-Reply-To: <87egob8irs.fsf@netris.org> (Mark H. Weaver's message of "Thu, 26 Mar 2015 19:02:15 -0400")

Mark H Weaver <mhw@netris.org> writes:

> The problem turns out to be that binary ports are not initialized until
> the (ice-9 binary-ports) module is loaded.  As a result, the port
> returned by 'scm_open_bytevector_input_port' has a bad type tag.
>
> The workaround is to call scm_c_resolve_module ("ice-9 binary-ports")
> after initializing Guile before the first call to
> 'scm_open_bytevector_input_port'.

It kind of defeats the point of having scm_open_bytevector_input_port in
the C library part if you have to call scm_c_resolve_module before use.
It's also a rather inscrutable error symptom.  Any chance wrong-type-arg
can guard against uninitialized/invalid types specifically?  There is a
reasonably high chance that bad/uninitialized SCM will wash up there.

The more thorough way would be to check the type tag to be in valid
range before doing any smob callback.

-- 
David Kastrup





  reply	other threads:[~2015-03-27  8:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-26 20:18 bug#20209: GUILE 2.0.11: crash in set_port_filename_x for bytevector ports David Kastrup
2015-03-26 23:02 ` Mark H Weaver
2015-03-27  8:18   ` David Kastrup [this message]
2015-03-28 18:48     ` Mark H Weaver
2015-03-28 18:21   ` Mark H Weaver
2015-03-29 13:06     ` Ludovic Courtès
2016-06-23 16:34       ` Andy Wingo
2016-06-23 16:59         ` David Kastrup
2016-06-23 18:01           ` Andy Wingo
2016-06-23 18:45             ` David Kastrup
2017-02-28 13:20         ` Andy Wingo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bnje26qf.fsf@fencepost.gnu.org \
    --to=dak@gnu.org \
    --cc=20209@debbugs.gnu.org \
    --cc=mhw@netris.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).