[libperl5i-perl] 01/01: Cherry-pick patch to fix segfaulting of "perl5i -e"

Axel Beckert abe at deuxchevaux.org
Thu Apr 30 01:11:29 UTC 2015


This is an automated email from the git hooks/post-receive script.

abe pushed a commit to branch master
in repository libperl5i-perl.

commit f34a584bda373300efea86d9620ac13b1428d291
Author: Axel Beckert <abe at deuxchevaux.org>
Date:   Thu Apr 30 03:08:46 2015 +0200

    Cherry-pick patch to fix segfaulting of "perl5i -e"
    
    Closes: #716296
---
 debian/changelog                                   |  5 +-
 ...ick-d096ee5e-fix-perl5i-dash-e-from-segfaulting | 64 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 3 files changed, 67 insertions(+), 3 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 0461372..a96cc5e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,5 @@
 libperl5i-perl (2.13.1-1) UNRELEASED; urgency=medium
 
-  TODO: #716296 still not resolved? Reproducer still causes
-        a segfault.
-
   * Add debian/upstream/metadata
   * Imported upstream version 2.13.1
     + Drop debian/patches/fix-utf8-in-argv-handling, it was cherry-picked
@@ -10,6 +7,8 @@ libperl5i-perl (2.13.1-1) UNRELEASED; urgency=medium
     + Update libutf8-all-perl (build-)dependency to >= 0.015.
   * Declare compliance with Debian Policy 3.9.6 (no further changes)
   * Add "Testsuite: autopkgtest-pkg-perl" header.
+  * Cherry-pick upstream patch to fix segfaulting of "perl5i -e"
+    (Closes: #716296 and upstream Github issue #269)
 
  -- Axel Beckert <abe at debian.org>  Fri, 10 Apr 2015 23:06:24 +0200
 
diff --git a/debian/patches/cherry-pick-d096ee5e-fix-perl5i-dash-e-from-segfaulting b/debian/patches/cherry-pick-d096ee5e-fix-perl5i-dash-e-from-segfaulting
new file mode 100644
index 0000000..c4d77cb
--- /dev/null
+++ b/debian/patches/cherry-pick-d096ee5e-fix-perl5i-dash-e-from-segfaulting
@@ -0,0 +1,64 @@
+Description: Fix "perl5i -e" from segfaulting.
+Bug-Debian: https://bugs.debian.org/716296
+Bug: https://github.com/schwern/perl5i/issues/269
+Origin: commit d096ee5e26603630a6bae5ee711000e09a038ab3
+Author: Michael G. Schwern <schwern at pobox.com>
+Date:   Fri Feb 6 23:26:00 2015 -0800
+
+diff --git a/bin/perl5i.c.PL b/bin/perl5i.c.PL
+index 560ff07..ad2bcb0 100644
+--- a/bin/perl5i.c.PL
++++ b/bin/perl5i.c.PL
+@@ -39,7 +39,7 @@ int main (int argc, char* argv[]) {
+     const char* perl_cmd = "%s";
+     char* perl_args[argc+1];
+     char* dash_m = (char *)malloc(sizeof(char) * (strlen(argv[0]) + 20));
+-    char* program;
++    char* program = "";
+     int saw_dash_e = 0;
+ 
+     strcpy(dash_m, "-Mperl5i::cmd=");
+@@ -56,6 +56,7 @@ int main (int argc, char* argv[]) {
+ 	    && dash_e > argv[i]
+ 	    && *(dash_e-1) == '-'
+             && (strchr(argv[i], '-') == argv[i])
++            && i+1 < argc
+             )
+         {
+             saw_dash_e = 1;
+@@ -70,8 +71,8 @@ int main (int argc, char* argv[]) {
+             }
+ 
+             /* Skip the next argument, its the program */
+-            program = argv[i+1];
+             i++;
++            program = argv[i];
+             continue;
+         }
+ 
+diff --git a/t/command_line_wrapper.t b/t/command_line_wrapper.t
+index c7b100f..509cd01 100755
+--- a/t/command_line_wrapper.t
++++ b/t/command_line_wrapper.t
+@@ -64,4 +64,21 @@ is capture {system @perl5icmd, '-e', q($fun="yay"; say $fun;)}, "yay\n", 'no str
+ is capture {system ($^X, '-Ilib', '-Mperl5i::latest', '-e', q|$fun="yay"; say $fun;|)},
+     "yay\n", q{no strict vars for perl -Mperl5i::latest -e '...'};
+ 
++# It acts like Perl when given weird arguments.
++{
++    # We expect these system calls to return non-zero
++    no autodie "system";
++
++    my %tests = (
++        "-e with no code"       => ["-e"],
++        "null byte"             => ["\\000", "-e"],
++    );
++
++    %tests->each(func($test_name,$args) {
++        is capture {system @perl5icmd, $args},
++           capture {system $^X,        $args},
++           $test_name;
++    });
++}
++
+ done_testing;
diff --git a/debian/patches/series b/debian/patches/series
index 82456cd..a97e36d 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 fix-test-for-mips
+cherry-pick-d096ee5e-fix-perl5i-dash-e-from-segfaulting

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libperl5i-perl.git



More information about the Pkg-perl-cvs-commits mailing list