[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH]: Let users cancel out of command line client immediately if they signal 3 times

From: <kfogel_at_collab.net>
Date: 2006-03-13 05:10:34 CET

Daniel Berlin <dberlin@dberlin.org> writes:
> I've had a bunch of GCC user complaints about SVN not exiting for 10-30
> seconds after the user hits ctrl-c.
>
> Most people expect it to exit immediately.
>
> At the risk of restarting the IRC argument about whether the solution to
> this problem is to insert cancellation checks pretty much everywhere
> (which is what it would probably take on some repos to get that kind of
> interactivity), I'm submitting the following patch.

I didn't realize there was any controversy about cancellation checks
being our preferred method of getting responsivity, actually.

> Basically, it's a compromise. It allows users who really want to just
> cancel, to just cancel, by hitting ctrl-c (or some other caught signal)
> three times.
>
> In this case we just exit with an error status immediately by calling
> exit (1).
>
> (better exit strategies are of course, appreciated, i just didn't see
> what i should be doing there other than this).

Comments follow the patch...

> [[[
>
> Let user immediately exit svn client by hitting
> control-c three times.
>
> * subversion/svn/main.c
> (handled_cancel_times): New variable.
> (signal_handler): If we see the signal three times,
> exit with an error.
>
> ]]]
> Index: subversion/svn/main.c
> ===================================================================
> --- subversion/svn/main.c (revision 18847)
> +++ subversion/svn/main.c (working copy)
> @@ -768,11 +768,18 @@ check_lib_versions(void)
> /* A flag to see if we've been cancelled by the client or not. */
> static volatile sig_atomic_t cancelled = FALSE;
>
> +/* See how many times we have been sent a signal to cancel. */
> +static volatile sig_atomic_t handled_cancel_times = 0;
> +
> /* A signal handler to support cancellation. */
> static void
> signal_handler(int signum)
> {
> - apr_signal(signum, SIG_IGN);
> + handled_cancel_times++;
> +
> + /* If the user is adamant about exiting now, exit now. */
> + if (handled_cancel_times == 3)
> + exit(1);
> cancelled = TRUE;
> }

So, this doesn't have to be three times in close succession, it just
has to be three times -- they could be five minutes apart, on a really
big checkout, say, but we'd still bail on the third time. And it
would do nothing to help programs other than our command line client.

Thus, I still think just inserting more cancellation checks is the
best answer. Had you tried that and found it difficult, or was it
just the IRC conversation that put you off?

-Karl

-- 
www.collab.net  <>  CollabNet  |  Distributed Development On Demand
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Mar 13 06:59:04 2006

This is an archived mail posted to the Subversion Dev mailing list.