Skip to content

Commit 834625b

Browse files
committed
Merge branch 'ab/do-not-hide-failures-in-git-dot-pm'
Git.pm update. * ab/do-not-hide-failures-in-git-dot-pm: perl Git.pm: don't ignore signalled failure in _cmd_close()
2 parents b9f791a + 6798b08 commit 834625b

File tree

5 files changed

+19
-6
lines changed

5 files changed

+19
-6
lines changed

perl/Git.pm

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1686,6 +1686,16 @@ sub _setup_git_cmd_env {
16861686
# by searching for it at proper places.
16871687
sub _execv_git_cmd { exec('git', @_); }
16881688

1689+
sub _is_sig {
1690+
my ($v, $n) = @_;
1691+
1692+
# We are avoiding a "use POSIX qw(SIGPIPE SIGABRT)" in the hot
1693+
# Git.pm codepath.
1694+
require POSIX;
1695+
no strict 'refs';
1696+
$v == *{"POSIX::$n"}->();
1697+
}
1698+
16891699
# Close pipe to a subprocess.
16901700
sub _cmd_close {
16911701
my $ctx = shift @_;
@@ -1698,9 +1708,16 @@ sub _cmd_close {
16981708
} elsif ($? >> 8) {
16991709
# The caller should pepper this.
17001710
throw Git::Error::Command($ctx, $? >> 8);
1711+
} elsif ($? & 127 && _is_sig($? & 127, "SIGPIPE")) {
1712+
# we might e.g. closed a live stream; the command
1713+
# dying of SIGPIPE would drive us here.
1714+
} elsif ($? & 127 && _is_sig($? & 127, "SIGABRT")) {
1715+
die sprintf('BUG?: got SIGABRT ($? = %d, $? & 127 = %d) when closing pipe',
1716+
$?, $? & 127);
1717+
} elsif ($? & 127) {
1718+
die sprintf('got signal ($? = %d, $? & 127 = %d) when closing pipe',
1719+
$?, $? & 127);
17011720
}
1702-
# else we might e.g. closed a live stream; the command
1703-
# dying of SIGPIPE would drive us here.
17041721
}
17051722
}
17061723

t/t9102-git-svn-deep-rmdir.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/bin/sh
22
test_description='git svn rmdir'
33

4-
TEST_PASSES_SANITIZE_LEAK=true
54
. ./lib-git-svn.sh
65

76
test_expect_success 'initialize repo' '

t/t9123-git-svn-rebuild-with-rewriteroot.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
test_description='git svn respects rewriteRoot during rebuild'
77

8-
TEST_PASSES_SANITIZE_LEAK=true
98
. ./lib-git-svn.sh
109

1110
mkdir import

t/t9128-git-svn-cmd-branch.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
test_description='git svn partial-rebuild tests'
77

8-
TEST_PASSES_SANITIZE_LEAK=true
98
. ./lib-git-svn.sh
109

1110
test_expect_success 'initialize svnrepo' '

t/t9167-git-svn-cmd-branch-subproject.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
test_description='git svn branch for subproject clones'
77

8-
TEST_PASSES_SANITIZE_LEAK=true
98
. ./lib-git-svn.sh
109

1110
test_expect_success 'initialize svnrepo' '

0 commit comments

Comments
 (0)