Skip Menu |

This queue is for tickets about the Tk CPAN distribution.

Report information
The Basics
Id: 33880
Status: open
Priority: 0/
Queue: Tk

People
Owner: Nobody in particular
Requestors: matt [...] triclinic.org
Cc: DDUMONT [...] cpan.org
AdminCc:

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



Subject: Uninitialized value error in Tk::Menu
Tk::Menu is giving me an error in version 804.028 which it did not in the previous version, exemplified by the following code: #----- #!/usr/bin/perl -w use Tk; my $mw = Tk::MainWindow->new(); my $menubar = $mw->Menu( -type => 'menubar' ); my $file = $menubar->Menu(); $menubar->add( 'cascade', -label => 'File', -menu => $file, ); $file->add( 'command', -label => 'Exit', -command => sub { $mw->destroy }, ); $mw->configure( -menu => $menubar ); Tk::MainLoop(); #----- Under 804.027 this worked as expected, but after upgrading to the perl-Tk-804.028-3 package in Fedora Core 7, it fails to display the menu, with this error: Use of uninitialized value in numeric le (<=) at /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/Tk/Menu.pm line 1041. I dunno if this is a packaging problem by the Fedora people or a genuine problem. If you can't reproduce it I can run it by the Fedora Bugzilla. Thanks y'all! -- Matt P.S. Perl and OS versions: $ perl -v Summary of my perl5 (revision 5 version 8 subversion 8) configuration: Platform: osname=linux, osvers=2.6.20-1.3001.fc6xen, archname=i386-linux-thread-multi uname='linux xenbuilder4.fedora.phx.redhat.com 2.6.20-1.3001.fc6xen #1 smp thu aug 9 16:18:42 edt 2007 i686 i686 i386 gnulinux ' config_args='-des -Doptimize=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -Dversion=5.8.8 -Dmyhostname=localhost -Dperladmin=root@localhost -Dcc=gcc -Dcf_by=Red Hat, Inc. -Dinstallprefix=/usr -Dprefix=/usr -Darchname=i386-linux -Dvendorprefix=/usr -Dsiteprefix=/usr -Duseshrplib -Dusethreads -Duseithreads -Duselargefiles -Dd_dosuid -Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio -Dinstallusrbinperl=n -Ubincompat5005 -Uversiononly -Dpager=/usr/bin/less -isr -Dd_gethostent_r_proto -Ud_endhostent_r_proto -Ud_sethostent_r_proto -Ud_endprotoent_r_proto -Ud_setprotoent_r_proto -Ud_endservent_r_proto -Ud_setservent_r_proto -Dinc_version_list=5.8.7 5.8.6 5.8.5 -Dscriptdir=/usr/bin' hint=recommended, useposix=true, d_sigaction=define usethreads=define use5005threads=undef useithreads=define usemultiplicity=define useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm', optimize='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables', cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -I/usr/include/gdbm' ccversion='', gccversion='4.1.2 20070925 (Red Hat 4.1.2-27)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=4, prototype=define Linker and Libraries: ld='gcc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib libs=-lresolv -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc perllibs=-lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc libc=/lib/libc-2.6.so, so=so, useshrplib=true, libperl=libperl.so gnulibc_version='2.6' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-rpath,/usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE' cccdlflags='-fPIC', lddlflags='-shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP USE_ITHREADS USE_LARGE_FILES USE_PERLIO USE_REENTRANT_API Built under linux Compiled at Nov 26 2007 14:25:21 %ENV: PERL5LIB="" @INC: /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.7/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl/5.8.7 /usr/lib/perl5/site_perl/5.8.6 /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.7/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl/5.8.7 /usr/lib/perl5/vendor_perl/5.8.6 /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.8/i386-linux-thread-multi /usr/lib/perl5/5.8.8 . $ uname -a Linux tomis.med.virginia.edu 2.6.23.15-80.fc7 #1 SMP Sun Feb 10 17:29:10 EST 2008 i686 i686 i386 GNU/Linux
On Fri Mar 07 11:37:43 2008, mattzimm wrote: Show quoted text
> Tk::Menu is giving me an error in version 804.028 which it did not in > the previous version, exemplified by the following code: > > #----- > #!/usr/bin/perl -w > > use Tk; > > my $mw = Tk::MainWindow->new(); > > my $menubar = $mw->Menu( -type => 'menubar' ); > my $file = $menubar->Menu(); > $menubar->add( > 'cascade', > -label => 'File', > -menu => $file, > ); > $file->add( > 'command', > -label => 'Exit', > -command => sub { $mw->destroy }, > ); > > $mw->configure( -menu => $menubar ); > > Tk::MainLoop(); > #----- > > Under 804.027 this worked as expected, but after upgrading to the > perl-Tk-804.028-3 package in Fedora Core 7, it fails to display the > menu, with this error: > > Use of uninitialized value in numeric le (<=) at > /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/Tk/Menu.pm line > 1041. > > I dunno if this is a packaging problem by the Fedora people or a genuine > problem. If you can't reproduce it I can run it by the Fedora Bugzilla. >
I cannot reproduce the problem with your test script on various systems (FreeBSD 6.2 + perl 5.8.8, Debian Linux + perl 5.8.8, with Tk 804.028). So it is possible that it's a Fedora-specific problem. Is it possible to see a list of differences between the Tk 804.028 distribution and the Fedora package, if any? What if you compile Tk yourself, does the problem persist? Regards, Slaven
From: tcallawa [...] redhat.com
On Fri Mar 07 18:29:37 2008, SREZIC wrote: Show quoted text
> So it is possible that it's a Fedora-specific problem.
Yes, it actually is a Fedora specific problem. For the details, see: https://bugzilla.redhat.com/show_bug.cgi?id=235666
On Wed Mar 12 00:07:38 2008, tcallawa@redhat.com wrote: Show quoted text
> On Fri Mar 07 18:29:37 2008, SREZIC wrote: >
> > So it is possible that it's a Fedora-specific problem.
> > Yes, it actually is a Fedora specific problem. For the details, see: > > https://bugzilla.redhat.com/show_bug.cgi?id=235666
Uh ? this bug mentions a segfault. Here, we only have an undef value. Anyway, I've stumbled on the same problem on Mandriva. The workaround is to call Menu, cascade or MenuItem with "-tearoff => 0". On Mandriva, the undef triggers an exception which is caught in an eval, then the Menu construction fails. You can get more info on the failure stack by running the Tk application in Perl debugger: $ perl -w -d tk.pl~ Loading DB routines from perl5db.pl version 1.3 Editor support available. Enter h or `h h' for help, or `man perldebug' for more help. main::(tk.pl~:12): $MW = MainWindow->new; DB<1> r Use of uninitialized value $i in numeric le (<=) at /usr/lib/perl5/vendor_perl/5.10.0/i386-linux-thread-multi/Tk/Menu.pm line 1041. at /usr/lib/perl5/vendor_perl/5.10.0/i386-linux-thread-multi/Tk/Menu.pm line 1041 Tk::Menu::tkMenuDup('Tk::Menu=HASH(0x8e7c660)', 'Tk::Menu=HASH(0x8eb6cb0)', 'menubar') called at /usr/lib/perl5/vendor_perl/5.10.0/i386-linux-thread-multi/Tk/Configure.pm line 46 eval {...} called at /usr/lib/perl5/vendor_perl/5.10.0/i386-linux-thread-multi/Tk/Configure.pm line 46 eval {...} called at /usr/lib/perl5/vendor_perl/5.10.0/i386-linux-thread-multi/Tk/Configure.pm line 46 Tk::Configure::configure('Tk::Configure=ARRAY(0x8e7c840)', '-menu', 'Tk::Menu=HASH(0x8e7c660)') called at /usr/lib/perl5/vendor_perl/5.10.0/i386-linux-thread-multi/Tk/Derived.pm line 294 eval {...} called at /usr/lib/perl5/vendor_perl/5.10.0/i386-linux-thread-multi/Tk/Derived.pm line 294 Tk::Derived::configure('MainWindow=HASH(0x8dc56b8)', '-menu', 'Tk::Menu=HASH(0x8e7c660)') called at tk.pl~ line 22 main::build_menubar() called at tk.pl~ line 66 main::init() called at tk.pl~ line 13 I've no such problem on Debian/Sid. I've compared Debian's and Mandriva's Menu.pm and Menu/Item.pm and there's no difference. I can only guess that the perl compiled on Mandriva is more strict than on Debian. On Mandriva, perl is compiled with: $ perl -V Summary of my perl5 (revision 5 version 10 subversion 0) configuration: Platform: osname=linux, osvers=2.6.22.18-server-1mdv, archname=i386-linux-thread-multi uname='linux n2.mandriva.com 2.6.22.18-server-1mdv #1 smp mon feb 11 16:46:24 est 2008 i686 intel(r) xeon(tm) cpu 2.80ghz gnulinux ' config_args='-des -Dinc_version_list=5.8.8 5.8.7 5.8.6 5.8.5 5.8.4 5.8.3 5.8.2 5.8.1 5.8.0 5.6.1 5.6.0 -Darchname=i386-linux -Dcc=gcc -Doptimize=-O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -fomit-frame-pointer -march=i586 -mtune=generic -fasynchronous-unwind-tables -DDEBUGGING=-g -Dprefix=/usr -Dvendorprefix=/usr -Dsiteprefix=/usr -Dsitebin=/usr/local/bin -Dsiteman1dir=/usr/local/share/man/man1 -Dsiteman3dir=/usr/local/share/man/man3 -Dman3ext=3pm -Dcf_by=Mandriva -Dmyhostname=localhost -Dperladmin=root@localhost -Dcf_email=root@localhost -Dd_dosuid -Ud_csh -Duseshrplib -Duseithreads -Di_db -Di_ndbm -Di_gdbm' hint=recommended, useposix=true, d_sigaction=define useithreads=define, usemultiplicity=define useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef use64bitint=undef, use64bitall=undef, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm', optimize='-O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -fomit-frame-pointer -march=i586 -mtune=generic -fasynchronous-unwind-tables', cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -I/usr/local/include -I/usr/include/gdbm' ccversion='', gccversion='4.3.2', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=4, prototype=define Linker and Libraries: ld='gcc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc libc=/lib/libc-2.8.so, so=so, useshrplib=true, libperl=libperl.so gnulibc_version='2.8' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-rpath,/usr/lib/perl5/5.10.0/i386-linux-thread-multi/CORE' cccdlflags='-fPIC', lddlflags='-shared -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -fomit-frame-pointer -march=i586 -mtune=generic -fasynchronous-unwind-tables -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP USE_ITHREADS USE_LARGE_FILES USE_PERLIO USE_REENTRANT_API Locally applied patches: Mandriva Linux patches Built under linux Compiled at Sep 18 2008 16:41:00 @INC: /usr/lib/perl5/site_perl/5.10.0/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.10.0 /usr/lib/perl5/vendor_perl/5.10.0/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.10.0 /usr/lib/perl5/5.10.0/i386-linux-thread-multi /usr/lib/perl5/5.10.0 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl . Hope this helps
I've compared Tk.pm and all Tk/**.pm between Mandriva and Debian and could not see any significant differences (i.e. minor keybindings diff and one more function in one Debian file) Furthermore, this patch does suppress the undef warnings, but it does not suppress the problem: --- lib/Tk/Menu.pm~ 2009-07-23 13:46:45.000000000 +0200 +++ lib/Tk/Menu.pm 2009-07-23 15:23:20.000000000 +0200 @@ -1038,7 +1038,7 @@ my $last = $src->index('last'); if ($last ne 'none') { - for (my $i = $src->cget('-tearoff'); $i <= $last; $i++) + for (my $i = $src->cget('-tearoff') || 0; $i <= $last; $i++) { my $type = $src->type($i); if (defined $type) So my previous conclusion (stricter check in Perl) is false. But the -tearoff=>0 workaround still has an effect, except when calling cascade with deep structures passed to -menuitems All the best
RT-Send-CC: jquelin [...] mandriva.org, Bruno.Cornec [...] hp.com, Guillaume.Rousse [...] inria.fr, mohamed.amine.haddad [...] gmail.com
Hello Slaven If you want to check the difference between Mandriva's Perl/Tk and CPAN Perl/Tk, the easiest way is to: - download Mandriva's SRPM package ftp://fr2.rpmfind.net/linux/Mandriva/devel/cooker/SRPMS//main/release/perl-Tk-804.28.0-12mdv2010.0.src.rpm - open it with file-roller - review with kompare the different patches shown by file-roller I've reviewed the patches. Most look fine, they mostly safeguard against null pointer and stuff like that. Most but not all. This patch looks fishy. Some config handling code is commented out. Jerome, do you know why this code was commented out ? --- pTk/mTk/generic/tkConfig.c.orig 2008-01-04 18:50:58.000000000 +0100 +++ pTk/mTk/generic/tkConfig.c 2008-01-05 00:15:15.000000000 +0100 @@ -1210,11 +1210,12 @@ * First, check to see if the object already has the answer cached. */ - if (objPtr->typePtr == &tkOptionObjType) { - if (objPtr->internalRep.twoPtrValue.ptr1 == (VOID *) tablePtr) { +/* if (objPtr->typePtr == &tkOptionObjType) { + if (objPtr->internalRep.twoPtrValue.ptr1 == (VOID *) tablePtr + && objPtr->internalRep.twoPtrValue.ptr2 != NULL) { return (Option *) objPtr->internalRep.twoPtrValue.ptr2; } - } + }*/ /* * The answer isn't cached. All the best
Le Ven. Jul. 24 08:09:08 2009, DDUMONT a écrit : Show quoted text
> Hello Slaven > > If you want to check the difference between Mandriva's Perl/Tk and > CPAN > Perl/Tk, the easiest way is to: > - download Mandriva's SRPM package > >
ftp://fr2.rpmfind.net/linux/Mandriva/devel/cooker/SRPMS//main/release/perl- Show quoted text
> Tk-804.28.0-12mdv2010.0.src.rpm > - open it with file-roller > - review with kompare the different patches shown by file-roller
Actually, the easiest way is to check the patches directly from the subversion repository: http://svn.mandriva.com/cgi-bin/viewvc.cgi/packages/cooker/perl-Tk/current/SOURCES
RT-Send-CC: jquelin [...] mandriva.org, Bruno.Cornec [...] hp.com, Guillaume.Rousse [...] inria.fr
On Fri Jul 24 09:06:48 2009, JQUELIN wrote: Show quoted text
> the patch you are looking for is > http://svn.mandriva.com/cgi-bin/viewvc.cgi/packages/cooker/perl- > Tk/current/SOURCES/perl-Tk-seg.patch?revision=161601&view=markup
The log mentions that this patch comes from Fedora. And this bug was found and resolved on Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=431330 Jerome, can you test or apply this solution on Mandriva's perl-Tk ?
patch updated on mandriva. perl-Tk-804.28.0-13mdv2010.0 on its way for cooker.