develooper Front page | perl.perl5.porters | Postings from October 2007

Archive::Tar and Tk don't play nice together

Thread Next
From:
H.Merijn Brand
Date:
October 23, 2007 09:04
Subject:
Archive::Tar and Tk don't play nice together
Message ID:
20071023160352.21cd94e0@pc09.procura.nl
From a big application, I reduced it to this test case. Maybe it can be
even shorter, but this should do ...


--8<--- test.pl
#!/pro/bin/perl

use strict;
use warnings;

use Tk;
use Cwd;
use Archive::Tar;

my $mw = MainWindow->new;
$mw->Label (-text => "Test");

if ($mw) {
    my $tar = 0;
    my $tl  = $mw->Toplevel;
    $tl->Checkbutton (-text => "Create", -variable => \$tar)->pack;
    $tl->Button (-text => "Exit", -command => sub { exit; })->pack;
    $tl->Button (-text => "GO", -command => sub {
	my $pwd = getcwd;
	$tar and $tar = Archive::Tar->new;
	foreach my $f ("/etc/motd", "/etc/hosts") {
	    my ($dir, $file) = ($f =~ m{^(.*)/(.*)$});
	    chdir $dir or die "Cannot chdir to $dir: $!\n";
	    $tar and $tar->add_files ($file);
	    }
	$tar and $tar->write ("/tmp/test.tgz", 9);
	chdir $pwd;
	$tl->destroy;
	})->pack;
    }

MainLoop;
-->8---

All goes well untill you check the checkbutton, click on GO and then
leave the applic. You get a segmentation fault, but the test.tgz is
created correct.

No core dump is created, and I do have the write rights.

(gdb) run test.pl
Starting program: /pro/bin/perl test.pl
[Thread debugging using libthread_db enabled]
[New Thread 47147403370544 (LWP 28717)]
Error while reading shared library symbols:
Cannot find new threads: generic error

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 47147403370544 (LWP 28717)]
0x00002ae15c0de220 in strcmp () from /lib64/libc.so.6
(gdb)

-- 
H.Merijn Brand         Amsterdam Perl Mongers (http://amsterdam.pm.org/)
using & porting perl 5.6.2, 5.8.x, 5.10.x  on HP-UX 10.20, 11.00, 11.11,
& 11.23, SuSE 10.1 & 10.2, AIX 5.2, and Cygwin.       http://qa.perl.org
http://mirrors.develooper.com/hpux/            http://www.test-smoke.org
                        http://www.goldmark.org/jeff/stupid-disclaimers/

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About