svn-3727

Version:

1.6.13

Bug Link:

http://subversion.tigris.org/issues/show_bug.cgi?id=3727

Patch Link:

http://svn.apache.org/viewvc?diff_format=h&view=revision&revision=1032970

Symptom:

When using ‘svn export’, and giving the current directory (“.”) a target, instead of copying the exported files into the current directory, SVN creates a directory with name of the last element of URL and then copy it to that directory.

How it is diagnosed:

reproduced!

How to reproduce:

$ svn export --force http://svn.apache.org/repos/asf/subversion/trunk/subversion/svn/schema .
A    schema
A    schema\blame.rnc
A    schema\log.rnc
A    schema\props.rnc
A    schema\status.rnc
A    schema\common.rnc
A    schema\diff.rnc
A    schema\info.rnc
A    schema\list.rnc
Exported revision 1021349.

Expected result:

$svn export --force http://svn.apache.org/repos/asf/subversion/trunk/subversion/svn/schema .
A    .
A    blame.rnc
A    log.rnc
A    props.rnc
A    status.rnc
A    common.rnc
A    diff.rnc
A    info.rnc
A    list.rnc
Exported revision 1021349.

Root Cause:

Brief:

They have a special case for handling empty path, which is undesirable. The patch is simply to delete that code.

Detail:


svn_error_t *
svn_cl__export(...)
{
        … …

         /* ‘to’ contains the target directory input by users. */
                   to = APR_ARRAY_IDX(targets, 1, const char *);

     /* If given the cwd, pretend we weren't given anything. */

     /* Here, compare the target directory “to” to empty string. And

         if the ‘to’ is essentially empty, then they are trying to do

         something smart: try to guess the target directory as the

         last field of the URL -- essentially is “schema”. In the patch,

         they simply deleted this logic! */
-                      if (strcmp("", to) == 0)

                  /* Input check! ‘to’ is empty here!!! */
-                        to = svn_path_uri_decode(svn_path_basename(truefrom, pool),

pool);

-                else
   /* svn_cl__eat_peg_revisions() but only on one target */
-                SVN_ERR(svn_opt__split_arg_at_peg_revision(&to, NULL, to, pool));


        }
        ...
         return err;
}

Failure symptom category

wrong result

Is there any log message?

No

Can ErrLog insert a log message?

Yes -- input check(strcmp).