summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c55fae4)
raw | patch | inline | side by side (parent: c55fae4)
author | Junio C Hamano <gitster@pobox.com> | |
Fri, 19 Dec 2008 01:31:57 +0000 (17:31 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 21 Dec 2008 09:56:20 +0000 (01:56 -0800) |
We cleaned up lockfiles upon receiving the usual suspects HUP, TERM, QUIT
but a wicked user could kill us of asphyxiation by piping our output to a
pipe that does not read. Protect ourselves by catching SIGPIPE and clean
up the lockfiles as well in such a case.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
but a wicked user could kill us of asphyxiation by piping our output to a
pipe that does not read. Protect ourselves by catching SIGPIPE and clean
up the lockfiles as well in such a case.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
lockfile.c | patch | blob | history | |
t/t3600-rm.sh | patch | blob | history |
diff --git a/lockfile.c b/lockfile.c
index 6d756086939b631ab13bf4fcdb8deed2787eed6b..8589155532da9eb7f42a1e9c3132fcf42b1b9275 100644 (file)
--- a/lockfile.c
+++ b/lockfile.c
signal(SIGHUP, remove_lock_file_on_signal);
signal(SIGTERM, remove_lock_file_on_signal);
signal(SIGQUIT, remove_lock_file_on_signal);
+ signal(SIGPIPE, remove_lock_file_on_signal);
atexit(remove_lock_file);
}
lk->owner = getpid();
diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh
index b7d46e50a87f2609e67f595470021450b1f838a6..95542e9cfec1d7cc0631521c1c2bef3b7a139af7 100755 (executable)
--- a/t/t3600-rm.sh
+++ b/t/t3600-rm.sh
'
+test_expect_success 'choking "git rm" should not let it die with cruft' '
+ git reset -q --hard &&
+ H=0000000000000000000000000000000000000000 &&
+ i=0 &&
+ while test $i -lt 12000
+ do
+ echo "100644 $H 0 some-file-$i"
+ i=$(( $i + 1 ))
+ done | git update-index --index-info &&
+ git rm -n "some-file-*" | :;
+ test -f .git/index.lock
+ status=$?
+ rm -f .git/index.lock
+ git reset -q --hard
+ test "$status" != 0
+'
+
test_done