Skip Menu |

This queue is for tickets about the Tk CPAN distribution.

Report information
The Basics
Id: 5812
Status: resolved
Priority: 0/
Queue: Tk

People
Owner: Nobody in particular
Requestors: Marek.Rouchal [...] gmx.net
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Tk-804.026 broken on Solaris/Sparc/gcc-3.2.3
I tried building Tk-804.026 on my Perl 5.8.3 (ithreads, shared libperl) built with gcc-3.2.3 on Sparc/Solaris 8 (note: on RedHat Linux 7.2 and the same config I see no errors). I get e.g. this error: Program received signal SIGSEGV, Segmentation fault. 0xfed5b7ec in Tcl_UtfToExternalDString () from /home/hwadm/.cpan/build/Tk-804.025_beta16/blib/arch/auto/Tk/Tk.so Stack trace: #0 0xfed5b7ec in Tcl_UtfToExternalDString () from /home/hwadm/.cpan/build/Tk-804.025_beta16/blib/arch/auto/Tk/Tk.so #1 0xfedc920c in TkWmMapWindow () from /home/hwadm/.cpan/build/Tk- 804.025_beta16/blib/arch/auto/Tk/Tk.so #2 0xfedd55f4 in Tk_MapWindow () from /home/hwadm/.cpan/build/Tk- 804.025_beta16/blib/arch/auto/Tk/Tk.so #3 0xfed937a4 in MapFrame () from /home/hwadm/.cpan/build/Tk- 804.025_beta16/blib/arch/auto/Tk/Tk.so #4 0xfef2ea38 in TclServiceIdle () from /home/hwadm/.cpan/build/Tk- 804.025_beta16/blib/arch/auto/Tk/Event/Event.so #5 0xfef2d740 in Tcl_DoOneEvent () from /home/hwadm/.cpan/build/Tk- 804.025_beta16/blib/arch/auto/Tk/Event/Event.so #6 0xfed89d28 in Tk_UpdateObjCmd () from /home/hwadm/.cpan/build/Tk- 804.025_beta16/blib/arch/auto/Tk/Tk.so #7 0xfed63da8 in Call_Tk () from /home/hwadm/.cpan/build/Tk- 804.025_beta16/blib/arch/auto/Tk/Tk.so #8 0xfed66b2c in XSTkCommand () from /home/hwadm/.cpan/build/Tk- 804.025_beta16/blib/arch/auto/Tk/Tk.so #9 0xfed66bc4 in XStoTclCmd () from /home/hwadm/.cpan/build/Tk- 804.025_beta16/blib/arch/auto/Tk/Tk.so #10 0xff28cbd0 in Perl_pp_entersub () from /opt/perl_5.8.3/lib/sun4- solaris-thread-multi/CORE/libperlifx.so #11 0xff284a24 in Perl_runops_standard () from /opt/perl_5.8.3/lib/sun4- solaris-thread-multi/CORE/libperlifx.so #12 0xff229c4c in S_run_body () from /opt/perl_5.8.3/lib/sun4-solaris- thread-multi/CORE/libperlifx.so #13 0xff229930 in perl_run () from /opt/perl_5.8.3/lib/sun4-solaris- thread-multi/CORE/libperlifx.so #14 0x00011194 in main () I traced that back to the portion of the diff attached below, between 804.025_beta16 and 804.026 (note: 804.025_beta16 works ok on both platforms, and the rest of the patch as well). I hope this helps to isolate and fix the problem. Please let me know if you need any additional info. Regards, Marek diff -ruN Tk-804.025_beta16/Tk.xs Tk-804.026/Tk.xs --- Tk-804.025_beta16/Tk.xs 2003-12-09 23:02:41.000000000 +0100 +++ Tk-804.026/Tk.xs 2004-03-17 16:38:01.000000000 +0100 @@ -1,5 +1,5 @@ /* - Copyright (c) 1995-2003 Nick Ing-Simmons. All rights reserved. + Copyright (c) 1995-2004 Nick Ing-Simmons. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. */ @@ -1056,9 +1056,15 @@ OUTPUT: name +MODULE = Tk PACKAGE = Tk PREFIX = Lang_ + +SV * +Lang_SystemEncoding() MODULE = Tk PACKAGE = Tk PREFIX = Tk_ + + void abort() diff -ruN Tk-804.025_beta16/encGlue.c Tk-804.026/encGlue.c --- Tk-804.025_beta16/encGlue.c 2003-12-01 20:07:04.000000000 +0100 +++ Tk-804.026/encGlue.c 2004-03-18 21:34:01.000000000 +0100 @@ -1,5 +1,5 @@ /* - Copyright (c) 2000-2003 Nick Ing-Simmons. All rights reserved. + Copyright (c) 2000-2004 Nick Ing-Simmons. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. */ @@ -8,6 +8,11 @@ #include <EXTERN.h> #include <perl.h> #include <XSUB.h> + +#ifdef HAS_NL_LANGINFO +#include <langinfo.h> +#endif + #define U8 U8 #include "tkGlue.def" @@ -536,13 +541,24 @@ { if (!system_encoding) { - system_encoding = Tcl_GetEncoding(NULL,"iso8859-1"); + char *codeset = "iso8859-1"; +/* This assumes perl's Configure probe stuff is #include-d above */ +#if defined(HAS_NL_LANGINFO) && defined(CODESET) + codeset = nl_langinfo(CODESET); +#endif + system_encoding = Tcl_GetEncoding(NULL,codeset); } return system_encoding; } #define PerlEncObj(enc) (HeVAL((HE *) (enc))) +SV * +Lang_SystemEncoding(void) +{ + return PerlEncObj(GetSystemEncoding()); +} + Tcl_Encoding Tcl_GetEncoding (Tcl_Interp * interp, CONST char * name) { @@ -673,7 +689,7 @@ if (srcLen < 0) srcLen = strlen(src); send = s+srcLen; - dstLen--; + dstLen -= 2; dend = d + dstLen; stmp = newSV(srcLen); while (s < send) @@ -751,7 +767,10 @@ SvREFCNT_dec(stmp); *srcReadPtr = (s - (U8 *)src); *dstCharsPtr = chars; - dst[dstLen] = '\0'; + dst[dstLen] = '\0'; + dst[dstLen+1] = '\0'; + /* If dest is wide single '\0' may not be enough */ + Zero(d,dend-d,char); *dstWrotePtr = (d- (U8 *)dst); return code; }
Subject: Re: [cpan #5812] Tk-804.026 broken on Solaris/Sparc/gcc-3.2.3
To: bug-Tk [...] rt.cpan.org
Date: Fri, 26 Mar 2004 21:43:08 +0000
From: Nick Ing-Simmons <nick [...] ing-simmons.net>
RT-Send-Cc:
via RT <bug-Tk@rt.cpan.org> writes: Show quoted text
>This message about Tk was sent to you by MAREKR <MAREKR@cpan.org> via rt.cpan.org > >Full context and any attached attachments can be found at: ><URL: https://rt.cpan.org/Ticket/Display.html?id=5812 > > >I tried building Tk-804.026 on my Perl 5.8.3 (ithreads, shared libperl) >built with gcc-3.2.3 on Sparc/Solaris 8 (note: on RedHat Linux 7.2 and >the same config I see no errors). I get e.g. this error: > >Program received signal SIGSEGV, Segmentation fault. >0xfed5b7ec in Tcl_UtfToExternalDString () >from /home/hwadm/.cpan/build/Tk-804.025_beta16/blib/arch/auto/Tk/Tk.so > >Stack trace: >#0 0xfed5b7ec in Tcl_UtfToExternalDString () >from /home/hwadm/.cpan/build/Tk-804.025_beta16/blib/arch/auto/Tk/Tk.so >#1 0xfedc920c in TkWmMapWindow () from /home/hwadm/.cpan/build/Tk-
Thanks for the report. I think you will find it works in almost any locale except POSIX/C. Fix is in hand - waiting for confirmation. Show quoted text
>804.025_beta16/blib/arch/auto/Tk/Tk.so >#2 0xfedd55f4 in Tk_MapWindow () from /home/hwadm/.cpan/build/Tk- >804.025_beta16/blib/arch/auto/Tk/Tk.so >#3 0xfed937a4 in MapFrame () from /home/hwadm/.cpan/build/Tk- >804.025_beta16/blib/arch/auto/Tk/Tk.so >#4 0xfef2ea38 in TclServiceIdle () from /home/hwadm/.cpan/build/Tk- >804.025_beta16/blib/arch/auto/Tk/Event/Event.so >#5 0xfef2d740 in Tcl_DoOneEvent () from /home/hwadm/.cpan/build/Tk- >804.025_beta16/blib/arch/auto/Tk/Event/Event.so >#6 0xfed89d28 in Tk_UpdateObjCmd () from /home/hwadm/.cpan/build/Tk- >804.025_beta16/blib/arch/auto/Tk/Tk.so >#7 0xfed63da8 in Call_Tk () from /home/hwadm/.cpan/build/Tk- >804.025_beta16/blib/arch/auto/Tk/Tk.so >#8 0xfed66b2c in XSTkCommand () from /home/hwadm/.cpan/build/Tk- >804.025_beta16/blib/arch/auto/Tk/Tk.so >#9 0xfed66bc4 in XStoTclCmd () from /home/hwadm/.cpan/build/Tk- >804.025_beta16/blib/arch/auto/Tk/Tk.so >#10 0xff28cbd0 in Perl_pp_entersub () from /opt/perl_5.8.3/lib/sun4- >solaris-thread-multi/CORE/libperlifx.so >#11 0xff284a24 in Perl_runops_standard () from /opt/perl_5.8.3/lib/sun4- >solaris-thread-multi/CORE/libperlifx.so >#12 0xff229c4c in S_run_body () from /opt/perl_5.8.3/lib/sun4-solaris- >thread-multi/CORE/libperlifx.so >#13 0xff229930 in perl_run () from /opt/perl_5.8.3/lib/sun4-solaris- >thread-multi/CORE/libperlifx.so >#14 0x00011194 in main () > >I traced that back to the portion of the diff attached below, >between 804.025_beta16 and 804.026 (note: 804.025_beta16 works ok on >both platforms, and the rest of the patch as well). I hope this helps >to isolate and fix the problem. >Please let me know if you need any additional info. > >Regards, > >Marek > >diff -ruN Tk-804.025_beta16/Tk.xs Tk-804.026/Tk.xs >--- Tk-804.025_beta16/Tk.xs 2003-12-09 23:02:41.000000000 +0100 >+++ Tk-804.026/Tk.xs 2004-03-17 16:38:01.000000000 +0100 >@@ -1,5 +1,5 @@ > /* >- Copyright (c) 1995-2003 Nick Ing-Simmons. All rights reserved. >+ Copyright (c) 1995-2004 Nick Ing-Simmons. All rights reserved. > This program is free software; you can redistribute it and/or > modify it under the same terms as Perl itself. > */ >@@ -1056,9 +1056,15 @@ > OUTPUT: > name > >+MODULE = Tk PACKAGE = Tk PREFIX = Lang_ >+ >+SV * >+Lang_SystemEncoding() > > MODULE = Tk PACKAGE = Tk PREFIX = Tk_ > >+ >+ > void > abort() > >diff -ruN Tk-804.025_beta16/encGlue.c Tk-804.026/encGlue.c >--- Tk-804.025_beta16/encGlue.c 2003-12-01 20:07:04.000000000 +0100 >+++ Tk-804.026/encGlue.c 2004-03-18 21:34:01.000000000 +0100 >@@ -1,5 +1,5 @@ > /* >- Copyright (c) 2000-2003 Nick Ing-Simmons. All rights reserved. >+ Copyright (c) 2000-2004 Nick Ing-Simmons. All rights reserved. > This program is free software; you can redistribute it and/or > modify it under the same terms as Perl itself. > */ >@@ -8,6 +8,11 @@ > #include <EXTERN.h> > #include <perl.h> > #include <XSUB.h> >+ >+#ifdef HAS_NL_LANGINFO >+#include <langinfo.h> >+#endif >+ > #define U8 U8 > #include "tkGlue.def" > >@@ -536,13 +541,24 @@ > { > if (!system_encoding) > { >- system_encoding = Tcl_GetEncoding(NULL,"iso8859-1"); >+ char *codeset = "iso8859-1"; >+/* This assumes perl's Configure probe stuff is #include-d above */ >+#if defined(HAS_NL_LANGINFO) && defined(CODESET) >+ codeset = nl_langinfo(CODESET); >+#endif >+ system_encoding = Tcl_GetEncoding(NULL,codeset); > } > return system_encoding; > } > > #define PerlEncObj(enc) (HeVAL((HE *) (enc))) > >+SV * >+Lang_SystemEncoding(void) >+{ >+ return PerlEncObj(GetSystemEncoding()); >+} >+ > Tcl_Encoding > Tcl_GetEncoding (Tcl_Interp * interp, CONST char * name) > { >@@ -673,7 +689,7 @@ > if (srcLen < 0) > srcLen = strlen(src); > send = s+srcLen; >- dstLen--; >+ dstLen -= 2; > dend = d + dstLen; > stmp = newSV(srcLen); > while (s < send) >@@ -751,7 +767,10 @@ > SvREFCNT_dec(stmp); > *srcReadPtr = (s - (U8 *)src); > *dstCharsPtr = chars; >- dst[dstLen] = '\0'; >+ dst[dstLen] = '\0'; >+ dst[dstLen+1] = '\0'; >+ /* If dest is wide single '\0' may not be enough */ >+ Zero(d,dend-d,char); > *dstWrotePtr = (d- (U8 *)dst); > return code; > }
[nick@ing-simmons.net - Fri Mar 26 16:43:28 2004]: Show quoted text
> Thanks for the report. > I think you will find it works in almost any locale except POSIX/C. > Fix is in hand - waiting for confirmation.
Yes, setting LANG=en_US makes the test suites pass. Nevertheless I think Tk should (as in the past) work also without LANG being set. Thanks for the quick reply!