Checkout Tools
  • last updated 7 hours ago
Constraints
Constraints: committers
 
Constraints: files
Constraints: dates
* everywhere: Run tools/dev/remove-trailing-whitespace.sh to remove

trailing whitespace before we branch 1.14.

  1. … 105 more files in changeset.
* libsvn_subr/mergeinfo-test.c

(test_rangelist_merge_random_non_validated_inputs): Indentation fix.

Plug error leaks in newly added mergeinfo tests.

Found by: svn-bb-openbsd buildbot

https://ci.apache.org/builders/svn-bb-openbsd/builds/510/steps/Test/logs/faillog-ra_svn-fsfs

[[[

subversion/tests/svn_test_main.c:475: (apr_err=SVN_ERR_TEST_FAILED)

svn_tests: E200006: Test crashed (run in debugger with '--allow-segfaults')

FAIL: mergeinfo-test 25: test rangelist merge random non-validated inputs

]]]

Core was generated by `mergeinfo-test'.

Program terminated with signal SIGABRT, Aborted.

#0 *_libc_abort () at /usr/src/lib/libc/stdlib/abort.c:57

57 memset(&sa, 0, sizeof(sa));

(gdb) up

#1 0x0000010070bcff68 in err_abort (data=0x10022671880)

156 abort();

(gdb) list

151 {

152 svn_error_t *err = data; /* For easy viewing in a debugger */

153 SVN_UNUSED(err);

154

155 if (!getenv("SVN_DBG_NO_ABORT_ON_ERROR_LEAK"))

156 abort();

157 return APR_SUCCESS;

158 }

159 #endif

160

(gdb) p *err

$3 = {apr_err = 235000,

message = 0x1001bc9c280 "In file 'subversion/libsvn_subr/mergeinfo.c' line 1096: assertion failed (rangelist_is_sorted(chg))", child = 0x0,

pool = 0x10085adbc00,

file = 0x10070d799b0 "subversion/libsvn_subr/mergeinfo.c", line = 1096}

(gdb)

* subversion/tests/libsvn_subr/mergeinfo-test.c

(clear_failure_mode_errors): New helper function. Clears errors accumulated

during a test run.

(test_rangelist_merge_random_canonical_inputs,

test_rangelist_merge_random_semi_c_inputs,

test_rangelist_merge_random_non_validated_inputs): Clear accumulated errors.

Fix issue #4840 "Merge assertion failure in svn_sort__array_insert".

This replaces the implementation of svn_rangelist_merge2() with a correct

and simpler one.

* subversion/libsvn_subr/mergeinfo.c

(adjust_remaining_ranges,

rangelist_merge2): Delete.

(rangelist_interval_kind_t,

rangelist_interval_t,

rangelist_interval_iterator_t,

rlii_update,

rlii_next_any_interval,

rlii_first,

rlii_next,

rangelist_builder_t,

rl_builder_new,

rl_builder_flush,

rl_builder_add_interval,

rangelist_merge): New.

(svn_rangelist_merge2): Adjust to call the new implementation.

* subversion/tests/libsvn_subr/mergeinfo-test.c

(test_rangelist_merge_canonical_result,

test_rangelist_merge_array_insert_failure,

test_rangelist_merge_random_canonical_inputs,

test_rangelist_merge_random_semi_c_inputs): Remove XFAIL.

  1. … 1 more file in changeset.
Fix test expectations of an XFAIL test.

For issue #4840 "Merge assertion failure in svn_sort__array_insert".

Fix weak test coverage.

In the tests for "semi-canonical" and "canonical" kinds of inputs to

svn_rangelist_merge2(), the input generator previously called "generate a

random non-validated input" repeatedly until it passed certain quality

tests. That made the result heavily biased towards very simple cases.

As a result, the coverage of the "semi-canonical" and "canonical" tests

missed the failure mode of the original bug report #4840.

This generates "semi-canonical" and "canonical" inputs with a fairer

distribution, increasing their coverage to include that failure mode.

For issue 4840 "Merge assertion failure in svn_sort__array_insert"

* subversion/tests/libsvn_subr/mergeinfo-test.c

(rand_interval_triangular): New.

(rangelist_random_non_validated): Use it.

(int_compare,

ascending_values): New.

(rangelist_random_semi_canonical,

rangelist_random_canonical): Rewrite.

(add_failure_mode): Deduplicate 'Attempted insert at index ...' messages.

Use the variable I declared in r1872921.
Add comments about parameters of random input generation.

For issue #4840 "Merge assertion failure in svn_sort__array_insert".

Report each failure mode only once in random-input tests.

Instead of printing each case that fails, print only the first example of

each failure mode. This makes it easier to manually check that test has

enough coverage. (Programmatic checks for particular coverage could be

added.)

For issue 4840 "Merge assertion failure in svn_sort__array_insert"

* subversion/tests/libsvn_subr/mergeinfo-test.c

(new_response): New.

(test_rangelist_merge_random_canonical_inputs,

test_rangelist_merge_random_semi_c_inputs,

test_rangelist_merge_random_non_validated_inputs): Use it.

New test for issue 4840 "Merge assertion failure in svn_sort__array_insert".

* subversion/tests/libsvn_subr/mergeinfo-test.c

(test_rangelist_merge_array_insert_failure): New test.

(test_funcs): Run it, XFAIL.

Make random-input mergeinfo tests repeatable.

The pseudo-random sequence used in each random-input mergeinfo test is now

repeatable and independent of other tests.

This ensures the test results are repeatable and avoids occasional

unexpected pass of expected-fail tests.

For issue #4840, "Merge assertion failure in svn_sort__array_insert".

* subversion/tests/libsvn_subr/mergeinfo-test.c

(rand_less_than): Use a passed-in state ('seed').

(rangelist_random_non_validated,

rangelist_random_semi_canonical,

rangelist_random_canonical,

mergeinfo_random_non_validated): Pass through the state.

(test_rangelist_merge_random_canonical_inputs,

test_rangelist_merge_random_canonical_inputs,

test_rangelist_merge_random_semi_c_inputs,

test_mergeinfo_merge_random_non_validated_inputs):

Keep random state separately in each test.

Fix a test crash in non-debug builds.

A follow-up to r1872121.

Found by: nathanhartman

subversion/tests/libsvn_subr/mergeinfo-test.c

(rangelist_to_string): Properly skip error trace links.

Random-input testing for svn_mergeinfo_merge2().

For issue #4840, "Merge assertion failure in svn_sort__array_insert".

* subversion/tests/libsvn_subr/mergeinfo-test.c

(mergeinfo_random_non_validated,

mergeinfo_to_string_debug,

mergeinfo_merge_random_inputs): New.

(test_mergeinfo_merge_random_non_validated_inputs): New test.

(test_funcs): Run it.

Avoid aborting on assertion failure in the area of mergeinfo calculations.

Instead, raise a catchable assertion error.

If an error occurs in svn_rangelist_merge2(), produce a more detailed error

message to aid in debugging.

Introduce and use 'svn_sort__array_insert2()' which checks its inputs. The

old version of this function was aborting on out-of-range inputs. Introduce

and use 'svn_sort__array_delete2()' likewise, as similar issues may show up

here too. The old version of this function was ignoring calls with

out-of-range inputs. The old versions of both functions are still in use

elsewhere in the Subversion libraries.

For issue #4840, "Merge assertion failure in svn_sort__array_insert".

* subversion/include/private/svn_sorts_private.h,

subversion/libsvn_subr/sorts.c

(svn_sort__array_insert2,

svn_sort__array_delete2): New.

* subversion/libsvn_client/merge.c

(slice_remaining_ranges,

insert_child_to_merge): Allow returning an error.

Everywhere: use svn_sort__array_insert2() and svn_sort__array_delete2().

* subversion/libsvn_subr/mergeinfo.c

(adjust_remaining_ranges): Allow returning an error.

(dual_dump): Replace this old debug helper...

(rangelist_to_string_debug): ... with this new one.

(svn_rangelist_merge2): Extract the body of this function into a local

'rangelist_merge2', leaving the original as an error-checking

wrapper. If an error occurs, report its inputs.

(rangelist_is_sorted): New.

Everywhere: use svn_sort__array_insert2() and svn_sort__array_delete2().

* subversion/tests/libsvn_subr/mergeinfo-test.c

(test_rangelist_merge_random_non_validated_inputs): Expect assertion

failures; ignore them.

(test_funcs): Expect that test to pass now.

  1. … 4 more files in changeset.
Use a matching integer type instead of casts, as a cleaner follow-up to r1872108.

Suggested by: brane

Avoid integer conversion warning. A follow-up to r1872107.

* subversion/tests/libsvn_subr/mergeinfo-test.c

(rangelist_to_array): Add explicit casts.

Random-input testing for issue #4840, "Merge assertion failure in

svn_sort__array_insert".

This adds tests for svn_rangelist_merge2() with canonical inputs,

with "semi-canonical" inputs which meet criteria described in its

doc string, and with non-validated inputs.

* subversion/tests/libsvn_subr/mergeinfo-test.c

(...): Helper functions.

(test_rangelist_merge_random_canonical_inputs,

test_rangelist_merge_random_semi_c_inputs,

test_rangelist_merge_random_non_validated_inputs): New tests.

(test_funcs): Run them.

Add a test for a case of non-canonical output from svn_rangelist_merge2().

For issue #4840, "Merge assertion failure in svn_sort__array_insert".

* subversion/tests/libsvn_subr/mergeinfo-test.c

(test_rangelist_merge_canonical_result): New test.

(test_funcs): Run it.

Fix an issue with the readline implementation for file streams that could

cause excessive memory usage for inputs containing one or multiple \0 bytes.

This is the likely cause of the OOM reported in

https://lists.apache.org/thread.html/c96eb5618ac0bf6e083345e0fdcdcf834e30913f26eabe6ada7bab62@%3Cusers.subversion.apache.org%3E

(I think that the problem itself is a regression introduced by me in 1.10.)

Note: one thing I noticed while preparing the fix is that our `readline_fn`

functions for different streams have inconsistent behavior if the input data

contains \0 bytes. More specifically, they may return different `line` values,

that may either be truncated at \0 or actually contain the whole data between

EOLs, including \0 bytes. For now, this patch only fixes the excessive memory

usage problem, and I noted this related problem in the test and left it for

future work.

* subversion/libsvn_subr/stream.c

(readline_apr_lf, readline_apr_generic): Reallocate the buffer based on its

current size, instead of calculating the new size based on the already

prealloc'd size. There are no actual benefits in reallocating based on

`blocksize`, and in the described case with \0 bytes doing so also backfires

and may cause excessive allocations due to the actual size of the string

being less than we expect it to. A degenerate case of the erroneous

behavior is ...

* subversion/tests/libsvn_subr/stream-test.c

(test_stream_readline_file_nul): ...exploited in this new test.

(test_funcs): Run new test.

* subversion/tests/libsvn_subr

(): Adjust svn:ignore.

  1. … 1 more file in changeset.
Fix issue #4806: Remove on-disk trees with read-only directories in them.

* subversion/libsvn_subr/io.c

(io_set_perms): New; helper function for io_set_*_perms.

(io_set_file_perms): Use io_set_perms.

(io_set_dir_perms): New; like io_set_file_perms, but for directories.

(io_set_readonly_flag): New; helper function for setting the read-only flag.

(svn_io_set_file_read_only,

svn_io_set_file_read_write): Use io_set_readonly_flag.

(svn_io_remove_dir2): On Unix, make the parent directory writable before

trying to remove its children.

(svn_io_dir_remove_nonrecursive): On Windows, remove a directory's

read-only flag before trying to remove the directory.

* subversion/tests/libsvn_subr/io-test.c

(create_dir_tree): New helper function.

(test_rmtree_all_writable,

test_rmtree_file_readonly,

test_rmtree_dir_readonly,

test_rmtree_all_readonly): New test cases.

(test_funcs): Activate the new test cases.

  1. … 1 more file in changeset.
Follow up to r1849080: move a private function out of a public header.

* subversion/include/svn_dirent_uri.h: Update file-level docstrin.

(svn_relpath__internal_style): Removed.

* subversion/include/private/svn_dirent_uri_private.h: New file.

(svn_relpath__make_internal): Renamed from svn_relpath__internal_style.

* subversion/libsvn_subr/dirent_uri.c,

subversion/svndumpfilter/svndumpfilter.c,

subversion/tests/libsvn_subr/dirent_uri-test.c,

subversion/bindings/javahl/native/Path.cpp:

Include private/svn_dirent_uri_private.h and use svn_relpath__make_internal

instead of svn_relpath__internal_style.

* subversion/bindings/swig/python/svn/core.py

(__all__): Remove mention of svn_relpath__internal_style from the comment.

  1. … 6 more files in changeset.
Change a private function's signature to prevent potential assertions.

* subversion/include/svn_dirent_uri.h

(svn_relpath__internal_style): Change prototype so that the function can

return an error instead of aborting if anything goes wrong.

* subversion/libsvn_subr/dirent_uri.c

(svn_relpath__internal_style): Update the implementation.

* subversion/bindings/javahl/native/Path.cpp (Relpath::initfunc),

* subversion/svndumpfilter/svndumpfilter.c (sub_main),

* subversion/tests/libsvn_subr/dirent_uri-test.c (test_relpath_internal_style):

Updated all callers.

  1. … 4 more files in changeset.
Add a bunch of missing build artifact svn:ignore items.
  1. … 7 more files in changeset.
* subversion/tests/libsvn_subr/utf-test.c:

(test_utf_conversions): Calculate maxlen before allocating buffers.

* subversion/tests/libsvn_subr/utf-test.c:

(test_utf_conversions): Move maxlen loop after declarations

Ensure test data is correctly aligned before calling svn_utf__utf{16,32}_to_utf8

On systems with strict alignment requirements (such as alpha), using the char*

tc->source as apr_uint16_t*/apr_int32_t* can cause the tests to fail, as

reported at <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=823133#22>.

* subversion/tests/libsvn_subr/utf-test.c:

(test_utf_conversions): Create apr_uint16_t and apr_int32_t arrays to which

the source string is copied before calling the conversion function, thus

assuring proper alignment. Consolidate the handling of conversions where

length is calculated and where a certain number of codes are converted.

Found by: Michael Cree <mcree{_AT_}orcon.net.nz>

Fix issue #4686, "Unable to parse reversed revision range '19634-19631'".

* subversion/libsvn_subr/mergeinfo.c

(adjust_remaining_ranges): Insert the new range at the right place.

* subversion/tests/libsvn_subr/mergeinfo-test.c

(test_funcs): Remove 'XFail' marking from tests 19 and 20

(test_rangelist_merge_overlap and test_rangelist_loop).

  1. … 1 more file in changeset.
* subversion/tests/libsvn_subr/mergeinfo-test.c

(test_rangelist_merge_overlap): Make the test shorter and easier to read.

Fix x509 parser to accept RSASSA-PSS certs by no longer assuming that

algorithm parameters are NULL for all algorithms. This change doesn't

affect whether clients can verify RSASSA-PSS certs, that decision is

delegated to OpenSSL, but it does allow JavaHL clients to accept a

failure to verify such certs.

* subversion/libsvn_subr/x509parse.c

(x509_get_alg): Skip over RSASSA-PSS parameters.

* subversion/tests/libsvn_subr/x509-test.c

(cert_tests): Add an RSASSA-PSS cert.

  1. … 1 more file in changeset.
Fix a bug in the config parser that caused it to strip leading characters

from value continuation lines.

* subversion/libsvn_subr/config_file.c (parse_value_continuation_lines):

Return the last read char to the buffer before reading the whole line.

* subversion/tests/libsvn_subr/config-test.cfg (m): New multi-line option.

* subversion/tests/libsvn_subr/config-test.c (config_keys, config_values):

Add expected values for the new multi-line option in the test data.

Tested by: danielsh

  1. … 1 more file in changeset.