unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Bruce Korb <bkorb@gnu.org>
To: Noah Lavine <noah.b.lavine@gmail.com>
Cc: Mark H Weaver <mhw@netris.org>,
	guile-devel Development <guile-devel@gnu.org>
Subject: Re: Program received signal SIGSEGV, Segmentation fault.
Date: Sat, 17 Nov 2012 12:22:15 -0800	[thread overview]
Message-ID: <50A7F1F7.9000706@gnu.org> (raw)
In-Reply-To: <CA+U71=MjugGtq7diNpnyA=FW5OntL1fZqj5H0LHRLQvKwiPETg@mail.gmail.com>

Hi Noah, Mark,

On 11/16/12 18:19, Noah Lavine wrote:
>     OK, so I tried latin1, too.  (replacing scm_from_utf3_string with
>     scm_from_latin1_string).  That also does not work.  It replaced the
>     0xA9 character with '?'.
> 
> 
> I am no expert on character encodings, but we've seen errors like this before 
> where it turned out that Guile was attempting to display the character on a 
> terminal which didn't support it, and then the terminal converted it into '?'.

I actually do not use Guile to output anything.
I give Guile a string with either the "define" or "set!" functions
and later pull them out with the verboten function scm_i_string_chars.
As far as I can tell, I have to call this procedure myself because
all other paths seem to lead through u8_uctomb, which is not
helpful for my application.

> Could there have been some change in how Guile displays strings that caused 
> this error? Did it used to show a \-escape sequence?

I have always called some function to obtain the text.
I understand the memory is not stable, so I immediately copy
the text out and forget the returned address.  Much like what
scm_to_utf8_stringn() does, but without going through the
u8_uctomb_aux transmogrifier.  I tend to use memcpy or fwrite.

>     What it all boils down to is that
>     I am looking for string handling functions that will handle the
>     NUL terminated list of bytes and keep its nose out of the contents
>     of the string.  Period.  Full stop.
> 
> Could you explain what you're trying to do a little more?

Read input text, modify it according to some embedded markups,
inserting some auxiliary text gotten from another file, and
emitting the result.  95% of it is for computer program text.
The remainder is for man pages and texi docs.

Sometimes, people like to insert a copyright character in their
program text.  About a decade ago, someone asked me to do
something that would verify that a particular file was pure and
proper text and that copyright characters were okay.  This meant
that the "file" program was insufficient.  I rebuilt my library
of old stuff and my current autogen choked and died.

So here I am investigating the cause.

> If you're calling a function that looks at characters on a string 
> object that doesn't contain valid characters, then it will fail.

The only invalid character in my tiny little world is the NUL byte.

> ... So do you intend to make a 
> string object and then never look inside?

I look inside for a limited set of reasons:

1. to write it to output
2. to move it someplace else
3. to compare it against another sequence of bytes

> Or are you going to 
> roll your own string-handling starting from byte sequences?

I do not want to do this, but I will if I have to.

I really do not want to mess with transforming character sets on my
input and output.  Just read in, adjust as directed, and write.

Thank you for any help on using the Guile interface properly!

Regards, Bruce



  reply	other threads:[~2012-11-17 20:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-16 18:00 Program received signal SIGSEGV, Segmentation fault Bruce Korb
2012-11-16 19:19 ` Mark H Weaver
2012-11-16 19:50   ` Bruce Korb
2012-11-16 20:20     ` Bruce Korb
2012-11-16 21:23       ` Mark H Weaver
2012-11-16 23:32         ` Bruce Korb
2012-11-17  2:19           ` Noah Lavine
2012-11-17 20:22             ` Bruce Korb [this message]
2012-11-17  4:22           ` Mark H Weaver
2012-11-17 18:12             ` Bruce Korb
2012-11-17 19:56               ` Mark H Weaver

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=50A7F1F7.9000706@gnu.org \
    --to=bkorb@gnu.org \
    --cc=guile-devel@gnu.org \
    --cc=mhw@netris.org \
    --cc=noah.b.lavine@gmail.com \
    /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).