> >>> I found a little bug in parsing a change revision: If the number,
> >>> given to the --change argument, starts with a double minus or with
> >>> `-r-`, the command aborts. This patch fixes this bug.
> >>>
[...]
> > Thanks!
>
> Found another similar issue in -c option.
>
> The following works correctly:
>
> $ ~/svn/1.14.3/bin/svn diff -c '0-1' file:///tmp/svnrepos
> svn: E205000: There is no change 0
>
> However, the following aborts:
>
> $ ~/svn/1.14.3/bin/svn diff -c '1-0' file:///tmp/svnrepos
> svn: E235000: In file 'subversion/libsvn_client/ra.c' line 692: assertion 
> failed (SVN_IS_VALID_REVNUM(start_revnum))
> Aborted
>

Hello!

I made a patch which fixes this bug.

[[[
Fix bug: Add check of the changeno_end variable for zero.

The parser of the --change argument already checks the revision
number for a zero and raises an error, because there are no changes.
However, if a range is given to this argument it would not check
its second part, and the command aborts.

Command to reproduce:
$ svn diff https://svn.apache.org/repos/asf -c 1-0

Adding the check of the changeno_end variable for zero will fix
the problem.

* subversion\svn\svn.c
  (sub_main): Add check of the changeno_end variable for zero.
* subversion\tests\cmdline\diff_tests.py
  (diff_invalid_change_arg): Add test case for a diff of change,
  done in revision range '1-0' and expect an error from it.

Found by: jun66j5
]]]

Best regards.

--
Timofei Zhakov
Index: subversion/svn/svn.c
===================================================================
--- subversion/svn/svn.c        (revision 1917867)
+++ subversion/svn/svn.c        (working copy)
@@ -2394,7 +2394,7 @@ sub_main(int *exit_code, int argc, const char *arg
                                              "given to -c"), change_str);
                 }
 
-              if (changeno == 0)
+              if (changeno == 0 || changeno_end == 0)
                 {
                   return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
                                           _("There is no change 0"));
Index: subversion/tests/cmdline/diff_tests.py
===================================================================
--- subversion/tests/cmdline/diff_tests.py      (revision 1917867)
+++ subversion/tests/cmdline/diff_tests.py      (working copy)
@@ -5360,6 +5360,11 @@ def diff_invalid_change_arg(sbox):
     (r'.*svn: E205000: Negative number in range \(r1-r-3\) not supported with 
-c'),
     'diff', sbox.wc_dir, '-c', 'r1-r-3')
 
+  svntest.actions.run_and_verify_svn(
+    None,
+    (r'.*svn: E205000: There is no change 0'),
+    'diff', sbox.wc_dir, '-c', '1-0')
+
 ########################################################################
 #Run the tests
 

Reply via email to