Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package perl-PAR-Packer for openSUSE:Factory checked in at 2022-09-12 19:08:43 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-PAR-Packer (Old) and /work/SRC/openSUSE:Factory/.perl-PAR-Packer.new.2083 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-PAR-Packer" Mon Sep 12 19:08:43 2022 rev:22 rq:1002764 version:1.056 Changes: -------- --- /work/SRC/openSUSE:Factory/perl-PAR-Packer/perl-PAR-Packer.changes 2022-07-05 12:09:55.800595493 +0200 +++ /work/SRC/openSUSE:Factory/.perl-PAR-Packer.new.2083/perl-PAR-Packer.changes 2022-09-12 19:08:47.826628898 +0200 @@ -1,0 +2,24 @@ +Tue Sep 6 03:08:16 UTC 2022 - Tina M??ller <timueller+p...@suse.de> + +- updated to 1.056 + see /usr/share/doc/packages/perl-PAR-Packer/Changes + + 1.056 2022-09-05 + - Fix #66: patch myldr/boot for "pp --clean ..." without side effects + - make sure myldr/boot contains exactly one string of the form + "__PASS_PAR_CLEAN__ \0" so that there are no + duplicates that may get split on chunk boundaries + (myldr/boot_embedded_files.c) + - simplify patching of this string (in $loader) to + "__PASS_PAR_CLEAN__=1 \0" in script/par.pl + - add a test for #66 (check for ephemeral vs persistent cache directory) + - Revert "Fixes #62: rs6000_71 (AIX) "An offset in the .loader section header is too large."" + PAR_CLEAN is set too late: at this point PAR_TEMP has already + been set (and populated) to a persistent cache directory + (/tmp/par-USER/cache-SHA1) instead of an ephemeral one (/tmp/par-USER/temp-PID). + - Some code cleanup + - replace some magic numbers with constants + - use string interpolation (instead of concatenation) + - clean up some convoluted C code + +------------------------------------------------------------------- Old: ---- PAR-Packer-1.055.tar.gz New: ---- PAR-Packer-1.056.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-PAR-Packer.spec ++++++ --- /var/tmp/diff_new_pack.RfNeS7/_old 2022-09-12 19:08:48.234630045 +0200 +++ /var/tmp/diff_new_pack.RfNeS7/_new 2022-09-12 19:08:48.238630056 +0200 @@ -18,7 +18,7 @@ %define cpan_name PAR-Packer Name: perl-PAR-Packer -Version: 1.055 +Version: 1.056 Release: 0 License: Artistic-1.0 OR GPL-1.0-or-later Summary: PAR Packager ++++++ PAR-Packer-1.055.tar.gz -> PAR-Packer-1.056.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PAR-Packer-1.055/Changes new/PAR-Packer-1.056/Changes --- old/PAR-Packer-1.055/Changes 2022-07-03 18:15:37.000000000 +0200 +++ new/PAR-Packer-1.056/Changes 2022-09-05 12:09:30.000000000 +0200 @@ -1,3 +1,26 @@ +1.056 2022-09-05 + +- Fix #66: patch myldr/boot for "pp --clean ..." without side effects + + - make sure myldr/boot contains exactly one string of the form + "__PASS_PAR_CLEAN__ \0" so that there are no + duplicates that may get split on chunk boundaries + (myldr/boot_embedded_files.c) + - simplify patching of this string (in $loader) to + "__PASS_PAR_CLEAN__=1 \0" in script/par.pl + - add a test for #66 (check for ephemeral vs persistent cache directory) + +- Revert "Fixes #62: rs6000_71 (AIX) "An offset in the .loader section header is too large."" + + PAR_CLEAN is set too late: at this point PAR_TEMP has already + been set (and populated) to a persistent cache directory + (/tmp/par-USER/cache-SHA1) instead of an ephemeral one (/tmp/par-USER/temp-PID). + +- Some code cleanup + - replace some magic numbers with constants + - use string interpolation (instead of concatenation) + - clean up some convoluted C code + 1.055 2022-07-03 - Fix #62: rs6000_71 (AIX) "An offset in the .loader section header is too large." diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PAR-Packer-1.055/MANIFEST new/PAR-Packer-1.056/MANIFEST --- old/PAR-Packer-1.055/MANIFEST 2022-07-03 18:24:32.000000000 +0200 +++ new/PAR-Packer-1.056/MANIFEST 2022-09-05 12:10:06.000000000 +0200 @@ -71,6 +71,7 @@ t/85-crt-glob.t t/85-myfile.t t/90-gh41.t +t/90-gh66.t t/90-rt101800.t t/90-rt103861.t t/90-rt104560.t diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PAR-Packer-1.055/META.json new/PAR-Packer-1.056/META.json --- old/PAR-Packer-1.055/META.json 2022-07-03 18:24:32.000000000 +0200 +++ new/PAR-Packer-1.056/META.json 2022-09-05 12:10:06.000000000 +0200 @@ -78,6 +78,6 @@ }, "x_MailingList" : "mailto:p...@perl.org" }, - "version" : "1.055", - "x_serialization_backend" : "JSON::PP version 4.10" + "version" : "1.056", + "x_serialization_backend" : "JSON::PP version 4.11" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PAR-Packer-1.055/META.yml new/PAR-Packer-1.056/META.yml --- old/PAR-Packer-1.055/META.yml 2022-07-03 18:24:32.000000000 +0200 +++ new/PAR-Packer-1.056/META.yml 2022-09-05 12:10:06.000000000 +0200 @@ -48,5 +48,5 @@ MailingList: mailto:p...@perl.org bugtracker: https://github.com/rschupp/PAR-Packer/issues repository: git://github.com/rschupp/PAR-Packer.git -version: '1.055' +version: '1.056' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PAR-Packer-1.055/lib/PAR/Packer.pm new/PAR-Packer-1.056/lib/PAR/Packer.pm --- old/PAR-Packer-1.055/lib/PAR/Packer.pm 2022-01-27 12:01:23.000000000 +0100 +++ new/PAR-Packer-1.056/lib/PAR/Packer.pm 2022-09-05 11:13:07.000000000 +0200 @@ -3,7 +3,7 @@ use strict; use warnings; -our $VERSION = '1.055'; +our $VERSION = '1.056'; =head1 NAME diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PAR-Packer-1.055/myldr/Makefile.PL new/PAR-Packer-1.056/myldr/Makefile.PL --- old/PAR-Packer-1.055/myldr/Makefile.PL 2022-01-25 15:10:29.000000000 +0100 +++ new/PAR-Packer-1.056/myldr/Makefile.PL 2022-08-30 14:35:36.000000000 +0200 @@ -256,7 +256,7 @@ clean:: -\$(RM_F) boot_embedded_files.c my_par_pl.c - -\$(RM_F) $(OBJECTS) + -\$(RM_F) \$(OBJECTS) -\$(RM_F) *.opt *.pdb perlxsi.c -\$(RM_F) usernamefrompwuid.h -\$(RM_F) $par_exe $boot_exe @parl_exes Dynamic.pm Static.pm diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PAR-Packer-1.055/myldr/boot.c new/PAR-Packer-1.056/myldr/boot.c --- old/PAR-Packer-1.055/myldr/boot.c 2022-02-13 17:53:43.000000000 +0100 +++ new/PAR-Packer-1.056/myldr/boot.c 2022-09-05 11:40:44.000000000 +0200 @@ -125,7 +125,7 @@ /* seek file descriptor fd to member Subsystem (a WORD) of the * IMAGE_OPTIONAL_HEADER structure of a Windows executable * (so that the next 2 bytes read/written from/to fd get/set Subsystem); - * cf. sub _fix_console in PAR/Packer.pm + * cf. sub _fix_console in PAR/Packer.pm */ void seek_to_subsystem( int fd ) { BYTE buf[64]; @@ -205,6 +205,11 @@ char pp_version_info[] = "@(#) Packed by PAR::Packer " PAR_PACKER_VERSION; +/* the contents of this string (in the executable myldr/boot) + * will be patched by script/par.pl if option "--clean" is used with pp + */ +static char pass_par_clean[] = "__PASS_PAR_CLEAN__ \0"; + int main ( int argc, char **argv, char **env ) { int rc; @@ -225,6 +230,15 @@ par_init_env(); + /* check for patched content of pass_par_clean */ + { + char *equals = strchr(pass_par_clean, '='); + if (equals != NULL) { + equals[2] = '\0'; /* trim value to one byte */ + par_setenv("PAR_CLEAN", equals + 1); + } + } + stmpdir = par_mktmpdir( argv ); if ( !stmpdir ) die(""); /* error message has already been printed */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PAR-Packer-1.055/myldr/mktmpdir.c new/PAR-Packer-1.056/myldr/mktmpdir.c --- old/PAR-Packer-1.055/myldr/mktmpdir.c 2021-04-06 10:31:54.000000000 +0200 +++ new/PAR-Packer-1.056/myldr/mktmpdir.c 2022-09-05 12:07:25.000000000 +0200 @@ -222,6 +222,15 @@ } if ( !par_env_clean() && (f = open( progname, O_RDONLY | OPEN_O_BINARY ))) { + /* TODO The following should implement the full search for the PAR magic + * string ("\nPAR.pm\n") as implemented in find_par_magic() in script/par.pl + * and then use that position to look for "\0CACHE". + * E.g. signed pp-packed executables don't have "\0CACHE" in position 18 bytes + * from the end of the executables. + * But in this case the code below will just resort to compute the SHA1 of the + * executable on the fly and thus provide a stable cache directory path + * (though perhaps a little less efficient). + */ lseek(f, -18, 2); read(f, buf, 6); if(buf[0] == 0 && buf[1] == 'C' && buf[2] == 'A' && buf[3] == 'C' && buf[4] == 'H' && buf[5] == 'E') { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PAR-Packer-1.055/myldr/run_with_inc.pl new/PAR-Packer-1.056/myldr/run_with_inc.pl --- old/PAR-Packer-1.055/myldr/run_with_inc.pl 2020-03-08 23:54:55.000000000 +0100 +++ new/PAR-Packer-1.056/myldr/run_with_inc.pl 2022-08-30 14:35:36.000000000 +0200 @@ -10,4 +10,4 @@ # then execute it splice @ARGV, 1, 0, map { "-I$_" } @INC; system(@ARGV) == 0 - or die "system(@ARGV) failed: $!\n"; + or die "system(@ARGV) failed: \$?=$?\n"; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PAR-Packer-1.055/myldr/utils.c new/PAR-Packer-1.056/myldr/utils.c --- old/PAR-Packer-1.055/myldr/utils.c 2022-07-01 23:09:24.000000000 +0200 +++ new/PAR-Packer-1.056/myldr/utils.c 2022-09-05 11:40:44.000000000 +0200 @@ -20,6 +20,7 @@ #else # include <fcntl.h> #endif +#include <string.h> #include <stdio.h> #include "env.c" @@ -83,9 +84,7 @@ char *par_findprog(char *prog, const char *path) { - char *p, filename[MAXPATHLEN]; - /* char *ret; */ /* Commented out for reason described below */ - int proglen, plen; + char *p, *endp, filename[MAXPATHLEN]; char *par_temp = par_getenv("PAR_TEMP"); /* NOTE: This code is #include'd both from a plain C program (boot.c) @@ -117,37 +116,35 @@ Basically, execvp( "/full/path/to/prog", "prog", NULL ) and "/full/path/to" isn't in $PATH. Of course, I can't think of a situation this will happen. */ - proglen = strlen(prog); - p = strtok(strdup(path), path_sep); - /* Note: use a copy of path as strtok() modifies its first argument */ - while ( p != NULL ) { + /* Note: use a copy of path as strtok() modifies its first argument */ + for (p = strtok(strdup(path), path_sep); p != NULL; p = strtok(NULL, path_sep)) { + /* an empty PATH element means the current directory */ if (*p == '\0') p = "."; if ( par_temp != NULL && ( strcmp(par_temp, p) == 0 ) ) { - p = strtok(NULL, path_sep); continue; } - plen = strlen(p); - /* strip trailing '/' */ - while (p[plen-1] == *dir_sep) { - p[--plen] = '\0'; + endp = p + strlen(p) - 1; + while (p < endp && *endp == *dir_sep) { + *endp ='\0'; + endp--; } - if (plen + 1 + proglen >= MAXPATHLEN) { + if (strlen(p) + 1 + strlen(prog) >= MAXPATHLEN) { par_setenv("PAR_PROGNAME", prog); return prog; } sprintf(filename, "%s%s%s", p, dir_sep, prog); - if ((stat(filename, &statbuf) == 0) && S_ISREG(statbuf.st_mode) && - access(filename, X_OK) == 0) { + if (stat(filename, &statbuf) == 0 + && S_ISREG(statbuf.st_mode) + && access(filename, X_OK) == 0) { par_setenv("PAR_PROGNAME", filename); return strdup(filename); } - p = strtok(NULL, path_sep); } par_setenv("PAR_PROGNAME", prog); @@ -156,57 +153,41 @@ char *par_basename (const char *name) { - const char *base = name; - const char *p; - - for (p = name; *p; p++) { - if (*p == *dir_sep) base = p + 1; - } - - return (char*)base; + char *base = strrchr(name, *dir_sep); + return strdup(base != NULL ? base + 1 : name); } - - char *par_dirname (const char *path) { - static char bname[MAXPATHLEN]; - register const char *endp; + char dname[MAXPATHLEN]; + char *endp; /* Empty or NULL string gets treated as "." */ if (path == NULL || *path == '\0') { return strdup("."); } - /* Strip trailing slashes */ - endp = path + strlen(path) - 1; - while (endp > path && *endp == *dir_sep) endp--; - - /* Find the start of the dir */ - while (endp > path && *endp != *dir_sep) endp--; + if (strlen(path) + 1 > sizeof(dname)) + return NULL; - /* Either the dir is "/" or there are no slashes */ - if (endp == path) { - if (*endp == *dir_sep) { - return strdup("."); - } - else { - return strdup(dir_sep); - } - } else { - do { - endp--; - } while (endp > path && *endp == *dir_sep); - } + strcpy(dname, path); - if (endp - path + 2 > sizeof(bname)) { - return NULL; + /* Strip trailing slashes */ + endp = dname + strlen(dname) - 1; + while (endp > dname && *endp == *dir_sep) { + *endp = '\0'; + endp--; } - strncpy(bname, path, endp - path + 1); - return bname; + endp = strrchr(dname, *dir_sep); + if (endp == NULL) + return strdup("."); + if (endp > dname) + *endp = '\0'; + return strdup(dname); } + void par_init_env () { char *buf; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PAR-Packer-1.055/script/par.pl new/PAR-Packer-1.056/script/par.pl --- old/PAR-Packer-1.055/script/par.pl 2022-07-03 17:59:12.000000000 +0200 +++ new/PAR-Packer-1.056/script/par.pl 2022-09-05 12:07:25.000000000 +0200 @@ -154,8 +154,39 @@ =cut +my ($PAR_MAGIC, $FILE_offset_size, $CACHE_marker, $cache_name_size); +# NOTE: must initialize them in BEGIN as they are used in BEGIN below +BEGIN { + $PAR_MAGIC = "\nPAR.pm\n"; + $FILE_offset_size = 4; # pack("N") + $cache_marker = "\0CACHE"; + $cache_name_size = 40; +} + + +# Search $fh for the "\nPAR.pm\n signature backward from the end of the file +sub find_par_magic +{ + my ($fh) = @_; -my ($PAR_MAGIC, $par_temp, $progname, @tmpfile, %ModuleCache); + my $chunk_size = 64 * 1024; + my $buf; + my $size = -s $fh; + + my $pos = $size - $size % $chunk_size; # NOTE: $pos is a multiple of $chunk_size + while ($pos >= 0) { + seek $fh, $pos, 0; + read $fh, $buf, $chunk_size + length($PAR_MAGIC); + if ((my $i = rindex($buf, $PAR_MAGIC)) >= 0) { + $pos += $i; + return $pos; + } + $pos -= $chunk_size; + } + return -1; +} + +my ($par_temp, $progname, @tmpfile, %ModuleCache); END { if ($ENV{PAR_CLEAN}) { require File::Temp; require File::Basename; @@ -204,9 +235,8 @@ } } } -BEGIN { - $PAR_MAGIC = "\nPAR.pm\n"; +BEGIN { Internals::PAR::BOOT() if defined &Internals::PAR::BOOT; eval { @@ -240,20 +270,7 @@ } # Search for the "\nPAR.pm\n signature backward from the end of the file - my $chunk_size = 64 * 1024; - my $buf; - my $size = -s _FH; - - my $magic_pos = $size - $size % $chunk_size; # NOTE: $magic_pos is a multiple of $chunk_size - while ($magic_pos >= 0) { - seek _FH, $magic_pos, 0; - read _FH, $buf, $chunk_size + length($PAR_MAGIC); - if ((my $i = rindex($buf, $PAR_MAGIC)) >= 0) { - $magic_pos += $i; - last; - } - $magic_pos -= $chunk_size; - } + my $magic_pos = find_par_magic(*_FH); if ($magic_pos < 0) { outs(qq[Can't find magic string "$PAR_MAGIC" in file "$progname"]); last MAGIC; @@ -262,11 +279,11 @@ # Seek 4 bytes backward from the signature to get the offset of the # first embedded FILE, then seek to it - seek _FH, $magic_pos - 4, 0; - read _FH, $buf, 4; + seek _FH, $magic_pos - $FILE_offset_size, 0; + read _FH, $buf, $FILE_offset_size; my $offset = unpack("N", $buf); outs("Offset from start of FILEs is $offset"); - seek _FH, $magic_pos - 4 - $offset, 0; + seek _FH, $magic_pos - $FILE_offset_size - $offset, 0; $data_pos = tell _FH; # }}} @@ -382,7 +399,6 @@ delete $ENV{PAR_APP_REUSE}; # sanitize (REUSE may be a security problem) -$quiet = 0 unless $ENV{PAR_DEBUG}; # Don't swallow arguments for compiled executables without --par-options if (!$start_pos or ($ARGV[0] eq '--par-options' && shift)) { my %dist_cmd = qw( @@ -477,6 +493,15 @@ } + # Extract the "par" dictionary from META.yml in $zip + my %meta_par = do { + if ($zip and my $meta = $zip->contents('META.yml')) { + $meta =~ s/.*^par:$//ms; + $meta =~ s/^\S.*//ms; + $meta =~ /^ ([^:]+): (.+)$/mg; + } + }; + # Open input and output files {{{ if (defined $par) { @@ -511,6 +536,18 @@ PAR::Filter::PodStrip->apply(\$loader, $0); } + # Patch a certain string in $loader + if ($meta_par{clean}) { + my $par_clean = "=1"; + my $pass_par_clean = uc "__pass_par_clean__"; + # NOTE: we avoid to mention the contents of pass_par_clean so that + # this file doesn't contain it **at all** + + $loader =~ s{(?<=${pass_par_clean})( +)} + {$par_clean . (" " x (length($1) - length($par_clean)))}eg; + # NOTE: the replacement must be the same number of bytes as the match + } + $fh->print($loader) or die qq[Error writing loader to "$out": $!]; # }}} @@ -611,7 +648,7 @@ or die qq[Error writing zip part of "$out"]; } - $cache_name = substr $cache_name, 0, 40; + $cache_name = substr $cache_name, 0, $cache_name_size; if (!$cache_name and my $mtime = (stat($out))[9]) { my $ctx = Digest::SHA->new(1); open my $th, "<:raw", $out; @@ -620,8 +657,8 @@ $cache_name = $ctx->hexdigest; } - $cache_name .= "\0" x (40 - length $cache_name); - $cache_name .= "\0CACHE"; + $cache_name .= "\0" x ($cache_name_size - length $cache_name); + $cache_name .= $cache_marker; # compute the offset from the end of $loader to end of "...\0CACHE" my $offset = $fh->tell + length($cache_name) - length($loader); $fh->print($cache_name, @@ -664,19 +701,6 @@ or die qq[Error reading zip archive "$progname"]; Archive::Zip::setChunkSize(64 * 1024); - $quiet = !$ENV{PAR_DEBUG}; - - outs("Reading META.yml..."); - if (my $meta = $zip->contents('META.yml')) { - # check par.clean - $meta =~ s/.*^par:\s*$//ms; - $meta =~ s/^\S.*//ms; - if (my ($clean) = $meta =~ /^\s+clean: (.*)$/m) { - $clean =~ /^\s*|\s*$/g; - $ENV{PAR_CLEAN} = 1 if $clean; - } - } - push @PAR::LibCache, $zip; $PAR::LibCache{$progname} = $zip; @@ -796,43 +820,42 @@ else { $username = $ENV{USERNAME} || $ENV{USER} || 'SYSTEM'; } - $username =~ s/\W/_/g; my $stmpdir = "$path$sys{_delim}par-".unpack("H*", $username); mkdir $stmpdir, 0755; - if (!$ENV{PAR_CLEAN} and my $mtime = (stat($progname))[9]) { - open my $fh, "<:raw", $progname or die qq[Can't read "$progname": $!]; - seek $fh, -18, 2; - my $buf; - read $fh, $buf, 6; - if ($buf eq "\0CACHE") { - seek $fh, -58, 2; - read $fh, $buf, 41; - $buf =~ s/\0//g; - $stmpdir .= "$sys{_delim}cache-$buf"; - } - else { - my $digest = eval - { - require Digest::SHA; - my $ctx = Digest::SHA->new(1); - open my $fh, "<:raw", $progname or die qq[Can't read "$progname": $!]; - $ctx->addfile($fh); - close($fh); - $ctx->hexdigest; - } || $mtime; - $stmpdir .= "$sys{_delim}cache-$digest"; - } - close($fh); + my $cache_dir; + if ($ENV{PAR_CLEAN}) { + $cache_dir = "temp-$$"; } else { + open my $fh, "<:raw", $progname or die qq[Can't read "$progname": $!]; + if ((my $magic_pos = find_par_magic($fh)) >= 0) { + seek $fh, $magic_pos + - $FILE_offset_size + - length($cache_marker), 0; + my $buf; + read $fh, $buf, length($cache_marker); + if ($buf eq $cache_marker) { + seek $fh, $magic_pos + - $FILE_offset_size + - length($cache_marker) + - $cache_name_size, 0; + read $fh, $buf, $cache_name_size; + $buf =~ s/\0//g; + $cache_dir = "cache-$buf"; + } + } + close $fh; + } + if (!$cache_dir) { + $cache_dir = "temp-$$"; $ENV{PAR_CLEAN} = 1; - $stmpdir .= "$sys{_delim}temp-$$"; } + $stmpdir .= "$sys{_delim}$cache_dir"; - $ENV{PAR_TEMP} = $stmpdir; mkdir $stmpdir, 0755; + $ENV{PAR_TEMP} = $stmpdir; last; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PAR-Packer-1.055/t/90-gh66.t new/PAR-Packer-1.056/t/90-gh66.t --- old/PAR-Packer-1.055/t/90-gh66.t 1970-01-01 01:00:00.000000000 +0100 +++ new/PAR-Packer-1.056/t/90-gh66.t 2022-09-05 12:04:03.000000000 +0200 @@ -0,0 +1,30 @@ +#!/usr/bin/perl + +use strict; +use warnings; +use File::Basename; + +use Test::More; +require "./t/utils.pl"; + +plan tests => 10; + +my ($exe, $out, %val); +my $script = 'print qq[PAR_TEMP=$ENV{PAR_TEMP}\nPAR_CLEAN=$ENV{PAR_CLEAN}\n]'; + +$exe = pp_ok( -e => $script ); +($out) = run_ok($exe); +#diag($out); +%val = $out =~ /^(PAR_\w+)=(.*)$/gm; +like( basename($val{PAR_TEMP}), qr/^cache-/, "$val{PAR_TEMP} is a persistent cache directory" ); +ok(!$val{PAR_CLEAN}, "won't clean"); +ok(-d $val{PAR_TEMP}, "cache directory still exists"); + +$exe = pp_ok( "--clean", -e => $script ); +($out) = run_ok($exe); +#diag($out); +%val = $out =~ /^(PAR_\w+)=(.*)$/gm; +like( basename($val{PAR_TEMP}), qr/^temp-/, "$val{PAR_TEMP} is an ephemeral cache directory" ); +ok($val{PAR_CLEAN}, "will clean"); +ok(!-e $val{PAR_TEMP}, "cache directory has been removed"); +