You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Arild Fines <ar...@broadpark.no> on 2003/04/29 16:27:24 UTC

Calling svn_client_commit on single file with nonrecursive set to true causes fubarness

One of the tests in our testsuite(ankhsvn) picked up something which looks
like a regression from 0.20. If you call svn_client_commit on a single file
with the nonrecursive flag set to true, the whole thing bails out and
complains about an invalid path, the error message looking like this:

Commit failed (details follow):
check_path: problem checking path "n:/tmp/wc/??????Çá<"

Obviously, that last part of the path shouldn't be there. The problem seems
to have something to do with the following lines(163-169) in
libsvn_subr/target.c:

rel_item = ((const char **)abs_targets->elts)[i];
/* If a common prefix was found, condensed_targets
are given relative to that prefix. */
if (basedir_len > 0)
	rel_item += basedir_len + 1;

In the case that nonrecursive is set to true, basedir will be the same as
rel_item, and rel_item + basedir_len + 1 is one step off the end of
rel_item.

The attached file reproduces this behavior for me on Windows XP, linked
against Subversion rev 5740.

--
Arild

Re: Calling svn_client_commit on single file with nonrecursive set to true causes fubarness

Posted by Philip Martin <ph...@codematters.co.uk>.
cmpilato@collab.net writes:

> Oh yeah!  I forgot I had valgrind!  Thanks, Phillip.  Is the following
> the part of the valgrind output that is telling me of this problem?
> 
> ==19158== Conditional jump or move depends on uninitialised value(s)
> ==19158==    at 0x40168B76: strlen (vg_clientfuncs.c:436)
> ==19158==    by 0x403E95DE: apr_pstrdup (apr_strings.c:114)
> ==19158==    by 0x402E775D: svn_path_condense_targets (subversion/libsvn_subr/target.c:171)
> ==19158==    by 0x4021973E: svn_client_commit (subversion/libsvn_client/commit.c:733)

Yes.  Use valgrind's --gdb-attach=yes option to see the gory details.

-- 
Philip Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Calling svn_client_commit on single file with nonrecursive set to true causes fubarness

Posted by cm...@collab.net.
Philip Martin <ph...@codematters.co.uk> writes:

> You don't need a Windows build, valgrind on Unix shows that Arild's
> analysis is correct.  Using 'svn ci -N wc/foo' the problem occurs on
> the *second* call to svn_path_condense_targets, with the code
> 
>                 /* If a common prefix was found, condensed_targets
>                    are given relative to that prefix. */
>                 if (basedir_len > 0)
>                   rel_item += basedir_len + 1;
>                 
>                 (*((const char **)apr_array_push (*pcondensed_targets)))
>                   = apr_pstrdup (pool, rel_item);
> 
> rel_item is an absolute path, something like "/home/pm/wc/foo", and
> basedir_len is the strlen of that path.  So adding basedir_len+1 to
> rel_item produces a pointer to arbitrary memory.

Oh yeah!  I forgot I had valgrind!  Thanks, Phillip.  Is the following
the part of the valgrind output that is telling me of this problem?

==19158== Conditional jump or move depends on uninitialised value(s)
==19158==    at 0x40168B76: strlen (vg_clientfuncs.c:436)
==19158==    by 0x403E95DE: apr_pstrdup (apr_strings.c:114)
==19158==    by 0x402E775D: svn_path_condense_targets (subversion/libsvn_subr/target.c:171)
==19158==    by 0x4021973E: svn_client_commit (subversion/libsvn_client/commit.c:733)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Calling svn_client_commit on single file with nonrecursive set to true causes fubarness

Posted by Philip Martin <ph...@codematters.co.uk>.
cmpilato@collab.net writes:

> "Arild Fines" <ar...@broadpark.no> writes:
> 
> > One of the tests in our testsuite(ankhsvn) picked up something which looks
> > like a regression from 0.20. If you call svn_client_commit on a single file
> > with the nonrecursive flag set to true, the whole thing bails out and
> > complains about an invalid path, the error message looking like this:
> > 
> > Commit failed (details follow):
> > check_path: problem checking path "n:/tmp/wc/??????Çá<"
> 
> Hm.  My Windows build seems to be horked.  Does the same thing happen
> if you use the Subversion client itself (instead of your test code),
> passing -N and a single file target?

