guile-devel
[Top][All Lists]
Advanced

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

Re: Program received signal SIGSEGV, Segmentation fault.


From: Mark H Weaver
Subject: Re: Program received signal SIGSEGV, Segmentation fault.
Date: Fri, 16 Nov 2012 14:19:56 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux)

Hi Bruce,

Bruce Korb <address@hidden> writes:
> This is a clumsy way of saying you don't like the '©' character in
> strings.

I'm sorry, but you haven't provided nearly enough information for me to
figure out what caused the SIGSEGV.  I don't even know what function you
called, or what arguments you passed to it.  I guess you called one of
the scm_from_*_string functions with a string, without telling Guile
what string encoding was used.

> I truly do dislike the fact that that you changed the behavior of
> strings.

The old (pre-2.0) way was completely broken for multibyte encodings.
Given that UTF-8 is fairly standard now, we simply cannot not afford to
keep the old behavior.

If you *really* want something like the old behavior, then you can just
do (setlocale LC_ALL "ISO-8859-1"), but I don't recommend it.

> Yes, I know I can figure out how to change my code to use byte arrays
> somehow or another, but it is a lot of work.  More than just "sed
> 's/string/bytes/'"

Sorry, but the world has gotten more complex with multibyte character
encodings, locales, and the potential for text to/from the user to be in
a different encoding that string literals in your C source code.  If you
want your program to be multilingual, you're going to have to start
thinking about these issues.

In particular, if you use non-ASCII text in your program, then you're
going to have to keep track of which C strings came from the user (and
are thus in the encoding specified by the locale environment variables),
and which C strings came from your program (and are thus in some other
encoding that has nothing to do with the locale).

There is no quick fix, and Guile is not the source of these problems.

> Anyway, seg faulting is not a good response.

If you give me more information, perhaps I can help figure out what
caused the SIGSEGV.

     Mark


> (gdb) printf "%s\n", pDE->de_val.dvu_text
> This program reads or accepts a list of files and prints the names of the
> files that are not plain text.  @i{plain text} characters are characters
> in the range of 0x20 thru 0x7E (' ' thru '~'), plus backspace,
> whitespace characters and the character 0xA9 (© - the circled-C copyright
> character).
> (gdb) s
> Backtrace:
> In ice-9/boot-9.scm:
>  149: 5 [catch #t #<catch-closure 9b5860> ...]
>  157: 4 [#<procedure 9510f0 ()>]
> In unknown file:
>    ?: 3 [catch-closure]
> In ice-9/eval.scm:
>  368: 2 [eval # ()]
>  368: 1 [eval # ()]
> In unknown file:
>    ?: 0 [stack "explain"]
>
> ERROR: In procedure stack:
> ERROR: Throw to key `decoding-error' with args `("scm_from_stringn" "input 
> locale conversion error" 84 \
> #vu8(84 104 105 115 32 112 114 111 103 114 97 109 32 114 101 97 100 115 32 
> 111 114 32 97 99 99 101 112 \
> 116 115 32 97 32 108 105 115 116 32 111 102 32 102 105 108 101 115 32 97 110 
> 100 32 112 114 105 110 \
> 116 115 32 116 104 101 32 110 97 109 101 115 32 111 102 32 116 104 101 10 102 
> 105 108 101 115 32 116 \
> 104 97 116 32 97 114 101 32 110 111 116 32 112 108 97 105 110 32 116 101 120 
> 116 46 32 32 64 105 123 \
> 112 108 97 105 110 32 116 101 120 116 125 32 99 104 97 114 97 99 116 101 114 
> 115 32 97 114 101 32 99 \
> 104 97 114 97 99 116 101 114 115 10 105 110 32 116 104 101 32 114 97 110 103 
> 101 32 111 102 32 48 \
> 120 50 48 32 116 104 114 117 32 48 120 55 69 32 40 39 32 39 32 116 104 114 
> 117 32 39 126 39 41 44 \
> 32 112 108 117 115 32 98 97 99 107 115 112 97 99 101 44 10 119 104 105 116 
> 101 115 112 97 99 101 32 \
> 99 104 97 114 97 99 116 101 114 115 32 97 110 100 32 116 104 101 32 99 104 97 
> 114 97 99 116 101 114 \
> 32 48 120 65 57 32 40 169 32 45 32 116 104 101 32 99 105 114 99 108 101 100 
> 45 67 32 99 111 112 121 \
> 114 105 103 104 116 10 99 104 97 114 97 99 116 101 114 41 46))'.
>
> Program received signal SIGSEGV, Segmentation fault.



reply via email to

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