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

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

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


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;


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
Starting program: /pro/bin/perl
[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/

H.Merijn Brand         Amsterdam Perl Mongers (
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.  

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About