redhotpenguin / perl-Archive-Zip

Archive::Zip as seen at https://metacpan.org/pod/Archive::Zip
Other
15 stars 44 forks source link

writeToFileNamed may create stray symlinks #77

Open charsbar opened 4 years ago

charsbar commented 4 years ago

Archive::Zip 1.66 and above creates a stray symlink by running the following test script.

use Archive::Zip;
use File::Temp;
use File::Spec;

my $tempdir = File::Temp::tempdir( CLEANUP => 1, TMPDIR => 1 );
my $file = File::Spec->catfile( $tempdir, 'file' );
open my $fh, '>', $file;
print $fh "test\n";
close $fh;

my $subdir = File::Spec->catdir( $tempdir, 'subdir' );
mkdir($subdir);

my $link = File::Spec->catfile( $subdir, 'link' );
symlink $file, $link;

my $archiver = Archive::Zip->new;
$archiver->storeSymbolicLink(1);    # for testing
$archiver->addFileOrDirectory($_) for ($file, $subdir, $link);
$archiver->writeToFileNamed("test.zip");

cf. https://rt.cpan.org/Public/Bug/Display.html?id=130525

farblos commented 4 years ago

Should have been caused by one of my changes, will check ...