You don't need a Windows build, valgrind on Unix shows that Arild's
analysis is correct.  Using 'svn ci -N wc/foo' the problem occurs on
the *second* call to svn_path_condense_targets, with the code

                /* If a common prefix was found, condensed_targets
                   are given relative to that prefix. */
                if (basedir_len > 0)
                  rel_item += basedir_len + 1;
                
                (*((const char **)apr_array_push (*pcondensed_targets)))
                  = apr_pstrdup (pool, rel_item);

rel_item is an absolute path, something like "/home/pm/wc/foo", and
basedir_len is the strlen of that path.  So adding basedir_len+1 to
rel_item produces a pointer to arbitrary memory.

-- 
Philip Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

RE: Calling svn_client_commit on single file with nonrecursive set to true causes fubarness

Posted by Arild Fines <ar...@broadpark.no>.
cmpilato@collab.net wrote:
> "Arild Fines" <ar...@broadpark.no> writes:
>
>> One of the tests in our testsuite(ankhsvn) picked up something which
>> looks like a regression from 0.20. If you call svn_client_commit on
>> a single file with the nonrecursive flag set to true, the whole
>> thing bails out and complains about an invalid path, the error
>> message looking like this:
>>
>> Commit failed (details follow):
>> check_path: problem checking path "n:/tmp/wc/??????Çá<"
>
> Hm.  My Windows build seems to be horked.  Does the same thing happen
> if you use the Subversion client itself (instead of your test code),
> passing -N and a single file target?

Yes:

N:\tmp>svn.exe commit \tmp\wc\Form.cs -N
n:\subversion\subversion\libsvn_client\commit.c:628: (apr_err=22)
svn: Invalid argument
svn: Commit failed (details follow):
n:\subversion\subversion\libsvn_subr\io.c:71: (apr_err=22)
svn: check_path: problem checking path "N:/tmp/wc/??????9"

--
Arild





---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Calling svn_client_commit on single file with nonrecursive set to true causes fubarness

Posted by cm...@collab.net.
"Arild Fines" <ar...@broadpark.no> writes:

> One of the tests in our testsuite(ankhsvn) picked up something which looks
> like a regression from 0.20. If you call svn_client_commit on a single file
> with the nonrecursive flag set to true, the whole thing bails out and
> complains about an invalid path, the error message looking like this:
> 
> Commit failed (details follow):
> check_path: problem checking path "n:/tmp/wc/??????Çá<"

Hm.  My Windows build seems to be horked.  Does the same thing happen
if you use the Subversion client itself (instead of your test code),
passing -N and a single file target?

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org


Re: Calling svn_client_commit on single file with nonrecursive set to true causes fubarness

Posted by cm...@collab.net.
"Arild Fines" <ar...@broadpark.no> writes:

> One of the tests in our testsuite(ankhsvn) picked up something which looks
> like a regression from 0.20. If you call svn_client_commit on a single file
> with the nonrecursive flag set to true, the whole thing bails out and
> complains about an invalid path, the error message looking like this:
> 
> Commit failed (details follow):
> check_path: problem checking path "n:/tmp/wc/??????Çá<"
> 
> Obviously, that last part of the path shouldn't be there. The problem seems
> to have something to do with the following lines(163-169) in
> libsvn_subr/target.c:
> 
> rel_item = ((const char **)abs_targets->elts)[i];
> /* If a common prefix was found, condensed_targets
> are given relative to that prefix. */
> if (basedir_len > 0)
> 	rel_item += basedir_len + 1;
> 
> In the case that nonrecursive is set to true, basedir will be the same as
> rel_item, and rel_item + basedir_len + 1 is one step off the end of
> rel_item.
> 
> The attached file reproduces this behavior for me on Windows XP, linked
> against Subversion rev 5740.

Just so happens I'm working in that function this morning.  Will look
at this problem while I'm there.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org