You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by "C. Michael Pilato" <cm...@collab.net> on 2013/04/12 21:16:23 UTC

Re: Printing error stacks.

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.

>> svn: E180003: Unable to connect to a repository at URL 'file:///home/cmpilato/tests/arch'
>> svn: E180012: Unable to open an ra_local session to URL
>> svn: E180001: Unable to open repository 'file:///home/cmpilato/tests/arch'
>> (E1800001 = SVN_ERR_RA_LOCAL_REPOS_OPEN_FAILED)
>> (E1800003 = SVN_ERR_SOMETHING_ELSE)
>> (E1800012 = SVN_ERR_YET_ANOTHER_FAILURE)
>>
>> Thoughts?
> 
> That's an interesting idea.  I don't have a strong opinion on it at the moment.

Fair 'nuff.


-- 
C. Michael Pilato <cm...@collab.net>
CollabNet   <>   www.collab.net   <>   Enterprise Cloud Development


Re: Printing error stacks.

Posted by Daniel Shahaf <da...@elego.de>.
Justin Erenkrantz wrote on Sat, Apr 13, 2013 at 08:27:52 -0400:
> On Fri, Apr 12, 2013 at 6:28 PM, Peter Samuelson <pe...@p12n.org> wrote:
> 
> > What is the utility of the "(apr_err=_)" suffix there?  I think it's
> > better to omit it.  Print apr_err= only when it is new information.
> >
> 
> +1.  -- justin

You guys can stop agreeing, trunk already behaves that way :)

Re: Printing error stacks.

Posted by Justin Erenkrantz <ju...@erenkrantz.com>.
On Fri, Apr 12, 2013 at 6:28 PM, Peter Samuelson <pe...@p12n.org> wrote:

> What is the utility of the "(apr_err=_)" suffix there?  I think it's
> better to omit it.  Print apr_err= only when it is new information.
>

+1.  -- justin

Re: Printing error stacks.

Posted by Peter Samuelson <pe...@p12n.org>.
Yay, a bikeshed discussion!

[Daniel Shahaf]
>     % $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 /

What is the utility of the "(apr_err=_)" suffix there?  I think it's
better to omit it.  Print apr_err= only when it is new information.

Re: Printing error stacks.

Posted by Daniel Shahaf <da...@apache.org>.
Daniel Shahaf wrote on Fri, Apr 12, 2013 at 22:55:59 +0300:
> (And, FTR, the condition in my previous patch should have been just
> "svn_error__is_tracing_link().)

Committed that in r1467440 since it does make the code less cluttered;
we can tweak it further as this thread converges upon other options

Re: Printing error stacks.

Posted by Daniel Shahaf <da...@apache.org>.
C. Michael Pilato wrote on Fri, Apr 12, 2013 at 15:49:43 -0400:
> On 04/12/2013 03:42 PM, Daniel Shahaf wrote:
> > 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:
> 
> Eh ... not so thrilling.

I don't think it's critical to have the symbolic and numeric codes on
the same line.

(And, FTR, the condition in my previous patch should have been just
"svn_error__is_tracing_link().)

Re: Printing error stacks.

Posted by "C. Michael Pilato" <cm...@collab.net>.
On 04/12/2013 03:42 PM, Daniel Shahaf wrote:
> 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:

Eh ... not so thrilling.

-- 
C. Michael Pilato <cm...@collab.net>
CollabNet   <>   www.collab.net   <>   Enterprise Cloud Development


Re: Printing error stacks.

Posted by Daniel Shahaf <da...@apache.org>.
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));

Re: Printing error stacks.

Posted by Daniel Shahaf <da...@apache.org>.
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.