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-01-26 21:27:06 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-PAR-Packer (Old) and /work/SRC/openSUSE:Factory/.perl-PAR-Packer.new.1938 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-PAR-Packer" Wed Jan 26 21:27:06 2022 rev:19 rq:949213 version:1.053 Changes: -------- --- /work/SRC/openSUSE:Factory/perl-PAR-Packer/perl-PAR-Packer.changes 2021-01-15 19:46:11.982019269 +0100 +++ /work/SRC/openSUSE:Factory/.perl-PAR-Packer.new.1938/perl-PAR-Packer.changes 2022-01-26 21:27:53.857614646 +0100 @@ -1,0 +2,20 @@ +Wed Jan 26 03:07:24 UTC 2022 - Tina M??ller <timueller+p...@suse.de> + +- updated to 1.053 + see /usr/share/doc/packages/perl-PAR-Packer/Changes + + 1.053 2022-01-25 + - Fix: merge PR #56 from from Philip Kime <phi...@kime.org.uk>: + Updating OSX codesign fix util with fix for automatically added ad-hoc signatures on OSX 12+ + - Fix: merge PR #42 from Andrew-Kulpa/master: + Get exe size from file handle instead of path + - Fix: prevent TABs in literal makefile fragments from being expanded + - Cleanups: + - par_findprog(): pass a copy of argument `path?? to strtok() + - simplify searching for PAR magic + - consolidate die()s + - add a test for GitHub #41 + - add error message when exec'ing the custom perl fails in myldr/boot + - untangle %require_list and %ModuleCache + +------------------------------------------------------------------- Old: ---- PAR-Packer-1.052.tar.gz New: ---- PAR-Packer-1.053.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-PAR-Packer.spec ++++++ --- /var/tmp/diff_new_pack.ZWlWOa/_old 2022-01-26 21:27:54.641609240 +0100 +++ /var/tmp/diff_new_pack.ZWlWOa/_new 2022-01-26 21:27:54.649609185 +0100 @@ -1,7 +1,7 @@ # # spec file for package perl-PAR-Packer # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %define cpan_name PAR-Packer Name: perl-PAR-Packer -Version: 1.052 +Version: 1.053 Release: 0 Summary: PAR Packager License: Artistic-1.0 OR GPL-1.0-or-later ++++++ PAR-Packer-1.052.tar.gz -> PAR-Packer-1.053.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PAR-Packer-1.052/Changes new/PAR-Packer-1.053/Changes --- old/PAR-Packer-1.052/Changes 2021-01-13 16:09:20.000000000 +0100 +++ new/PAR-Packer-1.053/Changes 2022-01-25 15:51:23.000000000 +0100 @@ -1,3 +1,21 @@ +1.053 2022-01-25 + +- Fix: merge PR #56 from from Philip Kime <phi...@kime.org.uk>: + Updating OSX codesign fix util with fix for automatically added ad-hoc signatures on OSX 12+ + +- Fix: merge PR #42 from Andrew-Kulpa/master: + Get exe size from file handle instead of path + +- Fix: prevent TABs in literal makefile fragments from being expanded + +- Cleanups: + - par_findprog(): pass a copy of argument `path?? to strtok() + - simplify searching for PAR magic + - consolidate die()s + - add a test for GitHub #41 + - add error message when exec'ing the custom perl fails in myldr/boot + - untangle %require_list and %ModuleCache + 1.052 2021-01-13 - add note that --filter and __DATA__ are incompatible (cf. #36, #39) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PAR-Packer-1.052/MANIFEST new/PAR-Packer-1.053/MANIFEST --- old/PAR-Packer-1.052/MANIFEST 2021-01-13 16:42:10.000000000 +0100 +++ new/PAR-Packer-1.053/MANIFEST 2022-01-25 16:21:49.000000000 +0100 @@ -70,6 +70,7 @@ t/80-doublecolon.t t/85-crt-glob.t t/85-myfile.t +t/90-gh41.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.052/MANIFEST.SKIP new/PAR-Packer-1.053/MANIFEST.SKIP --- old/PAR-Packer-1.052/MANIFEST.SKIP 2020-08-16 14:16:48.000000000 +0200 +++ new/PAR-Packer-1.053/MANIFEST.SKIP 2022-01-25 16:17:05.000000000 +0100 @@ -1,4 +1,79 @@ -#!include_default + +#!start included /usr/share/perl/5.32/ExtUtils/MANIFEST.SKIP +# Avoid version control files. +\bRCS\b +\bCVS\b +\bSCCS\b +,v$ +\B\.svn\b +\B\.git\b +\B\.gitignore\b +\b_darcs\b +\B\.cvsignore$ + +# Avoid VMS specific MakeMaker generated files +\bDescrip.MMS$ +\bDESCRIP.MMS$ +\bdescrip.mms$ + +# Avoid Makemaker generated and utility files. +\bMANIFEST\.bak +\bMakefile$ +\bblib/ +\bMakeMaker-\d +\bpm_to_blib\.ts$ +\bpm_to_blib$ +\bblibdirs\.ts$ # 6.18 through 6.25 generated this +\b_eumm/ # 7.05_05 and above + +# Avoid Module::Build generated and utility files. +\bBuild$ +\b_build/ +\bBuild.bat$ +\bBuild.COM$ +\bBUILD.COM$ +\bbuild.com$ + +# and Module::Build::Tiny generated files +\b_build_params$ + +# Avoid temp and backup files. +~$ +\.old$ +\#$ +\b\.# +\.bak$ +\.tmp$ +\.# +\.rej$ +\..*\.sw.?$ + +# Avoid OS-specific files/dirs +# Mac OSX metadata +\B\.DS_Store +# Mac OSX SMB mount metadata files +\B\._ + +# Avoid Devel::Cover and Devel::CoverX::Covered files. +\bcover_db\b +\bcovered\b + +# Avoid prove files +\B\.prove$ + +# Avoid MYMETA files +^MYMETA\. + +# Temp files for new META +^META_new\.(?:json|yml) + +# Avoid travis-ci.org file +^\.travis\.yml + +# Avoid AppVeyor file +^\.?appveyor.yml +#!end included /usr/share/perl/5.32/ExtUtils/MANIFEST.SKIP + ^contrib/automated_pp_test/pp_switch_tests ^myldr/Makefile$ ^myldr/Makefile\.old$ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PAR-Packer-1.052/META.json new/PAR-Packer-1.053/META.json --- old/PAR-Packer-1.052/META.json 2021-01-13 16:42:10.000000000 +0100 +++ new/PAR-Packer-1.053/META.json 2022-01-25 16:21:49.000000000 +0100 @@ -78,6 +78,6 @@ }, "x_MailingList" : "mailto:p...@perl.org" }, - "version" : "1.052", - "x_serialization_backend" : "JSON::PP version 4.05" + "version" : "1.053", + "x_serialization_backend" : "JSON::PP version 4.07" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PAR-Packer-1.052/META.yml new/PAR-Packer-1.053/META.yml --- old/PAR-Packer-1.052/META.yml 2021-01-13 16:42:10.000000000 +0100 +++ new/PAR-Packer-1.053/META.yml 2022-01-25 16:21:49.000000000 +0100 @@ -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.052' +version: '1.053' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PAR-Packer-1.052/Makefile.PL new/PAR-Packer-1.053/Makefile.PL --- old/PAR-Packer-1.052/Makefile.PL 2021-01-13 14:56:15.000000000 +0100 +++ new/PAR-Packer-1.053/Makefile.PL 2021-01-20 18:18:19.000000000 +0100 @@ -4,6 +4,7 @@ use ExtUtils::MakeMaker; use ExtUtils::CBuilder; +use Config; if ($] == 5.010000) { # 5.10.0 breaks how PAR intercepts loading of shared libraries @@ -17,7 +18,7 @@ sub if_win { return ($^O eq 'MSWin32') ? @_ : (); } my $have_cc = ExtUtils::CBuilder->new->have_compiler; -warn "No compiler found, won't generate 'script/parl$Config::Config{_exe}!\n" +warn "No compiler found, won't generate 'script/parl$Config{_exe}!\n" unless $have_cc; WriteMakefile1( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PAR-Packer-1.052/contrib/pp_osx_codesign_fix/pp_osx_codesign_fix.c new/PAR-Packer-1.053/contrib/pp_osx_codesign_fix/pp_osx_codesign_fix.c --- old/PAR-Packer-1.052/contrib/pp_osx_codesign_fix/pp_osx_codesign_fix.c 2020-03-08 23:54:55.000000000 +0100 +++ new/PAR-Packer-1.053/contrib/pp_osx_codesign_fix/pp_osx_codesign_fix.c 2022-01-25 15:15:38.000000000 +0100 @@ -1,26 +1,10 @@ -/* - * Copyright (c) 2019 Todd Philip Kime <phi...@kime.org.uk> - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - - -/* - * Build on OSX 64-bit with: - * - * gcc pp_osx_codesign_fix.c -o pp_osx_codesign_fix.c - */ +/* -*- C -*- main.c */ + +/* compile with: + + gcc -std=c99 pp_osx_codesign_fix.c -o pp_osx_codesign_fix + +*/ #include <stdio.h> #include <stdlib.h> @@ -71,16 +55,58 @@ off_t load_commands_offset = header_size; uint32_t ncmds = header->ncmds; + /* + First get rid of any code signature - on OSX 12+, an ad-hoc signature is automatically + put into the pp binary and nothing can be done with the headers until this is removed since + it otherwise overlaps the string table. The assumption here is that the string table comes last + in the load commands but if there is a signature, that's last + */ + off_t current_offset = load_commands_offset; + bool found_sig = FALSE; for (uint32_t i = 0U; i < ncmds; i++) { struct load_command *cmd = load_bytes(obj_file, current_offset, sizeof(struct load_command)); + if (cmd->cmd == LC_CODE_SIGNATURE) { + found_sig = TRUE; + printf("Found Signature, removing ...\n"); + + /* Zero out the signature itself */ + struct linkedit_data_command *command = load_bytes(obj_file, current_offset, sizeof(struct linkedit_data_command)); + write_bytes(obj_file, command->dataoff, command->datasize, calloc(1, command->datasize)); + free(command); + + /* Remove LC for signature */ + write_bytes(obj_file, current_offset, sizeof(struct linkedit_data_command), calloc(1, 0)); + + break; + + } + current_offset += cmd->cmdsize; + } + + if (found_sig) { + printf("Rewriting header info ...\n"); + + header->ncmds -= 1; + header->sizeofcmds -= sizeof(struct linkedit_data_command); + + /* Re-write the header */ + write_bytes(obj_file, 0, header_size, header); + } + + + /* reset offset and start again with the LCs */ + current_offset = load_commands_offset; + for (uint32_t i = 0U; i < ncmds; i++) { + struct load_command *cmd = load_bytes(obj_file, current_offset, sizeof(struct load_command)); + + /* + __LINKEDIT.File Size = .exe size - __LINKEDIT.File Offset + __LINKEDIT.VM Size = .exe size - __LINKEDIT.File Offset + */ if (cmd->cmd == LC_SEGMENT_64) { struct segment_command_64 *segment = load_bytes(obj_file, current_offset, sizeof(struct segment_command_64)); - /* - __LINKEDIT.File Size = .exe size - __LINKEDIT.File Offset - __LINKEDIT.VM Size = .exe size - __LINKEDIT.File Offset - */ if (strcmp(segment->segname, "__LINKEDIT") == 0) { printf("Correcting __LINKEDIT\n"); printf(" Old File Size: %i\n", (int)segment->filesize); @@ -93,10 +119,11 @@ free(segment); } } - else if (cmd->cmd == LC_SYMTAB) { - /* - LC_SYMTAB.String Table Size = .exe size - String Table Offset - */ + + /* + LC_SYMTAB.String Table Size = .exe size - String Table Offset + */ + if (cmd->cmd == LC_SYMTAB) { struct symtab_command *symtab = load_bytes(obj_file, current_offset, sizeof(struct symtab_command)); printf("Correcting LC_SYMTAB\n"); printf(" Old String Table Size: %i\n", (int)symtab->strsize); @@ -107,7 +134,6 @@ } current_offset += cmd->cmdsize; - free(cmd); } free(header); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PAR-Packer-1.052/lib/PAR/Packer.pm new/PAR-Packer-1.053/lib/PAR/Packer.pm --- old/PAR-Packer-1.052/lib/PAR/Packer.pm 2020-12-04 10:41:26.000000000 +0100 +++ new/PAR-Packer-1.053/lib/PAR/Packer.pm 2021-01-20 18:17:41.000000000 +0100 @@ -3,7 +3,7 @@ use strict; use warnings; -our $VERSION = '1.052'; +our $VERSION = '1.053'; =head1 NAME @@ -108,8 +108,7 @@ # $self->{parl} ||= $self->_extract_parl('PAR::StrippedPARL::Static') # or die("Can't find par loader"); # $self->{parl_is_temporary} = 1; - $self->{dynperl} ||= - $Config{useshrplib} && ($Config{useshrplib} ne 'false'); + $self->{dynperl} ||= $Config{useshrplib} && ($Config{useshrplib} ne 'false'); $self->{script_name} = $opt{script_name} || $0; } @@ -1490,7 +1489,7 @@ $file = abs_path($file); - while ($Config::Config{d_symlink} and -l $file) { + while ($Config{d_symlink} and -l $file) { if ($file =~ /^(.*?\.\Q$Config{dlext}\E\.\d+)\..*/) { return $1 if -e $1; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PAR-Packer-1.052/lib/PAR/StrippedPARL/Base.pm new/PAR-Packer-1.053/lib/PAR/StrippedPARL/Base.pm --- old/PAR-Packer-1.052/lib/PAR/StrippedPARL/Base.pm 2020-03-08 23:54:55.000000000 +0100 +++ new/PAR-Packer-1.053/lib/PAR/StrippedPARL/Base.pm 2021-01-20 18:16:14.000000000 +0100 @@ -7,7 +7,7 @@ use File::Temp (); use File::Spec; use Cwd; -use Config (); +use Config; =head1 NAME @@ -54,7 +54,7 @@ # write out to a temporary file first my ($fh, $tfile) = File::Temp::tempfile( - "parlXXXX", SUFFIX => $Config::Config{_exe}||'', TMPDIR => 1, UNLINK => 1); + "parlXXXX", SUFFIX => $Config{_exe}||'', TMPDIR => 1, UNLINK => 1); close $fh; if (not $class->write_raw($tfile)) { @@ -90,7 +90,7 @@ sub get_raw { my $class = shift; - my $pos = $class->_data_pos(); + my $pos = $class->_data_pos(); if (not defined $pos) { warn "${class}->_data_pos() did not return the original tell() position of the DATA file handle"; return(); @@ -155,7 +155,7 @@ Copyright 2006-2009 by Steffen Mueller E<lt>smuel...@cpan.orge<gt>. -This program is free software; you can redistribute it and/or +This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See F<LICENSE>. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PAR-Packer-1.052/myldr/Makefile.PL new/PAR-Packer-1.053/myldr/Makefile.PL --- old/PAR-Packer-1.052/myldr/Makefile.PL 2020-12-04 10:41:26.000000000 +0100 +++ new/PAR-Packer-1.053/myldr/Makefile.PL 2022-01-25 15:10:29.000000000 +0100 @@ -1,4 +1,6 @@ #!perl +# vim: set noexpandtab: don't mung makefile fragments in <<strings + # Copyright 2002-2009 by Audrey Tang. # Copyright (c) 2002 Mattia Barbon. # This package is free software; you can redistribute it and/or @@ -41,11 +43,11 @@ foreach my $path (@paths) { $libperl = catfile($path, $file); return $libperl if -e $libperl; - + # for MinGW $libperl = catfile($path, $1) if $file =~ /^lib(.+)/; return $libperl if -e $libperl; - + # for Cygwin $libperl = catfile($path, $file.$Config{_a}); return $libperl if -e $libperl; @@ -170,11 +172,11 @@ if ($dynperl) { # on Debian derived distros make sure that the Debian package "libperl-dev" # is installed (which contains the /usr/lib/libperl.so symlink) - die qq[You need to install the distro (Debian, Ubuntu etc) package "libperl-dev"\n] + die qq[You need to install the distro (Debian, Ubuntu etc) package "libperl-dev"\n] if $^O =~ /^(linux|gnukfreebsd)$/i - && -x "/usr/bin/dpkg" + && -x "/usr/bin/dpkg" # probably Debian or a derivative - && system("dpkg -S $^X >/dev/null 2>&1") == 0 + && system("dpkg -S $^X >/dev/null 2>&1") == 0 # we're building with the system (distro) perl && system("dpkg -l libperl-dev >/dev/null 2>&1") != 0; # check install status of libperl-dev @@ -201,7 +203,7 @@ # Determine whether we can find a config.h. If yes, include it in # usernamefrompwuid.h. If not, set I_PWD to undefined in that header. # -- Steffen -my $configh = "$Config::Config{archlibexp}/CORE/config.h"; +my $configh = "$Config{archlibexp}/CORE/config.h"; open PWOUT, '> usernamefrompwuid.h' or die "open 'usernamefrompwuid.h': $!"; if (not -f $configh) { print PWOUT "#undef I_PWD\n"; @@ -264,7 +266,7 @@ $mt_cmd my_par_pl.c: $par_pl - \$(PERLRUN) par_pl2c.pl my_par_pl < $par_pl > \$@ + \$(PERLRUN) par_pl2c.pl my_par_pl < $par_pl > \$@ $parl_exe: $par \$(PERLRUN) -Mblib=.. run_with_inc.pl $par -q -B -O\$@ @@ -290,7 +292,7 @@ for ($^O) { # sane platforms: use "ldd" - if (/linux|solaris|freebsd|openbsd|cygwin/i) + if (/linux|solaris|freebsd|openbsd|cygwin/i) { print STDERR qq[# using "ldd" to find shared libraries needed by $par_exe\n]; $method = "ldd"; @@ -298,8 +300,8 @@ } # Mac OS X: use "otool -L" if available # Note: old versions of otool don't accept --version - if (/darwin/i && (qx(otool --version 2>&1) - || qx(otool -h /bin/ls 2>&1), $? == 0)) + if (/darwin/i && (qx(otool --version 2>&1) + || qx(otool -h /bin/ls 2>&1), $? == 0)) { print STDERR qq[# using "otool -L" to find shared libraries needed by $par_exe\n]; $method = "otool"; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PAR-Packer-1.052/myldr/boot.c new/PAR-Packer-1.053/myldr/boot.c --- old/PAR-Packer-1.052/myldr/boot.c 2020-03-08 23:54:55.000000000 +0100 +++ new/PAR-Packer-1.053/myldr/boot.c 2021-04-06 10:31:08.000000000 +0200 @@ -5,6 +5,8 @@ #else #include <sys/types.h> #include <unistd.h> +#include <stdio.h> +#include <stdarg.h> #endif #include "mktmpdir.c" @@ -158,6 +160,16 @@ } #endif +void die(const char *format, ...) +{ + va_list ap; + va_start(ap, format); + vfprintf(stderr, format, ap); + va_end(ap); + + exit(255); +} + char pp_version_info[] = "@(#) Packed by PAR::Packer " PAR_PACKER_VERSION; int main ( int argc, char **argv, char **env ) @@ -178,28 +190,24 @@ #endif #endif -#define DIE exit(255) - par_init_env(); stmpdir = par_mktmpdir( argv ); - if ( !stmpdir ) DIE; /* error message has already been printed */ + if ( !stmpdir ) die(""); /* error message has already been printed */ rc = my_mkdir(stmpdir, 0700); if ( rc == -1 && errno != EEXIST) { - fprintf(stderr, "%s: creation of private cache subdirectory %s failed (errno= %i)\n", - argv[0], stmpdir, errno); - DIE; + die("%s: creation of private cache subdirectory %s failed (errno= %i)\n", + argv[0], stmpdir, errno); } /* extract embedded_files[0] (i.e. the custom Perl interpreter) * into stmpdir (but under the same basename as argv[0]) */ - my_prog = par_findprog(argv[0], strdup(par_getenv("PATH"))); + my_prog = par_findprog(argv[0], par_getenv("PATH")); rc = extract_embedded_file(embedded_files, par_basename(my_prog), stmpdir, &my_perl); if (rc == EXTRACT_FAIL) { - fprintf(stderr, "%s: extraction of %s (custom Perl interpreter) failed (errno=%i)\n", - argv[0], my_perl, errno); - DIE; + die("%s: extraction of %s (custom Perl interpreter) failed (errno=%i)\n", + argv[0], my_perl, errno); } if (rc == EXTRACT_OK) /* i.e. file didn't already exist */ @@ -239,9 +247,8 @@ emb_file = embedded_files + 1; while (emb_file->name) { if (extract_embedded_file(emb_file, emb_file->name, stmpdir, &my_file) == EXTRACT_FAIL) { - fprintf(stderr, "%s: extraction of %s failed (errno=%i)\n", - argv[0], my_file, errno); - DIE; + die("%s: extraction of %s failed (errno=%i)\n", + argv[0], my_file, errno); } emb_file++; } @@ -278,7 +285,8 @@ exit(rc); #else execvp(my_perl, argv); - DIE; + die("%s: exec of %s (custom Perl interpreter) failed (errno=%i)\n", + argv[0], my_perl, errno); #endif } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PAR-Packer-1.052/myldr/mktmpdir.c new/PAR-Packer-1.053/myldr/mktmpdir.c --- old/PAR-Packer-1.052/myldr/mktmpdir.c 2020-03-08 23:54:55.000000000 +0100 +++ new/PAR-Packer-1.053/myldr/mktmpdir.c 2021-04-06 10:31:54.000000000 +0200 @@ -194,7 +194,7 @@ /* Doesn't really work - XXX */ val = par_getenv( "PATH" ); if (val != NULL) - progname = par_findprog(argv[0], strdup(val)); + progname = par_findprog(argv[0], val); if (progname == NULL) progname = argv[0]; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PAR-Packer-1.052/myldr/utils.c new/PAR-Packer-1.053/myldr/utils.c --- old/PAR-Packer-1.052/myldr/utils.c 2020-03-08 23:54:55.000000000 +0100 +++ new/PAR-Packer-1.053/myldr/utils.c 2021-04-06 10:33:36.000000000 +0200 @@ -82,7 +82,7 @@ -char *par_findprog(char *prog, char *path) { +char *par_findprog(char *prog, const char *path) { char *p, filename[MAXPATHLEN]; /* char *ret; */ /* Commented out for reason described below */ int proglen, plen; @@ -109,34 +109,18 @@ /* Special case if prog contains '/' */ if (strstr(prog, dir_sep)) { par_setenv("PAR_PROGNAME", prog); - return(prog); + return prog; } - /* I'm commenting out this block because using par_current_exec_proc() - * ends up breaking the PAR feature of inferring the script-to-be-run - * from the name of the executable in case of symlinks because /proc/ - * has the name of the executable and not that of the symlink. - */ -/* - #if defined __linux__ || defined __FreeBSD__ - ret = par_current_exec_proc(); - #else - ret = NULL; - #endif - - if( ret != NULL ) { - par_setenv( "PAR_PROGNAME", ret ); - return ret; - } -*/ - /* Walk through PATH (path), looking for ourself (prog). This fails if we are invoked in an obscure manner; 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(path, path_sep); + p = strtok(strdup(path), path_sep); + /* Note: use a copy of path as strtok() modifies its first argument */ + while ( p != NULL ) { if (*p == '\0') p = "."; @@ -154,20 +138,20 @@ if (plen + 1 + proglen >= MAXPATHLEN) { par_setenv("PAR_PROGNAME", prog); - return(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) { par_setenv("PAR_PROGNAME", filename); - return(strdup(filename)); + return strdup(filename); } p = strtok(NULL, path_sep); } par_setenv("PAR_PROGNAME", prog); - return(prog); + return prog; } @@ -179,7 +163,7 @@ if (*p == *dir_sep) base = p + 1; } - return (char *)base; + return (char*)base; } @@ -191,7 +175,7 @@ /* Empty or NULL string gets treated as "." */ if (path == NULL || *path == '\0') { - return(strdup(".")); + return strdup("."); } /* Strip trailing slashes */ @@ -216,11 +200,11 @@ } if (endp - path + 2 > sizeof(bname)) { - return(NULL); + return NULL; } strncpy(bname, path, endp - path + 1); - return(bname); + return bname; } void par_init_env () { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PAR-Packer-1.052/script/par.pl new/PAR-Packer-1.053/script/par.pl --- old/PAR-Packer-1.052/script/par.pl 2020-12-17 12:05:56.000000000 +0100 +++ new/PAR-Packer-1.053/script/par.pl 2021-04-05 23:22:05.000000000 +0200 @@ -205,9 +205,10 @@ } } BEGIN { - Internals::PAR::BOOT() if defined &Internals::PAR::BOOT; $PAR_MAGIC = "\nPAR.pm\n"; + Internals::PAR::BOOT() if defined &Internals::PAR::BOOT; + eval { _par_init_env(); @@ -215,38 +216,35 @@ my $quiet = !$ENV{PAR_DEBUG}; # fix $progname if invoked from PATH -my %Config = ( +my %sys = ( path_sep => ($^O =~ /^MSWin/ ? ';' : ':'), _exe => ($^O =~ /^(?:MSWin|OS2|cygwin)/ ? '.exe' : ''), _delim => ($^O =~ /^MSWin|OS2/ ? '\\' : '/'), ); _set_progname(); +outs(qq[\$progname = "$progname"]); + _set_par_temp(); +outs(qq[\$ENV{PAR_TEMP} = "$ENV{PAR_TEMP}"]); # Magic string checking and extracting bundled modules {{{ my ($start_pos, $data_pos); -{ +MAGIC: { local $SIG{__WARN__} = sub {}; # Check file type, get start of data section {{{ - open _FH, '<:raw', $progname or last; + unless (open _FH, '<:raw', $progname) { + outs(qq[Can't read from file "$progname"]); # don't use $! here as it requires Errno.pm + last MAGIC; + } # Search for the "\nPAR.pm\n signature backward from the end of the file - my $buf; - my $size = -s $progname; my $chunk_size = 64 * 1024; - my $magic_pos; - - if ($size <= $chunk_size) { - $magic_pos = 0; - } elsif ((my $m = $size % $chunk_size) > 0) { - $magic_pos = $size - $m; - } else { - $magic_pos = $size - $chunk_size; - } - # in any case, $magic_pos is a multiple of $chunk_size + 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); @@ -256,7 +254,10 @@ } $magic_pos -= $chunk_size; } - last if $magic_pos < 0; + if ($magic_pos < 0) { + outs(qq[Can't find magic string "$PAR_MAGIC" in file "$progname"]); + last MAGIC; + } # Seek 4 bytes backward from the signature to get the offset of the # first embedded FILE, then seek to it @@ -292,12 +293,12 @@ outs("SHLIB: $filename\n"); } else { - $require_list{$fullname} = $ModuleCache{$fullname} = { buf => $buf, crc => $crc, name => $fullname, }; + $require_list{$fullname}++; } read _FH, $buf, 4; } @@ -308,7 +309,10 @@ return if ref $module or !$module; - my $info = delete $require_list{$module} or return; + my $info = $ModuleCache{$module}; + return unless $info; + + delete $require_list{$module}; $INC{$module} = "/loader/$info/$module"; @@ -321,6 +325,7 @@ } else { my $filename = _save_as("$info->{crc}.pm", $info->{buf}); + $info->{file} = $filename; open my $fh, '<:raw', $filename or die qq[Can't read "$filename": $!]; return $fh; @@ -359,7 +364,11 @@ # }}} - last unless $buf eq "PK\003\004"; + unless ($buf eq "PK\003\004") { + outs(qq[No zip found after FILE section in file "$progname"]); + last MAGIC ; + } + $start_pos = (tell _FH) - 4; # start of zip } # }}} @@ -527,6 +536,7 @@ require_modules(); + # NOTE: use $Config::Config{...} since we only "require" (*not* "use") it - no import my @inc = grep { !/BSDPAN/ } grep { ($bundle ne 'site') or @@ -662,7 +672,6 @@ $PAR::LibCache{$progname} = $zip; $quiet = !$ENV{PAR_DEBUG}; - outs(qq[\$ENV{PAR_TEMP} = "$ENV{PAR_TEMP}"]); if (defined $ENV{PAR_TEMP}) { # should be set at this point! foreach my $member ( $zip->members ) { @@ -779,7 +788,7 @@ } $username =~ s/\W/_/g; - my $stmpdir = "$path$Config{_delim}par-".unpack("H*", $username); + 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": $!]; @@ -790,7 +799,7 @@ seek $fh, -58, 2; read $fh, $buf, 41; $buf =~ s/\0//g; - $stmpdir .= "$Config{_delim}cache-$buf"; + $stmpdir .= "$sys{_delim}cache-$buf"; } else { my $digest = eval @@ -803,13 +812,13 @@ $ctx->hexdigest; } || $mtime; - $stmpdir .= "$Config{_delim}cache-$digest"; + $stmpdir .= "$sys{_delim}cache-$digest"; } close($fh); } else { $ENV{PAR_CLEAN} = 1; - $stmpdir .= "$Config{_delim}temp-$$"; + $stmpdir .= "$sys{_delim}temp-$$"; } $ENV{PAR_TEMP} = $stmpdir; @@ -857,40 +866,40 @@ $progname ||= $0; if ($ENV{PAR_TEMP} and index($progname, $ENV{PAR_TEMP}) >= 0) { - $progname = substr($progname, rindex($progname, $Config{_delim}) + 1); + $progname = substr($progname, rindex($progname, $sys{_delim}) + 1); } - if (!$ENV{PAR_PROGNAME} or index($progname, $Config{_delim}) >= 0) { + if (!$ENV{PAR_PROGNAME} or index($progname, $sys{_delim}) >= 0) { if (open my $fh, '<', $progname) { return if -s $fh; } - if (-s "$progname$Config{_exe}") { - $progname .= $Config{_exe}; + if (-s "$progname$sys{_exe}") { + $progname .= $sys{_exe}; return; } } - foreach my $dir (split /\Q$Config{path_sep}\E/, $ENV{PATH}) { + foreach my $dir (split /\Q$sys{path_sep}\E/, $ENV{PATH}) { next if exists $ENV{PAR_TEMP} and $dir eq $ENV{PAR_TEMP}; - $dir =~ s/\Q$Config{_delim}\E$//; - (($progname = "$dir$Config{_delim}$progname$Config{_exe}"), last) - if -s "$dir$Config{_delim}$progname$Config{_exe}"; - (($progname = "$dir$Config{_delim}$progname"), last) - if -s "$dir$Config{_delim}$progname"; + $dir =~ s/\Q$sys{_delim}\E$//; + (($progname = "$dir$sys{_delim}$progname$sys{_exe}"), last) + if -s "$dir$sys{_delim}$progname$sys{_exe}"; + (($progname = "$dir$sys{_delim}$progname"), last) + if -s "$dir$sys{_delim}$progname"; } } sub _fix_progname { $0 = $progname ||= $ENV{PAR_PROGNAME}; - if (index($progname, $Config{_delim}) < 0) { - $progname = ".$Config{_delim}$progname"; + if (index($progname, $sys{_delim}) < 0) { + $progname = ".$sys{_delim}$progname"; } # XXX - hack to make PWD work my $pwd = (defined &Cwd::getcwd) ? Cwd::getcwd() : ((defined &Win32::GetCwd) ? Win32::GetCwd() : `pwd`); chomp($pwd); - $progname =~ s/^(?=\.\.?\Q$Config{_delim}\E)/$pwd$Config{_delim}/; + $progname =~ s/^(?=\.\.?\Q$sys{_delim}\E)/$pwd$sys{_delim}/; $ENV{PAR_PROGNAME} = $progname; } @@ -932,6 +941,7 @@ sub init_inc { require Config; + # NOTE: use $Config::Config{...} since we only "require" (*not* "use") it - no import push @INC, grep defined, map $Config::Config{$_}, qw( archlibexp privlibexp sitearchexp sitelibexp vendorarchexp vendorlibexp diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PAR-Packer-1.052/t/20-pp.t new/PAR-Packer-1.053/t/20-pp.t --- old/PAR-Packer-1.052/t/20-pp.t 2020-03-08 23:54:55.000000000 +0100 +++ new/PAR-Packer-1.053/t/20-pp.t 2021-01-20 18:19:57.000000000 +0100 @@ -78,7 +78,7 @@ my $_cmd = $cmd; return $_cmd if (-x $_cmd or $_cmd = MM->maybe_command($_cmd)); - for my $dir ((split /$Config::Config{path_sep}/, $ENV{PATH}), '.') { + for my $dir ((split /$Config{path_sep}/, $ENV{PATH}), '.') { my $abs = catfile($dir, $_[1]); return $abs if (-x $abs or $abs = MM->maybe_command($abs)); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PAR-Packer-1.052/t/90-gh41.t new/PAR-Packer-1.053/t/90-gh41.t --- old/PAR-Packer-1.052/t/90-gh41.t 1970-01-01 01:00:00.000000000 +0100 +++ new/PAR-Packer-1.053/t/90-gh41.t 2021-04-05 23:19:43.000000000 +0200 @@ -0,0 +1,17 @@ +#!/usr/bin/perl -w + +use strict; +use Cwd; + +use Test::More; +require "./t/utils.pl"; + +plan skip_all => "Tests only relevant on Windows" unless $^O eq 'MSWin32'; +plan tests => 3; + +my $exe = pp_ok(-e => "I'm OK"); + +# run $exe with path prefixed by '\\?\' +# cf. https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file +my ($out) = run_ok("\\\\?\\" . Cwd::abs_path($exe)); +is($out, "I'm OK", qq[executable invoked with path prefixed by "\\\\?\\" ran OK]);