Sat 21 Mar 2009 06:17:21 AM UTC, comment #14:
OK. Thanks. I pushed this fix.
|
Sat 21 Mar 2009 06:04:07 AM UTC, comment #13:
It fixes the problem. Thank you.
|
Sat 21 Mar 2009 05:57:49 AM UTC, comment #12:
Michel,
can you confirm that the attached patch fixes the problem.
Thanks.
(file #17746)
|
Sat 21 Mar 2009 04:06:09 AM UTC, comment #11:
The code in data-out.c is assuming that we are working in the C locale. I guess the oddity here that you are getting at, John, is that we never set LC_NUMERIC to anything but the "C" locale? In fact src/ui/gui/psppire.c explicitly sets it to "C".
I wonder whether glib or GTK+ is setting LC_NUMERIC somehow?
Bizarre.
|
Sat 21 Mar 2009 02:15:28 AM UTC, comment #10:
It prints a dot.
|
Sat 21 Mar 2009 02:05:19 AM UTC, comment #9:
Can you try the following program compiled using mingw and testing
on your windows with your brazilian localisation:
include <stdio.h>
#include <locale.h>
int
main (int argc, char **argv)
{
char x[100];
setlocale (LC_NUMERIC, "C");
sprintf (x, "%.*f", 5, 1.0);
puts (x);
return 0;
}
Tell me if it prints a dot or a comma.
|
Sat 21 Mar 2009 01:55:59 AM UTC, comment #8:
On SPSS you can choose the decimal separator on it options, and by default it uses the windows default. I really don't know if there's only "." and "," as decimal separator on all languages, but if so, it's easy to fix this bug.
|
Sat 21 Mar 2009 01:43:54 AM UTC, comment #7:
The problem is exactly this. If I change my windows to English localization, the bug doesn't happens.
|
Sat 21 Mar 2009 01:31:54 AM UTC, comment #6:
On Brazil the decimal separator is "," and not ".".
Maybe a issue on gtk or on windows because of it?
|
Sat 21 Mar 2009 01:26:57 AM UTC, comment #5:
I see now it's a i18n issue.
Your string "1,000" contains no '.' so strchr (r->string, '.') will return NULL.
Hence strchr (r->string, '.') - r->string is negative.
I wonder why this hasn't happened before?
|
Sat 21 Mar 2009 01:10:54 AM UTC, comment #4:
I suspect line 764 of src/data/data-out.c is behaving wierd on windows:
r->integer_digits = strchr (r->string, '.') - r->string;
Try printing out (or examining with the debugger) the value of r->integer_digits after this line. Also, the individual values of r->string and strchr (r->string, '.) might be interesting.
|
Sat 21 Mar 2009 12:49:37 AM UTC, comment #3:
>Can you get a stack trace when this happens?
>(type "bt" at the gdb prompt).
>Could you give us a backtrace to go along with
>the problem that you found? Thanks!
Is a back trace equal a stack trace?
>Also it might help if we drop in a few "assert (decimals >=
> 0);" statements at strategic points.
I really don't know which strategic points :D
The "bt" output is:
(gdb) bt
#0 should_round_up (r=0x22f630, decimals=2) at src/data/data-out.c:702
#1 0x0050a142 in rounder_width (r=0x22f630, decimals=2, integer_digits=0x22f5ac,
negative=0x22f5a7) at src/data/data-out.c:792
#2 0x005097ad in output_decimal (r=0x22f630, format=0x1848cdc, require_affixes=true,
output=0x1aa5040 "") at src/data/data-out.c:546
#3 0x005086ce in output_number (input=0x18218a8, format=0x1848cdc, output=0x1aa5040 "")
at src/data/data-out.c:139
#4 0x00508596 in data_out_legacy (input=0x18218a8, encoding=LEGACY_ASCII,
format=0x1848cdc, output=0x1aa5040 "") at src/data/data-out.c:103
#5 0x005085e8 in data_out (value=0x18218a8, format=0x1848cdc, output=0x1aa5040 "")
at src/data/data-out.c:114
#6 0x004165db in psppire_data_store_get_string (store=0x17fe3d8, row=0, column=0)
at src/ui/gui/psppire-data-store.c:617
#7 0x00415d02 in psppire_data_store_get_string_wrapper (model=0x17fe3d8, row=0,
column=0) at src/ui/gui/psppire-data-store.c:244
#8 0x00434563 in psppire_sheet_model_get_string (sheet_model=0x17fe3d8, row=0,
column=0) at src/ui/gui/sheet/psppire-sheetmodel.c:175
#9 0x0043a729 in psppire_sheet_cell_get_text (sheet=0x1a70058, row=0, col=0)
at lib/gtk-contrib/psppire-sheet.c:2430
#10 0x004398b5 in psppire_sheet_cell_draw (sheet=0x1a70058, row=0, col=0)
at lib/gtk-contrib/psppire-sheet.c:2157
#11 0x00439e9a in draw_sheet_region (sheet=0x1a70058, region=0x183d480)
at lib/gtk-contrib/psppire-sheet.c:2255
#12 0x0043c935 in psppire_sheet_expose (widget=0x1a70058, event=0x22fcb0)
at lib/gtk-contrib/psppire-sheet.c:3172
#13 0x618689d2 in _gtk_marshal_BOOLEAN__BOXED ()
from C:\Documents and Settings\Michel\Desktop\pspp-last\pspp-last\bin\libgtk-win32-2.0-
0.dll
#14 0x63a43955 in g_closure_invoke ()
from C:\Documents and Settings\Michel\Desktop\pspp-last\pspp-last\bin\libgobject-2.0-0.
dll
#15 0x63a57ad6 in signal_emit_unlocked_R ()
from C:\Documents and Settings\Michel\Desktop\pspp-last\pspp-last\bin\libgobject-2.0-0.
dll
#16 0x0022fa50 in ?? ()
#17 0x00000002 in ?? ()
#18 0x01ad8ce0 in ?? ()
#19 0x0022fa78 in ?? ()
#20 0x0184ad80 in ?? ()
#21 0x0022f9e8 in ?? ()
#22 0x68dd8635 in _cairo_pattern_fini ()
from C:\Documents and Settings\Michel\Desktop\pspp-last\pspp-last\bin\libcairo-2.dll
#23 0x61868940 in gtk_marshal_VOID__UINT_STRING ()
from C:\Documents and Settings\Michel\Desktop\pspp-last\pspp-last\bin\libgtk-win32-2.0-
0.dll
Cannot access memory at address 0x40008006
|
Sat 21 Mar 2009 12:07:58 AM UTC, comment #2:
Can you get a stack trace when this happens? (type "bt" at the gdb prompt).
Also it might help if we drop in a few "assert (decimals >= 0);" statements at strategic points.
|
Sat 21 Mar 2009 12:07:40 AM UTC, comment #1:
Thanks for the bug report Michel.
Could you give us a backtrace to go along with the problem that you found? Thanks!
|
Fri 20 Mar 2009 11:51:06 PM UTC, original submission:
This issue happens both on Windows XP and Vista, but not on wine.
If you open the last psppire git version and create a new variable it works. Then you back to data view and insert a number on the first cel. As soon as you click on other cell, psppire crashes.
Debugging it, I've found that the problem is on src/data/data-out.c:702.
The line is:
int digit = r->string[r->integer_digits + decimals + 1];
Before this line, if I type on gdb: p *r I get:
$2 = {
string = "1,0000...",
integer_digits = -2291248,
leading_nines = 0,
leading_zeros = 0,
negative = false}
As you can see, the integer_digits have a huge negative number, so this line tries to access r->string with a big negative index and crashes psppire.
|