You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2014/10/29 13:54:39 UTC

svn commit: r1635118 - in /subversion/trunk/subversion: include/private/svn_opt_private.h include/svn_client.h libsvn_client/cmdline.c libsvn_subr/opt.c

Author: julianfoad
Date: Wed Oct 29 12:54:38 2014
New Revision: 1635118

URL: http://svn.apache.org/r1635118
Log:
Don't reject command-line arguments of the form ".@abc", where "abc" is a
peg specifier that may be empty.

Since r878062, this form has been rejected with the error

  svn: E125001: '@abc' is just a peg revision. Maybe try '@abc@' instead?

apparently as an unintended side effect of rejecting the potentially
ambiguous form "@abc". The fix is to move the check up to a higher level
function.

* subversion/include/svn_client.h,
  subversion/libsvn_client/cmdline.c
  (svn_client_args_to_target_array2): Reject an argument of the form "@abc".
    At this point the argument has not yet been converted to internal style.
    Document that an argument of the form "@abc" is an error.

* subversion/include/private/svn_opt_private.h,
  subversion/libsvn_subr/opt.c
  (svn_opt__split_arg_at_peg_revision): Don't throw an error when the path
    portion of the target is empty.

Modified:
    subversion/trunk/subversion/include/private/svn_opt_private.h
    subversion/trunk/subversion/include/svn_client.h
    subversion/trunk/subversion/libsvn_client/cmdline.c
    subversion/trunk/subversion/libsvn_subr/opt.c

Modified: subversion/trunk/subversion/include/private/svn_opt_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_opt_private.h?rev=1635118&r1=1635117&r2=1635118&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_opt_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_opt_private.h Wed Oct 29 12:54:38 2014
@@ -46,10 +46,6 @@ extern "C" {
  * UTF8_TARGET need not be canonical. *TRUE_TARGET will not be canonical
  * unless UTF8_TARGET is.
  *
- * It is an error if *TRUE_TARGET results in the empty string after the
- * split, which happens in case UTF8_TARGET has a leading '@' character
- * with no additional '@' characters to escape the first '@'.
- *
  * Note that *PEG_REVISION will still contain the '@' symbol as the first
  * character if a peg revision was found. If a trailing '@' symbol was
  * used to escape other '@' characters in UTF8_TARGET, *PEG_REVISION will

Modified: subversion/trunk/subversion/include/svn_client.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_client.h?rev=1635118&r1=1635117&r2=1635118&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_client.h (original)
+++ subversion/trunk/subversion/include/svn_client.h Wed Oct 29 12:54:38 2014
@@ -1125,6 +1125,12 @@ svn_client_create_context(svn_client_ctx
  * error, and if this is the only type of error encountered, complete
  * the operation before returning the error(s).
  *
+ * It is an error if a target is just a peg specifier with no path, such as
+ * "@abc". Before r878062 this form was interpreted as a literal path, and
+ * it is now ambiguous. The form "@abc@" should now be used to refer to the
+ * literal path "@abc" with no peg revision, or the form ".@abc" to refer to
+ * the empty path with peg revision "abc".
+ *
  * @since New in 1.7
  */
 svn_error_t *

Modified: subversion/trunk/subversion/libsvn_client/cmdline.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/cmdline.c?rev=1635118&r1=1635117&r2=1635118&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/cmdline.c (original)
+++ subversion/trunk/subversion/libsvn_client/cmdline.c Wed Oct 29 12:54:38 2014
@@ -200,6 +200,15 @@ svn_client_args_to_target_array2(apr_arr
           SVN_ERR(svn_opt__split_arg_at_peg_revision(&true_target, &peg_rev,
                                                      utf8_target, pool));
 
+          /* Reject the form "@abc", a peg specifier with no path. */
+          if (true_target[0] == '\0' && peg_rev[0] != '\0')
+            {
+              return svn_error_createf(SVN_ERR_BAD_FILENAME, NULL,
+                                       _("'%s' is just a peg revision. "
+                                         "Maybe try '%s@' instead?"),
+                                       utf8_target, utf8_target);
+            }
+
           /* URLs and wc-paths get treated differently. */
           if (svn_path_is_url(true_target))
             {

Modified: subversion/trunk/subversion/libsvn_subr/opt.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/opt.c?rev=1635118&r1=1635117&r2=1635118&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/opt.c (original)
+++ subversion/trunk/subversion/libsvn_subr/opt.c Wed Oct 29 12:54:38 2014
@@ -1012,13 +1012,6 @@ svn_opt__split_arg_at_peg_revision(const
 
   if (peg_start)
     {
-      /* Error out if target is the empty string. */
-      if (ptr == utf8_target)
-        return svn_error_createf(SVN_ERR_BAD_FILENAME, NULL,
-                                 _("'%s' is just a peg revision. "
-                                   "Maybe try '%s@' instead?"),
-                                 utf8_target, utf8_target);
-
       *true_target = apr_pstrmemdup(pool, utf8_target, ptr - utf8_target);
       if (peg_revision)
         *peg_revision = apr_pstrdup(pool, peg_start);