Let's continue the discussion on dev@.  [Moved from users@]

Ivan, would you like to write a regression test for this?  See
subversion/tests/cmdline/info_tests.py.

Cheers,

Daniel

P.S. Nathan, are you aware of this syntax? — «svn log --diff -x-wp -c r1823327»


Nathan Hartman wrote on Fri, Nov 22, 2019 at 01:01:56 -0500:
> On Tue, Nov 19, 2019 at 12:03 AM Nathan Hartman <hartman.nat...@gmail.com>
> wrote:
> > On Mon, Nov 18, 2019 at 4:53 AM Иван Селин <ivanse...@yandex-team.ru> wrote:
> >> Sample reproduction script attached.
> >
> >
> > Hello Ivan,
> >
> > Thank you for reporting this.
> >
> > I performed similar steps and I am seeing the same result, namely:
> >
> > $ svn info "$repo/dir/file"@1
> > svn: E160016: Failure opening '/dir' in revision 2
> > svn: E160016: '/dir' is not a directory in filesystem '(snip)'
> >
> > You asked for peg revision 1, it's looking in revision 2.
> >
> > I'm investigating...
> 
> Hello Ivan,
> 
> Update: This bug was introduced in r1823327.
> 
> I don't have a fix yet but at least we know where it is now.
> 
> The last command in your reproduction script:
> 'svn info "file://$REPO/dir/file"@1'
> works correctly in r1823326, fails in r1823327:
> 
> [[[
> 
> $ svn log -r 1823327
> ------------------------------------------------------------------------
> r1823327 | julianfoad | 2018-02-06 08:44:17 -0500 (Tue, 06 Feb 2018) | 21
> lines
> 
> Performance: Make the 'info' command fast on old repository revisions.
> 
> The svn_client_info4() API reports the lock status of the given URL (at
> head, implicitly) if that is the same resource as the given URL and
> revision. The 'same resource' check was inefficient, searching history
> forwards from the given revision up to head.
> 
> The problem was present even when a peg revision is specified and even when
> the 'svn info --show-item=x' option is used. (The 'show-item' filtering is
> not performed in the library.)
> 
> Example: 'svn info https://svn.apache.org/repos/asf/subversion@850000'
> took 13s before and 2s after this change.
> 
> See http://colabti.org/irclogger/irclogger_log/svn-dev?date=2018-02-06#l11
> 
> * subversion/libsvn_client/info.c
>   (same_resource_in_head): Search history backwards instead of forward.
> 
> Found by: jcorvel
> 
> $ svn diff -x-wp -r 1823326:1823327
> Index: subversion/libsvn_client/info.c
> ===================================================================
> --- subversion/libsvn_client/info.c (revision 1823326)
> +++ subversion/libsvn_client/info.c (revision 1823327)
> @@ -253,17 +253,17 @@ same_resource_in_head(svn_boolean_t *same_p,
>                        apr_pool_t *pool)
>  {
>    svn_error_t *err;
> -  svn_opt_revision_t start_rev, peg_rev;
> +  svn_opt_revision_t operative_rev, peg_rev;
>    const char *head_url;
> 
> -  start_rev.kind = svn_opt_revision_head;
> -  peg_rev.kind = svn_opt_revision_number;
> -  peg_rev.value.number = rev;
> +  peg_rev.kind = svn_opt_revision_head;
> +  operative_rev.kind = svn_opt_revision_number;
> +  operative_rev.value.number = rev;
> 
>    err = svn_client__repos_locations(&head_url, NULL, NULL, NULL,
>                                      ra_session,
>                                      url, &peg_rev,
> -                                    &start_rev, NULL,
> +                                    &operative_rev, NULL,
>                                      ctx, pool);
>    if (err &&
>        ((err->apr_err == SVN_ERR_CLIENT_UNRELATED_RESOURCES) ||
> 
> ]]]
> 
> I modified your reproduction script a little and ran a bisect using
> https://metacpan.org/pod/distribution/App-SVN-Bisect/bin/svn-bisect.
> (Excuse the hard-coded paths.)
> 
> [[[
> 
> #!/bin/bash
> 
> SVN=/home/nate/ramdrive/svn-trunk/subversion/svn/svn
> SVNADMIN=/home/nate/ramdrive/svn-trunk/subversion/svnadmin/svnadmin
> 
> REPO="/home/nate/ramdrive/repo"
> WC="/home/nate/ramdrive/wc"
> 
> rm -rf "$REPO"
> rm -rf "$WC"
> 
> "$SVNADMIN" create "$REPO"
> "$SVN" checkout "file://$REPO" "$WC"
> cd "$WC"
> 
> mkdir dir
> echo text > dir/file
> "$SVN" add dir
> 
> # Commit r1
> "$SVN" ci -m 'Add file'
> 
> "$SVN" cp dir/file file-moved
> "$SVN" rm dir
> echo replaced > dir
> "$SVN" add dir
> 
> # Commit r2
> "$SVN" ci -m 'Replace dir with file'
> 
> "$SVN" up
> 
> # The moment of truth
> "$SVN" info "file://$REPO/dir/file"@1
> 
> ]]]
> 
> Nathan

Reply via email to