From 037a98cd3f3efe85c6f56c4338002e4b2c7afa09 Mon Sep 17 00:00:00 2001 From: Roman Kagan Date: Mon, 2 Apr 2012 17:29:32 +0400 Subject: [PATCH 1/4] git-svn: use POSIX::sigprocmask to block signals In order to maintain consistency of the database mapping svn revision numbers to git commit ids, rev_map_set() defers signal processing until it's finished with an append transaction.[*] The conventional way to achieve this is through sigprocmask(), which is available in perl in the standard POSIX module. This is implemented by this patch. One important consequence of it is that the signal handlers won't be unconditionally set to SIG_DFL anymore upon the first invocation of rev_map_set() as they used to. As a result, the signals ignored by git-svn parent will remain ignored; otherwise the behavior remains the same. This patch paves the way to ignoring SIGPIPE throughout git-svn which will be done in the followup patch. [*] Deferring signals is not enough to ensure the database consistency: the program may die on SIGKILL or power loss, run out of disk space, etc. However that's a separate issue that this patch doesn't address. Signed-off-by: Roman Kagan Acked-by: Eric Wong --- git-svn.perl | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/git-svn.perl b/git-svn.perl index 4334b95f70..570504cee7 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -2031,6 +2031,7 @@ use IPC::Open3; use Time::Local; use Memoize; # core since 5.8.0, Jul 2002 use Memoize::Storable; +use POSIX qw(:signal_h); my ($_gc_nr, $_gc_period); @@ -4059,11 +4060,14 @@ sub rev_map_set { length $commit == 40 or die "arg3 must be a full SHA1 hexsum\n"; my $db = $self->map_path($uuid); my $db_lock = "$db.lock"; - my $sig; + my $sigmask; $update_ref ||= 0; if ($update_ref) { - $SIG{INT} = $SIG{HUP} = $SIG{TERM} = $SIG{ALRM} = $SIG{PIPE} = - $SIG{USR1} = $SIG{USR2} = sub { $sig = $_[0] }; + $sigmask = POSIX::SigSet->new(); + my $signew = POSIX::SigSet->new(SIGINT, SIGHUP, SIGTERM, + SIGALRM, SIGPIPE, SIGUSR1, SIGUSR2); + sigprocmask(SIG_BLOCK, $signew, $sigmask) or + croak "Can't block signals: $!"; } mkfile($db); @@ -4102,9 +4106,8 @@ sub rev_map_set { "$db_lock => $db ($!)\n"; delete $LOCKFILES{$db_lock}; if ($update_ref) { - $SIG{INT} = $SIG{HUP} = $SIG{TERM} = $SIG{ALRM} = $SIG{PIPE} = - $SIG{USR1} = $SIG{USR2} = 'DEFAULT'; - kill $sig, $$ if defined $sig; + sigprocmask(SIG_SETMASK, $sigmask) or + croak "Can't restore signal mask: $!"; } } From 6ade9bdadaf61565ee4e2ab47f66baaf41a20ecf Mon Sep 17 00:00:00 2001 From: Roman Kagan Date: Mon, 2 Apr 2012 17:52:34 +0400 Subject: [PATCH 2/4] git-svn: ignore SIGPIPE In HTTP with keep-alive it's not uncommon for the client to notice that the server decided to stop maintaining the current connection only when sending a new request. This naturally results in -EPIPE and possibly SIGPIPE. The subversion library itself makes no provision for SIGPIPE. Some combinations of the underlying libraries do (typically SIG_IGN-ing it), some don't. Presumably for that reason all subversion commands set SIGPIPE to SIG_IGN early in their main()-s. So should we. This, together with the previous patch, fixes the notorious "git-svn died of signal 13" problem (see e.g. http://thread.gmane.org/gmane.comp.version-control.git/134936). Signed-off-by: Roman Kagan Acked-by: Eric Wong --- git-svn.perl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/git-svn.perl b/git-svn.perl index 570504cee7..aa14564e33 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -36,6 +36,11 @@ $ENV{TZ} = 'UTC'; $| = 1; # unbuffer STDOUT sub fatal (@) { print STDERR "@_\n"; exit 1 } + +# All SVN commands do it. Otherwise we may die on SIGPIPE when the remote +# repository decides to close the connection which we expect to be kept alive. +$SIG{PIPE} = 'IGNORE'; + sub _req_svn { require SVN::Core; # use()-ing this causes segfaults for me... *shrug* require SVN::Ra; From 8c3a534c506bceb4981266e0c5db2918bb067da8 Mon Sep 17 00:00:00 2001 From: Roman Kagan Date: Mon, 23 Apr 2012 20:26:56 +0400 Subject: [PATCH 3/4] git-svn: drop redundant blocking of SIGPIPE Now that SIGPIPE is ignored there's no point blocking it. Signed-off-by: Roman Kagan Acked-by: Eric Wong --- git-svn.perl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-svn.perl b/git-svn.perl index aa14564e33..f8e9ef0ea6 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -4070,7 +4070,7 @@ sub rev_map_set { if ($update_ref) { $sigmask = POSIX::SigSet->new(); my $signew = POSIX::SigSet->new(SIGINT, SIGHUP, SIGTERM, - SIGALRM, SIGPIPE, SIGUSR1, SIGUSR2); + SIGALRM, SIGUSR1, SIGUSR2); sigprocmask(SIG_BLOCK, $signew, $sigmask) or croak "Can't block signals: $!"; } From f9d995d5dd39c942c06829e45f195eeaa99936e1 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 24 Apr 2012 14:50:06 -0700 Subject: [PATCH 4/4] The fifth batch of topics graduated to 'master' Signed-off-by: Junio C Hamano --- Documentation/RelNotes/1.7.11.txt | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/Documentation/RelNotes/1.7.11.txt b/Documentation/RelNotes/1.7.11.txt index 5925312c93..08a6c31c7f 100644 --- a/Documentation/RelNotes/1.7.11.txt +++ b/Documentation/RelNotes/1.7.11.txt @@ -8,6 +8,9 @@ UI, Workflows & Features * A third-party tool "git subtree" is distributed in contrib/ + * Error messages given when @{u} is used for a branch without its + upstream configured have been clatified. + * Even with "-q"uiet option, "checkout" used to report setting up tracking. Also "branch" learned the "-q"uiet option to squelch informational message. @@ -30,11 +33,20 @@ UI, Workflows & Features * The cases "git push" fails due to non-ff can be broken into three categories; each case is given a separate advise message. + * "git push --recurse-submodules" learned to optionally look into the + histories of submodules bound to the superproject and push them + out. + * A 'snapshot' request to "gitweb" honors If-Modified-Since: header, based on the commit date. + * "gitweb" learned to highlight the patch it outputs even more. + Foreign Interface + * "git svn" used to die with unwanted SIGPIPE when talking with HTTP + server that uses keep-alive. + * "git p4" has been moved out of contrib/ area. Performance @@ -61,6 +73,9 @@ Internal Implementation (please report possible regressions) systems, run-command API now uses SHELL_PATH, not /bin/sh, when spawning an external command (not applicable to Windows port). + * The API to iterate over refs/ hierarchy has been tweaked to allow + walking only a subset of it more efficiently. + Also contains minor documentation updates and code clean-ups. @@ -71,6 +86,17 @@ Unless otherwise noted, all the fixes since v1.7.10 in the maintenance releases are contained in this release (see release notes to them for details). + * The parser in "fast-import" did not diagnose ":9" style references + that is not followed by required SP/LF as an error. + (merge 06454cb pw/fast-import-dataref-parsing later to maint). + + * When "git fetch" encounters repositories with too many references, + the command line of "fetch-pack" that is run by a helper + e.g. remote-curl, may fail to hold all of them. Now such an + internal invocation can feed the references through the standard + input of "fetch-pack". + (merge 7103d25 it/fetch-pack-many-refs later to maint). + * "git fetch" that recurses into submodules on demand did not check if it needs to go into submodules when non branches (most notably, tags) are fetched.