Re: Fwd: Can't create temporary file from template ... No such file or directory

2021-12-14 Thread Daniel Sahlberg
Den ons 15 dec. 2021 kl 07:47 skrev Nathan Hartman :

> Anyway I have to pause for today...
>
> Oh one more thing. I believe I succeeded to reproduce the OP's
> original issue. If one more subdirectory is added, e.g., trunk/c/d/f,
> then f will trigger the same response as the OP reported.
>

Great work so far Nathan, I'm sure you will find your way through
eventually! I'm following along with great interest but family obligations
has so far kept me from digging into the code myself.

Kind regards,
Daniel


Re: Fwd: Can't create temporary file from template ... No such file or directory

2021-12-14 Thread Nathan Hartman
On Thu, Dec 9, 2021 at 10:32 AM Nathan Hartman  wrote:
> So the above can be distilled to:
>
> #  .
> #  ├── trunk/
> #  │   └── c/
> #  │   └── d/
> #  └── branches
> #  └── b/ (from trunk@2)
> #  └── c/
>
> It is the 'd' directory ('trunk/c/d/') that is throwing us off course.

As I mentioned before, in diff_dir_added() where that apr_pstrcat()
call happens, right_source->repos_relpath is NULL and my thinking was
that something is forgetting to set it. Long before reaching this
point, there are a few places that seem to come close to setting it
but none do, for reasons that appear reasonable.

So, if I hack diff_dir_added() to force the path to be what I think it
ought to be...

