Timofey Zhakov (tima {at} chemodax _dot_ net)


Patch
r1918362, r1918181, r1918139, r1918138, r1918076, r1917946, r1917944, r1917864

r1917864 | hartmannathan | 2024-05-21 18:59:53 +0000 (Tue, 21 May 2024)

Fix cmdline parsing bug: check the change argument for a double minus.

If the changeno is negative and is_negative is TRUE, raise
SVN_ERR_CL_ARG_PARSING_ERROR, because string with a double minus is
not a valid number. Do the same if the changeno_end is negative.

* subversion/svn/svn.c
  (sub_main): If the changeno is negative and is_negative is TRUE, raise
  SVN_ERR_CL_ARG_PARSING_ERROR. Do the same if the changeno_end is
  negative.

* subversion/tests/cmdline/diff_tests.py
  (diff_invalid_change_arg): New test.
  (test_list): Run new test.

See the dev@ mail list thread started 19 May 2024:
"[PATCH] Check the change argument for a double minus at the start."
archived here and elsewhere:
https://lists.apache.org/thread/tbld0locs0t3pq1hxzh2q1hqvx85l6gp

Patch by: Timofey Zhakov (tima {at} chemodax _dot_ net)

Review by: hartmannathan
           jun66j5


r1917944 | hartmannathan | 2024-05-24 15:59:50 +0000 (Fri, 24 May 2024)

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

This is a follow-up to r1917864.

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.

See the dev@ mail list thread started 22 May 2024:
"[PATCH] Add check of the changeno_end variable for zero (was: [PATCH] Check
the change argument for a double minus at the start.)"
archived here and elsewhere:
https://lists.apache.org/thread/j7wb03d1yhm4f8cshr2zc14j1pzgkmbk

Found by: jun66j5

Patch by: Timofey Zhakov (tima {at} chemodax _dot_ net)


r1917946 | hartmannathan | 2024-05-24 17:08:09 +0000 (Fri, 24 May 2024)

Convert path to local style when rising BAD_RELATIVE_PATH error from diff.

* subversion\libsvn_client\diff.c
  (adjust_paths_for_diff_labels): Invoke svn_dirent_local_style() function
   when making BAD_RELATIVE_PATH error to create the error with correct paths.

See mail to dev@ on 23 May 2024: "[PATCH] Convert path to local style when
rising BAD_RELATIVE_PATH error from diff." archived here and elsewhere:
https://lists.apache.org/thread/7lpy07k2b4dfmjfdo915jpt88bd12y2z

Patch by: Timofey Zhakov (tima {at} chemodax _dot_ net)


r1918076 | hartmannathan | 2024-05-31 13:40:56 +0000 (Fri, 31 May 2024)

Factor-out parse of the --change argument from command line to libsvn_subr.

These changes factor-out the function, which parses a change revision, from
the command line interface to the libsvn_subr library and add the unit tests
on the function.

* subversion/include/svn_opt.h
  (svn_opt_parse_revision_to_range): Declare new function.

* subversion/libsvn_subr/opt.c
  (svn_opt_parse_revision_to_range): Factor-out the function from the
   svn.c:sub_main() function.

* subversion/svn/svn.c
  (sub_main): Use the factored-out function instead of doing the work inline.
  (includes): Remove private/svn_opt_private.h, because it is no longer needed.

* subversion/tests/cmdline/diff_tests.py
  (diff_invalid_change_arg): Update the test expectations to account for the
   updated error messages.

* subversion/tests/libsvn_subr/opt-test.c
  (includes): Include private/svn_opt_private.h to use the
   svn_opt__revision_to_string() function.
  (revision_ranges_to_string): New function.
  (test_svn_opt_parse_change_to_range): New test.
  (test_funcs): Run new test.

See the dev@ mail thread "Move change revision parser to libsvn_subr" started
21 May 2024, archived:
https://lists.apache.org/thread/2ghkw77b858348y2zv8tsytljw3skfhv

See also: r1917944 and r1917864 (fixes in the --change arg parser).

Patch by: Timofey Zhakov (tima {at} chemodax _dot_ net)

Review by: hartmannathan


r1918138 | hartmannathan | 2024-06-04 01:41:36 +0000 (Tue, 04 Jun 2024)

Fix unbounded memory usage in `svn propget` command.

* subversion/svn/propget-cmd.c
  (print_properties): Invoke svn_pool_clear() inside the loop to clean the
   iterpool properly and refactor this part of the code to make it more
   readable.

See dev@ message on 30 May 2024:
"[PATCH] Fix unbounded memory usage in `svn propget` command."
archived:
https://lists.apache.org/thread/l4l13jhv74pkzptrgx0fwmycxs9oob8v

Patch by: Timofey Zhakov (tima {at} chemodax _dot_ net)

Review by: hartmannathan


r1918139 | hartmannathan | 2024-06-04 01:50:29 +0000 (Tue, 04 Jun 2024)

Fix unbounded memory usage in the `svn proplist --xml` command.

* subversion/svn/proplist-cmd.c:
  (proplist_receiver_xml): Invoke the svn_pool_clear function on every
   iteration to clear the iterpool.

See dev@ message on 28 May 2024:
"[PATCH] Fix unbounded memory usage in `svn proplist --xml` command."
archived:
https://lists.apache.org/thread/rqzyhvkof585gh3lnnmz4k6k48cc8f6r

Patch by: Timofey Zhakov (tima {at} chemodax _dot_ net)

Review by: hartmannathan


r1918181 | hartmannathan | 2024-06-05 20:32:03 +0000 (Wed, 05 Jun 2024)

Use svn_opt_parse_change_to_range function to parse the --change
argument in the svnbench program.

In r1918076, the svn_opt_parse_change_to_range function was
factored-out from the svn program into the libsvn_subr library.
Since the same functionality is needed for parsing the same argument
in the svnbench program, we can use this function there as well.

Additionally, this refactoring would fix some parsing bugs related to this
argument, which were resolved in the svn program [1], but still exist in the
svnbench program, because this code was duplicated.

* subversion/svnbench/svnbench.c
  (sub_main): Replace the code that parses the --change argument with
   svn_opt_parse_change_to_range function.

[1] The fixes in the --change argument parser were committed in
    r1917944 and r1917864.

Patch by: Timofey Zhakov (tima {at} chemodax _dot_ net)


r1918362 | dsahlberg | 2024-06-16 08:08:57 +0000 (Sun, 16 Jun 2024)

Specify guidelines and max_line_length properties from the EditorConfig.

Set the `guidelines` and `max_line_length` properties to 79 symbols from the
EditorConfig file. These properties are not commonly supported by editors [1],
[2]. The value `79 symbols` is described in the community guidelines, so these
properties in the EditorConfig file would help us to follow the rule.

[1] The `max_line_length` property is supported by Emacs, Vim, Neovim, Atom,
JetBrains IDEs, Kakoune, and Prettier.

[2] The `guidelines` property is supported by Visual Studio with
EditorConfig Guidelines or Editor Guidelines extensions.

* .editorconfig:
(guidelines, max_line_length): Set these properties to 79 symbols.
 
Patch by: Timofey Zhakov (tima {at} chemodax _dot_ net)

Discussed on dev@: https://lists.apache.org/thread/cp6kb1w03mb7v4g8yq7y9dsmpdyqy42n