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

Re: [PATCH] Re: Error exit conditions from svn binaries

From: Daniel Shahaf <d.s_at_daniel.shahaf.co.il>
Date: Tue, 29 Apr 2008 13:44:29 +0300 (IDT)

Daniel Shahaf wrote on Tue, 22 Apr 2008 at 17:37 +0300:
> Is there any objection to changing the abort() in svn_handle_error2() to
> exit()?
>
> Daniel
>
>
>
>
> [[[
> Do not abort in svn_handle_error2().
>
> * subversion/include/svn_error.h
> (svn_handle_error2):
> Document that the error is cleared before exiting.
>
> * subversion/libsvn_subr/error.c
> (svn_handle_error2):
> When fatal == TRUE, clear the error and call exit() instead of abort().
>
> Patch by: Daniel Shahaf <d.s_at_daniel.shahaf.co.il>
> Suggested by: stsp
> ]]]
>

No objections and passes 'make check'. Committed in r30835.

Daniel

> Index: subversion/include/svn_error.h
> ===================================================================
> --- subversion/include/svn_error.h (revision 30750)
> +++ subversion/include/svn_error.h (working copy)
> @@ -176,9 +176,9 @@ void svn_error_clear(svn_error_t *error);
>
> /**
> * Very basic default error handler: print out error stack @a error to the
> - * stdio stream @a stream, with each error prefixed by @a prefix, and quit
> - * iff the @a fatal flag is set. Allocations are performed in the @a error's
> - * pool.
> + * stdio stream @a stream, with each error prefixed by @a prefix; quit and
> + * clear @a error iff the @a fatal flag is set. Allocations are performed
> + * in the @a error's pool.
> *
> * If you're not sure what prefix to pass, just pass "svn: ". That's
> * what code that used to call svn_handle_error() and now calls
> Index: subversion/libsvn_subr/error.c
> ===================================================================
> --- subversion/libsvn_subr/error.c (revision 30750)
> +++ subversion/libsvn_subr/error.c (working copy)
> @@ -375,6 +375,7 @@ svn_handle_error2(svn_error_t *err,
> use a subpool. */
> apr_pool_t *subpool;
> apr_array_header_t *empties;
> + svn_error_t *tmp_err;
>
> /* ### The rest of this file carefully avoids using svn_pool_*(),
> preferring apr_pool_*() instead. I can't remember why -- it may
> @@ -383,16 +384,17 @@ svn_handle_error2(svn_error_t *err,
> apr_pool_create(&subpool, err->pool);
> empties = apr_array_make(subpool, 0, sizeof(apr_status_t));
>
> - while (err)
> + tmp_err = err;
> + while (tmp_err)
> {
> int i;
> svn_boolean_t printed_already = FALSE;
>
> - if (! err->message)
> + if (! tmp_err->message)
> {
> for (i = 0; i < empties->nelts; i++)
> {
> - if (err->apr_err == APR_ARRAY_IDX(empties, i, apr_status_t) )
> + if (tmp_err->apr_err == APR_ARRAY_IDX(empties, i, apr_status_t) )
> {
> printed_already = TRUE;
> break;
> @@ -402,23 +404,28 @@ svn_handle_error2(svn_error_t *err,
>
> if (! printed_already)
> {
> - print_error(err, stream, prefix);
> - if (! err->message)
> + print_error(tmp_err, stream, prefix);
> + if (! tmp_err->message)
> {
> - APR_ARRAY_PUSH(empties, apr_status_t) = err->apr_err;
> + APR_ARRAY_PUSH(empties, apr_status_t) = tmp_err->apr_err;
> }
> }
>
> - err = err->child;
> + tmp_err = tmp_err->child;
> }
>
> svn_pool_destroy(subpool);
>
> fflush(stream);
> if (fatal)
> - /* XXX Shouldn't we exit(1) here instead, so that atexit handlers
> - get called? --xbc */
> - abort();
> + {
> + /* Avoid abort()s in maintainer mode. */
> + svn_error_clear(err);
> +
> + /* We exit(1) here instead of abort()ing so that atexit handlers
> + get called. */
> + exit(EXIT_FAILURE);
> + }
> }
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-04-29 12:44:58 CEST

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.