[[[
Index: subversion/libsvn_client/conflicts.c
===
--- subversion/libsvn_client/conflicts.c (revision 1895966)
+++ subversion/libsvn_client/conflicts.c (working copy)
@@ -7568,7 +7568,7 @@ diff_dir_added(const char *relpath,

   SVN_ERR(svn_io_dir_make(local_abspath, APR_OS_DEFAULT, scratch_pool));
   copyfrom_url = apr_pstrcat(scratch_pool, b->repos_root_url, "/",
- right_source->repos_relpath, SVN_VA_NULL);
+ "trunk/c/d"
/*right_source->repos_relpath*/, SVN_VA_NULL);
   SVN_ERR(svn_wc_add4(b->ctx->wc_ctx, local_abspath, svn_depth_infinity,
   copyfrom_url, right_source->revision,
   NULL, NULL, /* cancel func/baton */
]]]

...then it appears the call to svn_wc_add4() succeeds -- at least it
doesn't fail.

But immediately after (in diff_dir_added(),
libsvn_client/conflicts.c), we go into a loop that will call
svn_wc_prop_set4() four times. In the first iteration, it tries to set
"svn:entry:committed-rev" despite this foreboding comment in
svn_wc_prop_set4():

/* we don't do entry properties here */

Sure enough, we get:

svn: warning: apr_err=SVN_ERR_BAD_PROP_KIND
svn: warning: W28: Property 'svn:entry:committed-rev' is an entry property
subversion/svn/merge-cmd.c:556,
subversion/svn/resolve-cmd.c:157: (apr_err=SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE)
svn: E155027: Failure occurred resolving one or more conflicts

Now, this all leads me to believe that something is messed up long
before we get here. What's making this a bigger challenge to debug
than I'd like it to be is all the void pointers to various batons. I
just can't seem to hold in my head the types of more than a few so
quickly lose the ability to trace what comes from where, unless
there's some gdb trick I don't know about that can make it resolve the
correct type.

Anyway I have to pause for today...

Oh one more thing. I believe I succeeded to reproduce the OP's
original issue. If one more subdirectory is added, e.g., trunk/c/d/f,
then f will trigger the same response as the OP reported.

Cheers,
Nathan


Re: Fwd: Can't create temporary file from template ... No such file or directory

2021-12-09 Thread Nathan Hartman
On Thu, Dec 9, 2021 at 8:34 AM Nathan Hartman  wrote:
> I haven't found the cause yet but I do know now that the bug isn't in how we 
> are constructing the path. I'm away from my machine atm but I'll write back 
> soon with more...

The OP's repro script creates this structure:

#  .
#  ├── a
#  ├── trunk/
#  │   └── c/
#  │   └── d/
#  └── branches/
#  └── b/ (from trunk@3)
#  └── c/
#  └── e/

The 'trunk/c/' and 'branches/b/c/' directories have separate ancestry
and (correctly) trigger the conflict.

The 'a' file is irrelevant.

The 'branches/b/c/e/' directory is irrelevant. The same assertion
fails whether it is present or not.

So the above can be distilled to:

#  .
#  ├── trunk/
#  │   └── c/
#  │   └── d/
#  └── branches
#  └── b/ (from trunk@2)
#  └── c/

It is the 'd' directory ('trunk/c/d/') that is throwing us off course.

As I said before I haven't finished yet; I'll try to have another
debug session tonight to look more closely at update_entry() in
libsvn_repos/reporter.c; I think there will be an important clue
there.

Simplified repo script:

[[[

$SVNADMIN create repo
$SVN checkout file://$PWD/repo wc1
cd wc1
$SVN mkdir ^/trunk -m ""
$SVN mkdir ^/branches -m ""
$SVN cp ^/trunk ^/branches/b -m ""
$SVN mkdir ^/trunk/c -m ""
$SVN mkdir ^/trunk/c/d -m ""
$SVN mkdir ^/branches/b/c -m ""
cd ..
$SVN co file://$PWD/repo/branches/b wc2
cd wc2
$SVN merge ^/trunk .

]]]

Cheers,
Nathan


Re: Fwd: Can't create temporary file from template ... No such file or directory

2021-12-09 Thread Nathan Hartman
On Thu, Dec 9, 2021 at 6:37 AM Bert Huijben  wrote:

> We have helper functions for this scenario (svn_uri__*()) that also
> perform the required escaping rules (required for url, but not for relpath)


I haven't found the cause yet but I do know now that the bug isn't in how
we are constructing the path. I'm away from my machine atm but I'll write
back soon with more...

Cheers,
Nathan


RE: Fwd: Can't create temporary file from template ... No such file or directory

2021-12-09 Thread Bert Huijben
We have helper functions for this scenario (svn_uri__*()) that also perform the 
required escaping rules (required for url, but not for relpath)

Bert

-Original Message-
From: Stefan Sperling  
Sent: Monday, December 6, 2021 9:31 AM
To: Nathan Hartman 
Cc: Subversion Developers 
Subject: Re: Fwd: Can't create temporary file from template ... No such file or 
directory

On Sun, Dec 05, 2021 at 11:21:48PM -0500, Nathan Hartman wrote:
> On Sun, Dec 5, 2021 at 12:55 PM James McCoy  wrote:
> >
> > On Sun, Dec 05, 2021 at 12:41:30PM -0500, Nathan Hartman wrote:
> > > It's not dumping core on mine. I would like to debug this properly 
> > > but am running into various nonsense. For example, I haven't 
> > > figured out how to run it under gdb since svn is being called 
> > > through the libtool script;
> >
> > "libtool exec gdb ./subversion/svn ..." will run svn with the 
> > environment setup properly.
> 
> Perfect. That's the clue I needed. Thanks, James.
> 
> At diff_dir_added() at libsvn_client/conflicts.c:7570 (in current 
> trunk, r1895609) we are attempting to concat some path components
> with:
> 
>   copyfrom_url = apr_pstrcat(scratch_pool, b->repos_root_url, "/",
>  right_source->repos_relpath, 
> SVN_VA_NULL);
> 
> However, right_source->repos_relpath is an empty string, so we end up 
> with b->repos_root_url plus a trailing slash, causing the path to 
> become non-canonical.
> 
> The fix might be as simple as checking for that and not calling 
> apr_pstrcat(), but I would like to dig a little more before jumping to 
> conclusions.

Thanks, Nathan. I see this is in the conflict resolver so this is probably code 
I have written. But I won't snag this away from you. And if you need any help, 
just let me know. (I have not yet looked into details; I suspect that 
right_source might be bogus or simply invalid?)

Cheers,
Stefan



Re: Fwd: Can't create temporary file from template ... No such file or directory

2021-12-06 Thread Nathan Hartman
On Mon, Dec 6, 2021 at 3:31 AM Stefan Sperling  wrote:
>
> Thanks, Nathan. I see this is in the conflict resolver so this is probably
> code I have written. But I won't snag this away from you. And if you need
> any help, just let me know. (I have not yet looked into details; I suspect
> that right_source might be bogus or simply invalid?)

Thanks. I'm sure I will have questions soon! Not sure yet whether
right_source is bogus. I have a thought I'll test tomorrow. It's
getting late here so calling it a day for now, but I've been having
fun single-stepping through this merge invocation. Once I identify
what is unusual about this scenario, I'll try to reproduce it in a
regression test using the standard Greek tree if possible; if not,
then I'll fall back to just running the same steps as the repro. I'll
know more soon...

Cheers,
Nathan


Re: Fwd: Can't create temporary file from template ... No such file or directory

2021-12-06 Thread Stefan Sperling
On Sun, Dec 05, 2021 at 11:21:48PM -0500, Nathan Hartman wrote:
> On Sun, Dec 5, 2021 at 12:55 PM James McCoy  wrote:
> >
> > On Sun, Dec 05, 2021 at 12:41:30PM -0500, Nathan Hartman wrote:
> > > It's not dumping core on mine. I would like to debug this properly but
> > > am running into various nonsense. For example, I haven't figured out
> > > how to run it under gdb since svn is being called through the libtool
> > > script;
> >
> > "libtool exec gdb ./subversion/svn ..." will run svn with the
> > environment setup properly.
> 
> Perfect. That's the clue I needed. Thanks, James.
> 
> At diff_dir_added() at libsvn_client/conflicts.c:7570 (in current
> trunk, r1895609) we are attempting to concat some path components
> with:
> 
>   copyfrom_url = apr_pstrcat(scratch_pool, b->repos_root_url, "/",
>  right_source->repos_relpath, SVN_VA_NULL);
> 
> However, right_source->repos_relpath is an empty string, so we end up
> with b->repos_root_url plus a trailing slash, causing the path to
> become non-canonical.
> 
> The fix might be as simple as checking for that and not calling
> apr_pstrcat(), but I would like to dig a little more before jumping to
> conclusions.

Thanks, Nathan. I see this is in the conflict resolver so this is probably
code I have written. But I won't snag this away from you. And if you need
any help, just let me know. (I have not yet looked into details; I suspect
that right_source might be bogus or simply invalid?)

Cheers,
Stefan


Re: Fwd: Can't create temporary file from template ... No such file or directory

2021-12-05 Thread Nathan Hartman
On Sun, Dec 5, 2021 at 12:55 PM James McCoy  wrote:
>
> On Sun, Dec 05, 2021 at 12:41:30PM -0500, Nathan Hartman wrote:
> > It's not dumping core on mine. I would like to debug this properly but
> > am running into various nonsense. For example, I haven't figured out
> > how to run it under gdb since svn is being called through the libtool
> > script;
>
> "libtool exec gdb ./subversion/svn ..." will run svn with the
> environment setup properly.

Perfect. That's the clue I needed. Thanks, James.

At diff_dir_added() at libsvn_client/conflicts.c:7570 (in current
trunk, r1895609) we are attempting to concat some path components
with:

  copyfrom_url = apr_pstrcat(scratch_pool, b->repos_root_url, "/",
 right_source->repos_relpath, SVN_VA_NULL);

However, right_source->repos_relpath is an empty string, so we end up
with b->repos_root_url plus a trailing slash, causing the path to
become non-canonical.

The fix might be as simple as checking for that and not calling
apr_pstrcat(), but I would like to dig a little more before jumping to
conclusions.

I was hoping this would give some insight to the non-canonical path
assertions we hear about every so often; I'm sure this one has bitten
before...

Cheers,
Nathan

P.S., I invoked gdb with:

$ libtool exec gdb -tui -args /path/to/subversion/svn/svn merge ^/trunk

Note: At first I thought Emacs wouldn't run it through libtool with
M-x gdb because it complained that I didn't give '-i=mi' even though I
did and displayed everything garbled; but it turns out I forgot -args:

M-x gdb -> libtool exec gdb -i=mi -args /path/to/subversion/svn/svn
merge ^/trunk


Re: Fwd: Can't create temporary file from template ... No such file or directory

2021-12-05 Thread James McCoy
On Sun, Dec 05, 2021 at 12:41:30PM -0500, Nathan Hartman wrote:
> It's not dumping core on mine. I would like to debug this properly but
> am running into various nonsense. For example, I haven't figured out
> how to run it under gdb since svn is being called through the libtool
> script;

"libtool exec gdb ./subversion/svn ..." will run svn with the
environment setup properly.

Cheers,
-- 
James
GPG Key: 4096R/91BF BF4D 6956 BD5D F7B7  2D23 DFE6 91AE 331B A3DB