{"thread":{"id":"26493","subject":"[PATCH] fixes for ActiveState Perl","startedAt":"2011-02-14T11:40:49Z","lastAt":"2011-02-23T00:59:21Z","messageCount":9,"participants":["Rafael Kitover","Erik Faye-Lund","Ævar Arnfjörð Bjarmason","Sverre Rabbelier"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"161040","messageId":"4D5914C1.9050008@io.com","threadId":"26493","inReplyTo":null,"subject":"[PATCH] fixes for ActiveState Perl","fromName":"Rafael Kitover","fromEmail":"rkitover@io.com","sentAt":"2011-02-14T11:40:49Z","receivedAt":"2011-02-14T11:40:49Z","isPatch":true,"sender":{"key":"rkitover@io.com","avatar":null},"body":"The make for perl is now retrieved from Perl's config. The make fragment in\nperl/Makefile.PL added in MY::postamble is disabled on Win32, as it relies on\nGNU make syntax, and Win32 users are not likely to have an ancient EU::MM\nversion.\n\nA Windows path for PERL_PATH is now supported as well, e.g.:\nmake PERL_PATH=C:\\\\Perl\\\\bin\\\\perl\nor from cmd.exe:\nmake PERL_PATH=C:\\Perl\\bin\\perl\n.\n\nt9700-perl-git.sh now passes on ActiveState Perl. Some tweaks were necessary in\nGit.pm: a more correct check for absolute directory, exit code check on closing\nthe \"pipe\", and always closing the cat_blob bidirectional pipe (with errors\n ignored) so as not to leave zombie processes. The waitpid call on closing the\nbidirectional pipe is now timed and the process is killed if necessary. Also\nadded some binmode calls to t/t9700/test.pl to make the blob tests pass.\n\nSigned-off-by: Rafael Kitover <rkitover@cpan.org>\n---\n Makefile         |    8 ++++----\n perl/Git.pm      |   40 +++++++++++++++++++++++++++++++---------\n perl/Makefile    |   14 ++++++++++++--\n perl/Makefile.PL |    7 ++++++-\n t/t9700/test.pl  |   15 ++++++++++++++-\n 5 files changed, 67 insertions(+), 17 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex d3dcfb1..3465ab5 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -175,7 +175,7 @@ all::\n # will work.\n #\n # Define NO_PERL_MAKEMAKER if you cannot use Makefiles generated by perl's\n-# MakeMaker (e.g. using ActiveState under Cygwin).\n+# MakeMaker.\n #\n # Define NO_PERL if you do not want Perl scripts or libraries at all.\n #\n@@ -1059,7 +1059,7 @@ ifeq ($(uname_S),Windows)\n \tNO_MKSTEMPS = YesPlease\n \tSNPRINTF_RETURNS_BOGUS = YesPlease\n \tNO_SVN_TESTS = YesPlease\n-\tNO_PERL_MAKEMAKER = YesPlease\n+\t# NO_PERL_MAKEMAKER = YesPlease\n \tRUNTIME_PREFIX = YesPlease\n \tNO_POSIX_ONLY_PROGRAMS = YesPlease\n \tNO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease\n@@ -1112,7 +1112,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))\n \tNO_MKDTEMP = YesPlease\n \tNO_MKSTEMPS = YesPlease\n \tNO_SVN_TESTS = YesPlease\n-\tNO_PERL_MAKEMAKER = YesPlease\n+\t# NO_PERL_MAKEMAKER = YesPlease\n \tRUNTIME_PREFIX = YesPlease\n \tNO_POSIX_ONLY_PROGRAMS = YesPlease\n \tNO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease\n@@ -1652,7 +1652,7 @@ perl/perl.mak: GIT-CFLAGS perl/Makefile perl/Makefile.PL\n \n $(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl\n \t$(QUIET_GEN)$(RM) $@ $@+ && \\\n-\tINSTLIBDIR=`MAKEFLAGS= $(MAKE) -C perl -s --no-print-directory instlibdir` && \\\n+\tINSTLIBDIR=`MAKEFLAGS= $(MAKE) -C perl -s --no-print-directory instlibdir | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g' -e \"s/'//g\"` && \\\n \tsed -e '1{' \\\n \t    -e '\ts|#!.*perl|#!$(PERL_PATH_SQ)|' \\\n \t    -e '\th' \\\ndiff --git a/perl/Git.pm b/perl/Git.pm\nindex 6cb0dd1..f7d99bd 100644\n--- a/perl/Git.pm\n+++ b/perl/Git.pm\n@@ -101,6 +101,7 @@ use Error qw(:try);\n use Cwd qw(abs_path);\n use IPC::Open2 qw(open2);\n use Fcntl qw(SEEK_SET SEEK_CUR);\n+use File::Spec ();\n }\n \n \n@@ -184,7 +185,8 @@ sub repository {\n \t\t};\n \n \t\tif ($dir) {\n-\t\t\t$dir =~ m#^/# or $dir = $opts{Directory} . '/' . $dir;\n+                        File::Spec->file_name_is_absolute($dir)\n+\t\t\t\tor $dir = $opts{Directory} . '/' . $dir;\n \t\t\t$opts{Repository} = abs_path($dir);\n \n \t\t\t# If --git-dir went ok, this shouldn't die either.\n@@ -420,7 +422,15 @@ have more complicated structure.\n \n sub command_close_bidi_pipe {\n \tlocal $?;\n-\tmy ($pid, $in, $out, $ctx) = @_;\n+\tmy ($pid, $in, $out, $ctx, $ignore_errors) = @_;\n+\n+\tif ($ignore_errors) {\n+\t\tclose $in;\n+\t\tclose $out;\n+\t\tkill -9, $pid;\n+\t\treturn;\n+\t}\n+\n \tforeach my $fh ($in, $out) {\n \t\tunless (close $fh) {\n \t\t\tif ($!) {\n@@ -431,7 +441,14 @@ sub command_close_bidi_pipe {\n \t\t}\n \t}\n \n-\twaitpid $pid, 0;\n+\t{\n+\t\tlocal $SIG{ALRM} = sub {\n+\t\t\tkill -9, $pid;\n+\t\t};\n+\t\talarm 1;\n+\t\twaitpid $pid, 0;\n+\t\talarm 0;\n+\t}\n \n \tif ($? >> 8) {\n \t\tthrow Git::Error::Command($ctx, $? >>8);\n@@ -876,11 +893,13 @@ sub cat_blob {\n \n \tmy $description = <$in>;\n \tif ($description =~ / missing$/) {\n+\t\t$self->_close_cat_blob();\n \t\tcarp \"$sha1 doesn't exist in the repository\";\n \t\treturn -1;\n \t}\n \n \tif ($description !~ /^[0-9a-fA-F]{40} \\S+ (\\d+)$/) {\n+\t\t$self->_close_cat_blob();\n \t\tcarp \"Unexpected result returned from git cat-file\";\n \t\treturn -1;\n \t}\n@@ -921,6 +940,8 @@ sub cat_blob {\n \t\tthrow Error::Simple(\"couldn't write to passed in filehandle\");\n \t}\n \n+\t$self->_close_cat_blob;\n+\n \treturn $size;\n }\n \n@@ -941,7 +962,7 @@ sub _close_cat_blob {\n \n \tmy @vars = map { 'cat_blob_' . $_ } qw(pid in out ctx);\n \n-\tcommand_close_bidi_pipe(@$self{@vars});\n+\tcommand_close_bidi_pipe(@$self{@vars}, 1);\n \tdelete @$self{@vars};\n }\n \n@@ -1300,16 +1321,16 @@ sub _cmd_close {\n \t\tif ($!) {\n \t\t\t# It's just close, no point in fatalities\n \t\t\tcarp \"error closing pipe: $!\";\n-\t\t} elsif ($? >> 8) {\n-\t\t\t# The caller should pepper this.\n-\t\t\tthrow Git::Error::Command($ctx, $? >> 8);\n-\t\t}\n+                }\n \t\t# else we might e.g. closed a live stream; the command\n \t\t# dying of SIGPIPE would drive us here.\n \t}\n+\tif ($? >> 8) {\n+\t\t# The caller should pepper this.\n+\t\tthrow Git::Error::Command($ctx, $? >> 8);\n+\t}\n }\n \n-\n sub DESTROY {\n \tmy ($self) = @_;\n \t$self->_close_hash_and_insert_object();\n@@ -1360,3 +1381,4 @@ sub EOF {\n \n \n 1; # Famous last words\n+# vim:noet ts=8 sw=8 sts=8:\ndiff --git a/perl/Makefile b/perl/Makefile\nindex a2ffb64..1fa99cd 100644\n--- a/perl/Makefile\n+++ b/perl/Makefile\n@@ -3,18 +3,28 @@\n #\n makfile:=perl.mak\n \n+# support PERL_PATH=C:\\\\Perl\\\\bin\\\\perl\n+PERL_PATH := $(subst \\,\\\\,$(PERL_PATH))\n+\n PERL_PATH_SQ = $(subst ','\\'',$(PERL_PATH))\n+PERL_MAKE := MAKEFLAGS=\"\" $(subst \\,\\\\,$(shell $(subst \\,\\\\,$(PERL_PATH)) -MConfig -le \"print ((\\%Config)->{make})\"))\n+\n+ifneq (,$(findstring nmake,$(PERL_MAKE)))\n+\tPERL_MAKE := $(PERL_MAKE) -nologo\n+endif\n+\n prefix_SQ = $(subst ','\\'',$(prefix))\n \n ifndef V\n \tQUIET = @\n endif\n \n+\n all install instlibdir: $(makfile)\n-\t$(QUIET)$(MAKE) -f $(makfile) $@\n+\t$(QUIET)$(PERL_MAKE) -f $(makfile) $@\n \n clean:\n-\t$(QUIET)test -f $(makfile) && $(MAKE) -f $(makfile) $@ || exit 0\n+\t$(QUIET)test -f $(makfile) && ($(PERL_MAKE) -f $(makfile) $@) || exit 0\n \t$(RM) ppport.h\n \t$(RM) $(makfile)\n \t$(RM) $(makfile).old\ndiff --git a/perl/Makefile.PL b/perl/Makefile.PL\nindex 0b9deca..7ceec50 100644\n--- a/perl/Makefile.PL\n+++ b/perl/Makefile.PL\n@@ -1,10 +1,13 @@\n use ExtUtils::MakeMaker;\n \n sub MY::postamble {\n-\treturn <<'MAKE_FRAG';\n+\tmy $make_frag = <<'MAKE_FRAG';\n instlibdir:\n \t@echo '$(INSTALLSITELIB)'\n \n+MAKE_FRAG\n+\n+\t$make_frag .= <<'MAKE_FRAG' if $^O ne 'MSWin32';\n ifneq (,$(DESTDIR))\n ifeq (0,$(shell expr '$(MM_VERSION)' '>' 6.10))\n $(error ExtUtils::MakeMaker version \"$(MM_VERSION)\" is older than 6.11 and so \\\n@@ -14,6 +17,8 @@ endif\n endif\n \n MAKE_FRAG\n+\n+\treturn $make_frag;\n }\n \n my %pm = ('Git.pm' => '$(INST_LIBDIR)/Git.pm');\ndiff --git a/t/t9700/test.pl b/t/t9700/test.pl\nindex 671f38d..d5328a3 100755\n--- a/t/t9700/test.pl\n+++ b/t/t9700/test.pl\n@@ -1,4 +1,12 @@\n #!/usr/bin/perl\n+\n+BEGIN {\n+\tuse Cwd 'abs_path';\n+\tmy $perl_dir = abs_path('../../perl');\n+\teval \"use lib '${perl_dir}/blib/lib';\";\n+\teval \"use lib '${perl_dir}/blib/arch/auto/Git';\";\n+}\n+\n use lib (split(/:/, $ENV{GITPERLLIB}));\n \n use 5.006002;\n@@ -74,6 +82,7 @@ is($r->ident_person(\"Name\", \"email\", \"123 +0000\"), \"Name <email>\",\n ok(our $file1hash = $r->command_oneline('rev-parse', \"HEAD:file1\"), \"(get file hash)\");\n my $tmpfile = \"file.tmp\";\n open TEMPFILE, \"+>$tmpfile\" or die \"Can't open $tmpfile: $!\";\n+binmode TEMPFILE;\n is($r->cat_blob($file1hash, \\*TEMPFILE), 15, \"cat_blob: size\");\n our $blobcontents;\n { local $/; seek TEMPFILE, 0, 0; $blobcontents = <TEMPFILE>; }\n@@ -81,11 +90,13 @@ is($blobcontents, \"changed file 1\\n\", \"cat_blob: data\");\n close TEMPFILE or die \"Failed writing to $tmpfile: $!\";\n is(Git::hash_object(\"blob\", $tmpfile), $file1hash, \"hash_object: roundtrip\");\n open TEMPFILE, \">$tmpfile\" or die \"Can't open $tmpfile: $!\";\n+binmode TEMPFILE;\n print TEMPFILE my $test_text = \"test blob, to be inserted\\n\";\n close TEMPFILE or die \"Failed writing to $tmpfile: $!\";\n like(our $newhash = $r->hash_and_insert_object($tmpfile), qr/[0-9a-fA-F]{40}/,\n      \"hash_and_insert_object: returns hash\");\n open TEMPFILE, \"+>$tmpfile\" or die \"Can't open $tmpfile: $!\";\n+binmode TEMPFILE;\n is($r->cat_blob($newhash, \\*TEMPFILE), length $test_text, \"cat_blob: roundtrip size\");\n { local $/; seek TEMPFILE, 0, 0; $blobcontents = <TEMPFILE>; }\n is($blobcontents, $test_text, \"cat_blob: roundtrip data\");\n@@ -115,5 +126,7 @@ isnt($last_commit, $dir_commit, 'log . does not show last commit');\n \n printf \"1..%d\\n\", Test::More->builder->current_test;\n \n-my $is_passing = eval { Test::More->is_passing };\n+my $is_passing = eval { Test::More->builder->is_passing }\n+\t|| eval { Test::More->is_passing };\n exit($is_passing ? 0 : 1) unless $@ =~ /Can't locate object method/;\n+# vim:noet ts=8 sw=8 sts=8:\n-- \n1.7.3.1.msysgit.0.1.g49f6d.dirty\n"},{"id":"161041","messageId":"AANLkTimCXEbzZnR1k32u942hjB37nThN_RDBL5N7owHa@mail.gmail.com","threadId":"26493","inReplyTo":"4D5914C1.9050008@io.com","subject":"Re: [PATCH] fixes for ActiveState Perl","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@gmail.com","sentAt":"2011-02-14T12:49:23Z","receivedAt":"2011-02-14T12:49:23Z","isPatch":true,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"On Mon, Feb 14, 2011 at 12:40 PM, Rafael Kitover <rkitover@io.com> wrote:\n> The make for perl is now retrieved from Perl's config. The make fragment in\n> perl/Makefile.PL added in MY::postamble is disabled on Win32, as it relies on\n> GNU make syntax, and Win32 users are not likely to have an ancient EU::MM\n> version.\n>\n> A Windows path for PERL_PATH is now supported as well, e.g.:\n> make PERL_PATH=C:\\\\Perl\\\\bin\\\\perl\n> or from cmd.exe:\n> make PERL_PATH=C:\\Perl\\bin\\perl\n> .\n>\n> t9700-perl-git.sh now passes on ActiveState Perl. Some tweaks were necessary in\n> Git.pm: a more correct check for absolute directory, exit code check on closing\n> the \"pipe\", and always closing the cat_blob bidirectional pipe (with errors\n>  ignored) so as not to leave zombie processes. The waitpid call on closing the\n> bidirectional pipe is now timed and the process is killed if necessary. Also\n> added some binmode calls to t/t9700/test.pl to make the blob tests pass.\n>\n> Signed-off-by: Rafael Kitover <rkitover@cpan.org>\n> ---\n>  Makefile         |    8 ++++----\n>  perl/Git.pm      |   40 +++++++++++++++++++++++++++++++---------\n>  perl/Makefile    |   14 ++++++++++++--\n>  perl/Makefile.PL |    7 ++++++-\n>  t/t9700/test.pl  |   15 ++++++++++++++-\n>  5 files changed, 67 insertions(+), 17 deletions(-)\n>\n> diff --git a/Makefile b/Makefile\n> index d3dcfb1..3465ab5 100644\n> --- a/Makefile\n> +++ b/Makefile\n> @@ -175,7 +175,7 @@ all::\n>  # will work.\n>  #\n>  # Define NO_PERL_MAKEMAKER if you cannot use Makefiles generated by perl's\n> -# MakeMaker (e.g. using ActiveState under Cygwin).\n> +# MakeMaker.\n>  #\n>  # Define NO_PERL if you do not want Perl scripts or libraries at all.\n>  #\n> @@ -1059,7 +1059,7 @@ ifeq ($(uname_S),Windows)\n>        NO_MKSTEMPS = YesPlease\n>        SNPRINTF_RETURNS_BOGUS = YesPlease\n>        NO_SVN_TESTS = YesPlease\n> -       NO_PERL_MAKEMAKER = YesPlease\n> +       # NO_PERL_MAKEMAKER = YesPlease\n>        RUNTIME_PREFIX = YesPlease\n>        NO_POSIX_ONLY_PROGRAMS = YesPlease\n>        NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease\n\nThis would break my MSVC builds, since I'm using msysGit + MSVC to\nbuild (when using MSVC)... Not that that's a big deal, I can add\n\"NO_PERL_MAKEMAKER = YesPlease\" to my config.mak.\n\nBut I do suspect that most people who build with MSVC will have the\nsame problem. Is it worth the hassle?\n\n> @@ -1112,7 +1112,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))\n>        NO_MKDTEMP = YesPlease\n>        NO_MKSTEMPS = YesPlease\n>        NO_SVN_TESTS = YesPlease\n> -       NO_PERL_MAKEMAKER = YesPlease\n> +       # NO_PERL_MAKEMAKER = YesPlease\n>        RUNTIME_PREFIX = YesPlease\n>        NO_POSIX_ONLY_PROGRAMS = YesPlease\n>        NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease\n\nThis would break Git for Windows, as we don't have makemaker\nExtUtils::MakeMaker in msysGit.\n\nYou could probably move the definition into the THIS_IS_MSYSGIT-check, though.\n\n> @@ -1652,7 +1652,7 @@ perl/perl.mak: GIT-CFLAGS perl/Makefile perl/Makefile.PL\n>\n>  $(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl\n>        $(QUIET_GEN)$(RM) $@ $@+ && \\\n> -       INSTLIBDIR=`MAKEFLAGS= $(MAKE) -C perl -s --no-print-directory instlibdir` && \\\n> +       INSTLIBDIR=`MAKEFLAGS= $(MAKE) -C perl -s --no-print-directory instlibdir | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g' -e \"s/'//g\"` && \\\n>        sed -e '1{' \\\n>            -e '        s|#!.*perl|#!$(PERL_PATH_SQ)|' \\\n>            -e '        h' \\\n> diff --git a/perl/Git.pm b/perl/Git.pm\n> index 6cb0dd1..f7d99bd 100644\n> --- a/perl/Git.pm\n> +++ b/perl/Git.pm\n> @@ -101,6 +101,7 @@ use Error qw(:try);\n>  use Cwd qw(abs_path);\n>  use IPC::Open2 qw(open2);\n>  use Fcntl qw(SEEK_SET SEEK_CUR);\n> +use File::Spec ();\n>  }\n>\n>\n> @@ -184,7 +185,8 @@ sub repository {\n>                };\n>\n>                if ($dir) {\n> -                       $dir =~ m#^/# or $dir = $opts{Directory} . '/' . $dir;\n> +                        File::Spec->file_name_is_absolute($dir)\n> +                               or $dir = $opts{Directory} . '/' . $dir;\n>                        $opts{Repository} = abs_path($dir);\n>\n>                        # If --git-dir went ok, this shouldn't die either.\n\nJust for reference, this should still work as before on Git for\nWindows, because we have a MSYS perl, so absolute paths starts with a\nforward slash. And if we change to a MinGW perl, this would probably\nbe an improvement.\n\n> diff --git a/perl/Makefile b/perl/Makefile\n> index a2ffb64..1fa99cd 100644\n> --- a/perl/Makefile\n> +++ b/perl/Makefile\n> @@ -3,18 +3,28 @@\n>  #\n>  makfile:=perl.mak\n>\n> +# support PERL_PATH=C:\\\\Perl\\\\bin\\\\perl\n> +PERL_PATH := $(subst \\,\\\\,$(PERL_PATH))\n> +\n>  PERL_PATH_SQ = $(subst ','\\'',$(PERL_PATH))\n> +PERL_MAKE := MAKEFLAGS=\"\" $(subst \\,\\\\,$(shell $(subst \\,\\\\,$(PERL_PATH)) -MConfig -le \"print ((\\%Config)->{make})\"))\n> +\n> +ifneq (,$(findstring nmake,$(PERL_MAKE)))\n> +       PERL_MAKE := $(PERL_MAKE) -nologo\n> +endif\n> +\n>  prefix_SQ = $(subst ','\\'',$(prefix))\n>\n>  ifndef V\n>        QUIET = @\n>  endif\n>\n> +\n\nWhy?\n"},{"id":"161063","messageId":"AANLkTinem19tDCdvrE2tK2bF2jojtYyh6-9WtepgdvAR@mail.gmail.com","threadId":"26493","inReplyTo":"4D5914C1.9050008@io.com","subject":"Re: [PATCH] fixes for ActiveState Perl","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2011-02-14T15:26:51Z","receivedAt":"2011-02-14T15:26:51Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Mon, Feb 14, 2011 at 12:40, Rafael Kitover <rkitover@io.com> wrote:\n\n>        NO_MKSTEMPS = YesPlease\n>        SNPRINTF_RETURNS_BOGUS = YesPlease\n>        NO_SVN_TESTS = YesPlease\n> -       NO_PERL_MAKEMAKER = YesPlease\n> +       # NO_PERL_MAKEMAKER = YesPlease\n>        RUNTIME_PREFIX = YesPlease\n\nAside from the comments Erik raised: If you're going to remove\nsomething just remove it, don't comment it out.\n"},{"id":"161088","messageId":"4D5984DD.1030004@io.com","threadId":"26493","inReplyTo":"AANLkTimCXEbzZnR1k32u942hjB37nThN_RDBL5N7owHa@mail.gmail.com","subject":"Re: [PATCH] fixes for ActiveState Perl","fromName":"Rafael Kitover","fromEmail":"rkitover@io.com","sentAt":"2011-02-14T19:39:09Z","receivedAt":"2011-02-14T19:39:09Z","isPatch":true,"sender":{"key":"rkitover@io.com","avatar":null},"body":"On 2/14/2011 7:49 AM, Erik Faye-Lund wrote:\n...\n>> diff --git a/perl/Makefile b/perl/Makefile\n>> index a2ffb64..1fa99cd 100644\n>> --- a/perl/Makefile\n>> +++ b/perl/Makefile\n>> @@ -3,18 +3,28 @@\n>>  #\n>>  makfile:=perl.mak\n>>\n>> +# support PERL_PATH=C:\\\\Perl\\\\bin\\\\perl\n>> +PERL_PATH := $(subst \\,\\\\,$(PERL_PATH))\n>> +\n>>  PERL_PATH_SQ = $(subst ','\\'',$(PERL_PATH))\n>> +PERL_MAKE := MAKEFLAGS=\"\" $(subst \\,\\\\,$(shell $(subst \\,\\\\,$(PERL_PATH)) -MConfig -le \"print ((\\%Config)->{make})\"))\n>> +\n>> +ifneq (,$(findstring nmake,$(PERL_MAKE)))\n>> +       PERL_MAKE := $(PERL_MAKE) -nologo\n>> +endif\n>> +\n>>  prefix_SQ = $(subst ','\\'',$(prefix))\n>>\n>>  ifndef V\n>>        QUIET = @\n>>  endif\n>>\n>> +\n> \n> Why?\n\nWindows perl (activestate, strawberry) uses nmake or dmake. The\nmakefiles for these makes are incompatible with GNU make. This code\nretrieves the make Perl would use from its Config, and uses that on\ninvoking perl.mak .\n\nThis should also allow for using EU::MM for the MSVC+ActiveState build.\n"},{"id":"161093","messageId":"AANLkTimb2puTjj=DDqJcshwSVgqebhS9__jHoY1KdO_7@mail.gmail.com","threadId":"26493","inReplyTo":"4D5984DD.1030004@io.com","subject":"Re: [PATCH] fixes for ActiveState Perl","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@gmail.com","sentAt":"2011-02-14T19:48:05Z","receivedAt":"2011-02-14T19:48:05Z","isPatch":true,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"On Mon, Feb 14, 2011 at 8:39 PM, Rafael Kitover <rkitover@io.com> wrote:\n> On 2/14/2011 7:49 AM, Erik Faye-Lund wrote:\n> ...\n>>> diff --git a/perl/Makefile b/perl/Makefile\n>>> index a2ffb64..1fa99cd 100644\n>>> --- a/perl/Makefile\n>>> +++ b/perl/Makefile\n>>> @@ -3,18 +3,28 @@\n>>>  #\n>>>  makfile:=perl.mak\n>>>\n>>> +# support PERL_PATH=C:\\\\Perl\\\\bin\\\\perl\n>>> +PERL_PATH := $(subst \\,\\\\,$(PERL_PATH))\n>>> +\n>>>  PERL_PATH_SQ = $(subst ','\\'',$(PERL_PATH))\n>>> +PERL_MAKE := MAKEFLAGS=\"\" $(subst \\,\\\\,$(shell $(subst \\,\\\\,$(PERL_PATH)) -MConfig -le \"print ((\\%Config)->{make})\"))\n>>> +\n>>> +ifneq (,$(findstring nmake,$(PERL_MAKE)))\n>>> +       PERL_MAKE := $(PERL_MAKE) -nologo\n>>> +endif\n>>> +\n>>>  prefix_SQ = $(subst ','\\'',$(prefix))\n>>>\n>>>  ifndef V\n>>>        QUIET = @\n>>>  endif\n>>>\n>>> +\n>>\n>> Why?\n>\n> Windows perl (activestate, strawberry) uses nmake or dmake. The\n> makefiles for these makes are incompatible with GNU make. This code\n> retrieves the make Perl would use from its Config, and uses that on\n> invoking perl.mak .\n>\n> This should also allow for using EU::MM for the MSVC+ActiveState build.\n\nI'm sorry for not being clear; I was talking about that single\nnew-line, not the PERL_MAKE-stuff.\n"},{"id":"161177","messageId":"4D5A6847.90804@io.com","threadId":"26493","inReplyTo":"AANLkTimb2puTjj=DDqJcshwSVgqebhS9__jHoY1KdO_7@mail.gmail.com","subject":"Re: [PATCH] fixes for ActiveState Perl","fromName":"Rafael Kitover","fromEmail":"rkitover@io.com","sentAt":"2011-02-15T11:49:27Z","receivedAt":"2011-02-15T11:49:27Z","isPatch":true,"sender":{"key":"rkitover@io.com","avatar":null},"body":"The make for perl is now retrieved from Perl's config. The make fragment in\nperl/Makefile.PL added in MY::postamble is disabled on Win32, as it relies on\nGNU make syntax, and Win32 users are not likely to have an ancient EU::MM\nversion.\n\nA Windows path for PERL_PATH is now supported as well, e.g.:\nmake PERL_PATH=C:\\\\Perl\\\\bin\\\\perl\nor from cmd.exe:\nmake PERL_PATH=C:\\Perl\\bin\\perl\n.\n\nt9700-perl-git.sh now passes on ActiveState Perl. Some tweaks were necessary in\nGit.pm: a more correct check for absolute directory, exit code check on closing\nthe \"pipe\", and always closing the cat_blob bidirectional pipe (with errors\n ignored) so as not to leave zombie processes. The waitpid call on closing the\nbidirectional pipe is now timed and the process is killed if necessary. Also\nadded some binmode calls to t/t9700/test.pl to make the blob tests pass.\n\nSigned-off-by: Rafael Kitover <rkitover@cpan.org>\n---\n\nResending patch with offending changes removed.\n\n Makefile         |    4 ++--\n perl/Git.pm      |   39 +++++++++++++++++++++++++++++++--------\n perl/Makefile    |   13 +++++++++++--\n perl/Makefile.PL |    7 ++++++-\n t/t9700/test.pl  |   15 ++++++++++++++-\n 5 files changed, 64 insertions(+), 14 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex d3dcfb1..692fb2e 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -175,7 +175,7 @@ all::\n # will work.\n #\n # Define NO_PERL_MAKEMAKER if you cannot use Makefiles generated by perl's\n-# MakeMaker (e.g. using ActiveState under Cygwin).\n+# MakeMaker.\n #\n # Define NO_PERL if you do not want Perl scripts or libraries at all.\n #\n@@ -1652,7 +1652,7 @@ perl/perl.mak: GIT-CFLAGS perl/Makefile perl/Makefile.PL\n \n $(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl\n \t$(QUIET_GEN)$(RM) $@ $@+ && \\\n-\tINSTLIBDIR=`MAKEFLAGS= $(MAKE) -C perl -s --no-print-directory instlibdir` && \\\n+\tINSTLIBDIR=`MAKEFLAGS= $(MAKE) -C perl -s --no-print-directory instlibdir | sed -e 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g' -e \"s/'//g\"` && \\\n \tsed -e '1{' \\\n \t    -e '\ts|#!.*perl|#!$(PERL_PATH_SQ)|' \\\n \t    -e '\th' \\\ndiff --git a/perl/Git.pm b/perl/Git.pm\nindex 6cb0dd1..11239da 100644\n--- a/perl/Git.pm\n+++ b/perl/Git.pm\n@@ -101,6 +101,7 @@ use Error qw(:try);\n use Cwd qw(abs_path);\n use IPC::Open2 qw(open2);\n use Fcntl qw(SEEK_SET SEEK_CUR);\n+use File::Spec ();\n }\n \n \n@@ -184,7 +185,8 @@ sub repository {\n \t\t};\n \n \t\tif ($dir) {\n-\t\t\t$dir =~ m#^/# or $dir = $opts{Directory} . '/' . $dir;\n+                        File::Spec->file_name_is_absolute($dir)\n+\t\t\t\tor $dir = $opts{Directory} . '/' . $dir;\n \t\t\t$opts{Repository} = abs_path($dir);\n \n \t\t\t# If --git-dir went ok, this shouldn't die either.\n@@ -420,7 +422,15 @@ have more complicated structure.\n \n sub command_close_bidi_pipe {\n \tlocal $?;\n-\tmy ($pid, $in, $out, $ctx) = @_;\n+\tmy ($pid, $in, $out, $ctx, $ignore_errors) = @_;\n+\n+\tif ($ignore_errors) {\n+\t\tclose $in;\n+\t\tclose $out;\n+\t\tkill -9, $pid;\n+\t\treturn;\n+\t}\n+\n \tforeach my $fh ($in, $out) {\n \t\tunless (close $fh) {\n \t\t\tif ($!) {\n@@ -431,7 +441,14 @@ sub command_close_bidi_pipe {\n \t\t}\n \t}\n \n-\twaitpid $pid, 0;\n+\t{\n+\t\tlocal $SIG{ALRM} = sub {\n+\t\t\tkill -9, $pid;\n+\t\t};\n+\t\talarm 1;\n+\t\twaitpid $pid, 0;\n+\t\talarm 0;\n+\t}\n \n \tif ($? >> 8) {\n \t\tthrow Git::Error::Command($ctx, $? >>8);\n@@ -876,11 +893,13 @@ sub cat_blob {\n \n \tmy $description = <$in>;\n \tif ($description =~ / missing$/) {\n+\t\t$self->_close_cat_blob();\n \t\tcarp \"$sha1 doesn't exist in the repository\";\n \t\treturn -1;\n \t}\n \n \tif ($description !~ /^[0-9a-fA-F]{40} \\S+ (\\d+)$/) {\n+\t\t$self->_close_cat_blob();\n \t\tcarp \"Unexpected result returned from git cat-file\";\n \t\treturn -1;\n \t}\n@@ -921,6 +940,8 @@ sub cat_blob {\n \t\tthrow Error::Simple(\"couldn't write to passed in filehandle\");\n \t}\n \n+\t$self->_close_cat_blob;\n+\n \treturn $size;\n }\n \n@@ -941,7 +962,7 @@ sub _close_cat_blob {\n \n \tmy @vars = map { 'cat_blob_' . $_ } qw(pid in out ctx);\n \n-\tcommand_close_bidi_pipe(@$self{@vars});\n+\tcommand_close_bidi_pipe(@$self{@vars}, 1);\n \tdelete @$self{@vars};\n }\n \n@@ -1300,13 +1321,14 @@ sub _cmd_close {\n \t\tif ($!) {\n \t\t\t# It's just close, no point in fatalities\n \t\t\tcarp \"error closing pipe: $!\";\n-\t\t} elsif ($? >> 8) {\n-\t\t\t# The caller should pepper this.\n-\t\t\tthrow Git::Error::Command($ctx, $? >> 8);\n-\t\t}\n+                }\n \t\t# else we might e.g. closed a live stream; the command\n \t\t# dying of SIGPIPE would drive us here.\n \t}\n+\tif ($? >> 8) {\n+\t\t# The caller should pepper this.\n+\t\tthrow Git::Error::Command($ctx, $? >> 8);\n+\t}\n }\n \n \n@@ -1360,3 +1382,4 @@ sub EOF {\n \n \n 1; # Famous last words\n+# vim:noet ts=8 sw=8 sts=8:\ndiff --git a/perl/Makefile b/perl/Makefile\nindex a2ffb64..4739a21 100644\n--- a/perl/Makefile\n+++ b/perl/Makefile\n@@ -3,7 +3,16 @@\n #\n makfile:=perl.mak\n \n+# support PERL_PATH=C:\\\\Perl\\\\bin\\\\perl\n+PERL_PATH := $(subst \\,\\\\,$(PERL_PATH))\n+\n PERL_PATH_SQ = $(subst ','\\'',$(PERL_PATH))\n+PERL_MAKE := MAKEFLAGS=\"\" $(subst \\,\\\\,$(shell $(subst \\,\\\\,$(PERL_PATH)) -MConfig -le \"print ((\\%Config)->{make})\"))\n+\n+ifneq (,$(findstring nmake,$(PERL_MAKE)))\n+\tPERL_MAKE := $(PERL_MAKE) -nologo\n+endif\n+\n prefix_SQ = $(subst ','\\'',$(prefix))\n \n ifndef V\n@@ -11,10 +20,10 @@ ifndef V\n endif\n \n all install instlibdir: $(makfile)\n-\t$(QUIET)$(MAKE) -f $(makfile) $@\n+\t$(QUIET)$(PERL_MAKE) -f $(makfile) $@\n \n clean:\n-\t$(QUIET)test -f $(makfile) && $(MAKE) -f $(makfile) $@ || exit 0\n+\t$(QUIET)test -f $(makfile) && ($(PERL_MAKE) -f $(makfile) $@) || exit 0\n \t$(RM) ppport.h\n \t$(RM) $(makfile)\n \t$(RM) $(makfile).old\ndiff --git a/perl/Makefile.PL b/perl/Makefile.PL\nindex 0b9deca..7ceec50 100644\n--- a/perl/Makefile.PL\n+++ b/perl/Makefile.PL\n@@ -1,10 +1,13 @@\n use ExtUtils::MakeMaker;\n \n sub MY::postamble {\n-\treturn <<'MAKE_FRAG';\n+\tmy $make_frag = <<'MAKE_FRAG';\n instlibdir:\n \t@echo '$(INSTALLSITELIB)'\n \n+MAKE_FRAG\n+\n+\t$make_frag .= <<'MAKE_FRAG' if $^O ne 'MSWin32';\n ifneq (,$(DESTDIR))\n ifeq (0,$(shell expr '$(MM_VERSION)' '>' 6.10))\n $(error ExtUtils::MakeMaker version \"$(MM_VERSION)\" is older than 6.11 and so \\\n@@ -14,6 +17,8 @@ endif\n endif\n \n MAKE_FRAG\n+\n+\treturn $make_frag;\n }\n \n my %pm = ('Git.pm' => '$(INST_LIBDIR)/Git.pm');\ndiff --git a/t/t9700/test.pl b/t/t9700/test.pl\nindex 671f38d..d5328a3 100755\n--- a/t/t9700/test.pl\n+++ b/t/t9700/test.pl\n@@ -1,4 +1,12 @@\n #!/usr/bin/perl\n+\n+BEGIN {\n+\tuse Cwd 'abs_path';\n+\tmy $perl_dir = abs_path('../../perl');\n+\teval \"use lib '${perl_dir}/blib/lib';\";\n+\teval \"use lib '${perl_dir}/blib/arch/auto/Git';\";\n+}\n+\n use lib (split(/:/, $ENV{GITPERLLIB}));\n \n use 5.006002;\n@@ -74,6 +82,7 @@ is($r->ident_person(\"Name\", \"email\", \"123 +0000\"), \"Name <email>\",\n ok(our $file1hash = $r->command_oneline('rev-parse', \"HEAD:file1\"), \"(get file hash)\");\n my $tmpfile = \"file.tmp\";\n open TEMPFILE, \"+>$tmpfile\" or die \"Can't open $tmpfile: $!\";\n+binmode TEMPFILE;\n is($r->cat_blob($file1hash, \\*TEMPFILE), 15, \"cat_blob: size\");\n our $blobcontents;\n { local $/; seek TEMPFILE, 0, 0; $blobcontents = <TEMPFILE>; }\n@@ -81,11 +90,13 @@ is($blobcontents, \"changed file 1\\n\", \"cat_blob: data\");\n close TEMPFILE or die \"Failed writing to $tmpfile: $!\";\n is(Git::hash_object(\"blob\", $tmpfile), $file1hash, \"hash_object: roundtrip\");\n open TEMPFILE, \">$tmpfile\" or die \"Can't open $tmpfile: $!\";\n+binmode TEMPFILE;\n print TEMPFILE my $test_text = \"test blob, to be inserted\\n\";\n close TEMPFILE or die \"Failed writing to $tmpfile: $!\";\n like(our $newhash = $r->hash_and_insert_object($tmpfile), qr/[0-9a-fA-F]{40}/,\n      \"hash_and_insert_object: returns hash\");\n open TEMPFILE, \"+>$tmpfile\" or die \"Can't open $tmpfile: $!\";\n+binmode TEMPFILE;\n is($r->cat_blob($newhash, \\*TEMPFILE), length $test_text, \"cat_blob: roundtrip size\");\n { local $/; seek TEMPFILE, 0, 0; $blobcontents = <TEMPFILE>; }\n is($blobcontents, $test_text, \"cat_blob: roundtrip data\");\n@@ -115,5 +126,7 @@ isnt($last_commit, $dir_commit, 'log . does not show last commit');\n \n printf \"1..%d\\n\", Test::More->builder->current_test;\n \n-my $is_passing = eval { Test::More->is_passing };\n+my $is_passing = eval { Test::More->builder->is_passing }\n+\t|| eval { Test::More->is_passing };\n exit($is_passing ? 0 : 1) unless $@ =~ /Can't locate object method/;\n+# vim:noet ts=8 sw=8 sts=8:\n-- \n1.7.3.1\n"},{"id":"161423","messageId":"4D5D2B95.2060506@io.com","threadId":"26493","inReplyTo":"4D5A6847.90804@io.com","subject":"Re: [PATCH] fixes for ActiveState Perl","fromName":"Rafael Kitover","fromEmail":"rkitover@io.com","sentAt":"2011-02-17T14:07:17Z","receivedAt":"2011-02-17T14:07:17Z","isPatch":true,"sender":{"key":"rkitover@io.com","avatar":null},"body":"I put a lot of work into this patch...what do I do with it now?\n"},{"id":"161752","messageId":"AANLkTimWXSTe0DCQQRqgw8z2OVqiu+tdJrp20emdWVpk@mail.gmail.com","threadId":"26493","inReplyTo":"4D5D2B95.2060506@io.com","subject":"Re: [PATCH] fixes for ActiveState Perl","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2011-02-20T11:58:26Z","receivedAt":"2011-02-20T11:58:26Z","isPatch":true,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Thu, Feb 17, 2011 at 15:07, Rafael Kitover <rkitover@io.com> wrote:\n> I put a lot of work into this patch...what do I do with it now?\n\nStep one would be to keep those who are interested  cc-ed. If they\nagree that the new version is sound, cc Junio to have it merged to\nnext.\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"162001","messageId":"4D645BE9.1040904@io.com","threadId":"26493","inReplyTo":"AANLkTimWXSTe0DCQQRqgw8z2OVqiu+tdJrp20emdWVpk@mail.gmail.com","subject":"Re: [PATCH] fixes for ActiveState Perl","fromName":"Rafael Kitover","fromEmail":"rkitover@io.com","sentAt":"2011-02-23T00:59:21Z","receivedAt":"2011-02-23T00:59:21Z","isPatch":true,"sender":{"key":"rkitover@io.com","avatar":null},"body":"On 2/20/2011 6:58 AM, Sverre Rabbelier wrote:\n> Heya,\n> \n> On Thu, Feb 17, 2011 at 15:07, Rafael Kitover <rkitover@io.com> wrote:\n>> I put a lot of work into this patch...what do I do with it now?\n> \n> Step one would be to keep those who are interested  cc-ed. If they\n> agree that the new version is sound, cc Junio to have it merged to\n> next.\n> \n\nPlease don't include this patch, I sent a much better patch to the\nmsysGit list...\n"}]}