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

Re: Printing error stacks.

From: Daniel Shahaf <danielsh_at_apache.org>
Date: Fri, 12 Apr 2013 22:42:00 +0300

Daniel Shahaf wrote on Fri, Apr 12, 2013 at 22:22:18 +0300:
> C. Michael Pilato wrote on Fri, Apr 12, 2013 at 15:16:23 -0400:
> > On 04/12/2013 02:53 PM, Daniel Shahaf wrote:
> > > Another idea: avoid printing the (apr_err=) part if it's the same code as the
> > > line above it (which should be the common case):
> > >
> > > subversion/svn/checkout-cmd.c:168 (apr_err=SVN_ERR_RA_LOCAL_REPOS_OPEN_FAILED)
> > > subversion/libsvn_client/checkout.c:197 (apr_err=^)
> > > subversion/libsvn_client/checkout.c:100 (apr_err=^)
> > > subversion/libsvn_client/ra.c:541 (apr_err=^)
> > > subversion/libsvn_client/ra.c:393 (apr_err=^)
> > > subversion/libsvn_ra/ra_loader.c:482 (apr_err=^)
> > > svn: E180001: Unable to connect to a repository at URL 'file:///home/cmpilato/tests/arch'
> > > subversion/libsvn_ra_local/ra_plugin.c:578 (apr_err=^)
> > > svn: E180001: Unable to open an ra_local session to URL
> > > subversion/libsvn_ra_local/split_url.c:46 (apr_err=SVN_ERR_SOMETHING_ELSE)
> > > svn: E180003: Unable to open repository 'file:///home/cmpilato/tests/arch'
> >
> > I like the brevity. One concern that I have with this (and with the current
> > output, for that matter) is that there is really nothing that tells me that
> > E180003 means SVN_ERR_RA_LOCAL_REPOS_OPEN_FAILED. I've got a line which
> > lists the symbolic name, a bunch of lines with effectively say "ditto", and
> > then a line of actual "meat" that refers only to a number and *not* the name.
> >
>
> The last two lines are something like:
>
> subversion/libsvn_ra_local/split_url.c:46 (apr_err=SVN_ERR_SOMETHING_ELSE)
> subversion/libsvn_ra_local/foobar.c:146 (apr_err=^)
> svn: E180003: Unable to open repository 'file:///home/cmpilato/tests/arch'
>
> The symbolic name of E180003 is SVN_ERR_SOMETHING_ELSE, you get to it by
> looking for the closest symbolic name above E180003.

Actually I got my stack reversed. It's easier to implement a "See
below" than a "See above", and of course "See below" means the symbolic
error is always immediately above the numeric one:

    % $svn upgrade /
    subversion/svn/upgrade-cmd.c:73: (apr_err=_)
    subversion/libsvn_client/upgrade.c:112: (apr_err=_)
    subversion/libsvn_wc/upgrade.c:2194: (apr_err=_)
    subversion/libsvn_wc/wc_db.c:15006: (apr_err=SVN_ERR_WC_INVALID_OP_ON_CWD)
    svn: E155019: Can't upgrade '/' as it is not a working copy root
    subversion/libsvn_wc/wc_db_util.c:134: (apr_err=_)
    svn: E000002: Working copy database '/.svn/wc.db' not found
    subversion/libsvn_wc/wc_db.c:15006: (apr_err=_)
    svn: E000002: Additional errors:
    subversion/libsvn_wc/old-and-busted.c:1201: (apr_err=_)
    subversion/libsvn_wc/adm_files.c:294: (apr_err=_)
    subversion/libsvn_subr/stream.c:850: (apr_err=_)
    subversion/libsvn_subr/io.c:3271: (apr_err=2)
    svn: E000002: Can't open file '/.svn/entries': No such file or directory
    zsh: exit 1 $svn upgrade /

Patch:

    Index: subversion/libsvn_subr/error.c
    ===================================================================
    --- subversion/libsvn_subr/error.c (revision 1467433)
    +++ subversion/libsvn_subr/error.c (working copy)
    @@ -454,6 +454,8 @@ svn_error_purge_tracing(svn_error_t *err)
     #endif /* SVN_ERR__TRACING */
     }
     
    +/* ### The logic around printing "_" in maintainer mode is very tightly
    + ### coupled to the current sole caller.*/
     static void
     print_error(svn_error_t *err, FILE *stream, const char *prefix)
     {
    @@ -482,7 +484,12 @@ print_error(svn_error_t *err, FILE *stream, const
         }
     
       {
    - const char *symbolic_name = svn_error_symbolic_name(err->apr_err);
    + const char *symbolic_name;
    + if (err->child && err->apr_err == err->child->apr_err)
    + symbolic_name = "_";
    + else
    + symbolic_name = svn_error_symbolic_name(err->apr_err);
    +
         if (symbolic_name)
           svn_error_clear(svn_cmdline_fprintf(stream, err->pool,
                                               ": (apr_err=%s)\n", symbolic_name));
Received on 2013-04-12 21:42:11 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.