I just ran into a (probably rare) crash bug in Geany.
If I try to switch Document->Set Encoding from "Unicode->UTF-8" to "Without encoding" , then the next time I save the document I get a segfault. It looks like it happens when Geany tries to rebuild the tags...
Program received signal SIGSEGV, Segmentation fault. [Switching to Thread -1219221808 (LWP 30632)] 0xb75d8f91 in strcmp () from /lib/libc.so.6
(gdb) bt #0 0xb75d8f91 in strcmp () from /lib/libc.so.6 #1 0x080c5e8e in compare_symbol (a=0x84ed040, b=0x84ed030) at symbols.c:311 .... .... .... #37 0x080b2581 in main (argc=12, argv=0xbfe97994) at main.c:769
(gdb) frame 1 #1 0x080c5e8e in compare_symbol (a=0x84ed040, b=0x84ed030) at symbols.c:311 311 ret = strcmp(a->str, b->str);
(gdb) print a->str $1 = (gchar *) 0x0
(gdb) print b->str $2 = (gchar *) 0x0
As you can see, compare_symbol() calls strcmp(0x0,0x0) but I don't know enough about what's happening to know if it's OK just to check if ( a->str && b->str ) else return 0, or maybe there is a problem with the upstream code that this should never happen anyway.
It's not a big problem for me since I rarely need to change the encoding options, but I thought it should at least be noted here.
- Jeff
On 7/31/07, Jeff Pohlmeyer yetanothergeek@gmail.com wrote:
I just ran into a (probably rare) crash bug in Geany.
If I try to switch Document->Set Encoding from "Unicode->UTF-8" to "Without encoding" , then the next time I save the document I get a segfault. It looks like it happens when Geany tries to rebuild the tags...
Possibly off-topic, but it seems odd that there's an option for "no encoding". I mean, the editor has to assume *some* encoding... Is the "Without encoding (None)" option supposed to mean ascii?
On Tue, 31 Jul 2007 10:42:07 -0400, "John Gabriele" jmg3000@gmail.com wrote:
On 7/31/07, Jeff Pohlmeyer yetanothergeek@gmail.com wrote:
I just ran into a (probably rare) crash bug in Geany.
If I try to switch Document->Set Encoding from "Unicode->UTF-8" to "Without encoding" , then the next time I save the document I get a segfault. It looks like it happens when Geany tries to rebuild the tags...
Possibly off-topic, but it seems odd that there's an option for "no encoding". I mean, the editor has to assume *some* encoding... Is the "Without encoding (None)" option supposed to mean ascii?
Take it as on-disk encoding. The whole story can be found at https://sourceforge.net/tracker/?func=detail&atid=787794&aid=1580456... And I thought we also discussed this on-list but right now I can't find an appropriate thread.
Regards, Enrico
On Tue, 31 Jul 2007 03:46:00 -0500, "Jeff Pohlmeyer" yetanothergeek@gmail.com wrote:
I just ran into a (probably rare) crash bug in Geany.
If I try to switch Document->Set Encoding from "Unicode->UTF-8" to "Without encoding" , then the next time I save the document I get a segfault. It looks like it happens when Geany tries to rebuild the tags...
Program received signal SIGSEGV, Segmentation fault. [Switching to Thread -1219221808 (LWP 30632)] 0xb75d8f91 in strcmp () from /lib/libc.so.6
(gdb) bt #0 0xb75d8f91 in strcmp () from /lib/libc.so.6 #1 0x080c5e8e in compare_symbol (a=0x84ed040, b=0x84ed030) at #symbols.c:311 .... .... .... #37 0x080b2581 in main (argc=12, argv=0xbfe97994) at main.c:769
(gdb) frame 1 #1 0x080c5e8e in compare_symbol (a=0x84ed040, b=0x84ed030) at #symbols.c:311 311 ret = strcmp(a->str, b->str);
(gdb) print a->str $1 = (gchar *) 0x0
(gdb) print b->str $2 = (gchar *) 0x0
As you can see, compare_symbol() calls strcmp(0x0,0x0) but I don't know enough about what's happening to know if it's OK just to check if ( a->str && b->str ) else return 0, or maybe there is a problem with the upstream code that this should never happen anyway.
The upstream code(we are talking about tagmanager?) isn't the problem. The problem is my code, as usual ;-). Should be double-fixed in SVN r1767 (double because the cause and effect were fixed).
In case anyone is interested in, the affecting code is in symbols.c around line 365. If the current file encoding is something else than UTf-8 than the parsed tag names are converted into UTF-8 by encodings_convert_to_utf8_from_charset() which is more or less just calling g_convert() (from GLib) with the file's encoding. But if the file has no encoding, it actually has the encoding "None" and g_convert can't encode a file into "None" ;-) so it returns NULL. The first fix was to skip conversion into UTF-8 when the encoding is None and the second fix was to skip NULL tag names.
Regards, Enrico
On Tue, 31 Jul 2007 19:05:10 +0200, Enrico Tröger enrico.troeger@uvena.de wrote:
On Tue, 31 Jul 2007 03:46:00 -0500, "Jeff Pohlmeyer" yetanothergeek@gmail.com wrote:
I just ran into a (probably rare) crash bug in Geany.
If I try to switch Document->Set Encoding from "Unicode->UTF-8" to "Without encoding" , then the next time I save the document I get a segfault. It looks like it happens when Geany tries to rebuild the tags...
Program received signal SIGSEGV, Segmentation fault. [Switching to Thread -1219221808 (LWP 30632)] 0xb75d8f91 in strcmp () from /lib/libc.so.6
(gdb) bt #0 0xb75d8f91 in strcmp () from /lib/libc.so.6 #1 0x080c5e8e in compare_symbol (a=0x84ed040, b=0x84ed030) at #symbols.c:311 .... .... .... #37 0x080b2581 in main (argc=12, argv=0xbfe97994) at main.c:769
(gdb) frame 1 #1 0x080c5e8e in compare_symbol (a=0x84ed040, b=0x84ed030) at #symbols.c:311 311 ret = strcmp(a->str, b->str);
(gdb) print a->str $1 = (gchar *) 0x0
(gdb) print b->str $2 = (gchar *) 0x0
As you can see, compare_symbol() calls strcmp(0x0,0x0) but I don't know enough about what's happening to know if it's OK just to check if ( a->str && b->str ) else return 0, or maybe there is a problem with the upstream code that this should never happen anyway.
The upstream code(we are talking about tagmanager?) isn't the problem. The problem is my code, as usual ;-). Should be double-fixed in SVN r1767 (double because the cause and effect were fixed).
I forgot to mention: Thanks for reporting.
Regards, Enrico