git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] Allow diff and index commands to be interrupted
@ 2006-01-31 23:40 Petr Baudis
  0 siblings, 0 replies; only message in thread
From: Petr Baudis @ 2006-01-31 23:40 UTC (permalink / raw
  To: Junio C Hamano; +Cc: git

So far, e.g. git-update-index --refresh was basically uninterruptable
by ctrl-c, since it hooked the SIGINT handler, but that handler would
only unlink the lockfile but not actually quit. This makes it propagate
the signal to the default handler.

Note that I expected it to work without resetting the signal handler to
SIG_DFL, but without that it ended in an infinite loop of tgkill()s -
is my glibc violating SUS or what?

Signed-off-by: Petr Baudis <pasky@suse.cz>
---

 diff.c  |    2 ++
 index.c |    2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/diff.c b/diff.c
index 8ae6dbc..ec51e7d 100644
--- a/diff.c
+++ b/diff.c
@@ -555,6 +555,8 @@ static void remove_tempfile(void)
 static void remove_tempfile_on_signal(int signo)
 {
 	remove_tempfile();
+	signal(SIGINT, SIG_DFL);
+	raise(signo);
 }
 
 /* An external diff command takes:
diff --git a/index.c b/index.c
index ad0eafe..f92b960 100644
--- a/index.c
+++ b/index.c
@@ -18,6 +18,8 @@ static void remove_lock_file(void)
 static void remove_lock_file_on_signal(int signo)
 {
 	remove_lock_file();
+	signal(SIGINT, SIG_DFL);
+	raise(signo);
 }
 
 int hold_index_file_for_update(struct cache_file *cf, const char *path)

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2006-01-31 23:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-31 23:40 [PATCH] Allow diff and index commands to be interrupted Petr Baudis

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).