Author: svn-role
Date: Fri Mar 30 04:00:07 2018
New Revision: 1828043
URL: http://svn.apache.org/viewvc?rev=1828043&view=rev
Log:
Merge the r1826720 group from trunk:
* r1826720, r1826721, r1827191, r1827574
Regression test and FSFS checksum test, part of issue 4722.
Justification:
Keeps 1.10 in sync with 1.11 and 1.9.
Votes:
+1: philip, stefan2, brane
Modified:
subversion/branches/1.10.x/ (props changed)
subversion/branches/1.10.x/STATUS
subversion/branches/1.10.x/subversion/libsvn_fs_fs/cached_data.c
subversion/branches/1.10.x/subversion/tests/cmdline/commit_tests.py
Propchange: subversion/branches/1.10.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Mar 30 04:00:07 2018
@@ -101,4 +101,4 @@
/subversion/branches/verify-at-commit:1462039-1462408
/subversion/branches/verify-keep-going:1439280-1546110
/subversion/branches/wc-collate-path:1402685-1480384
-/subversion/trunk:1817837,1817856,1818577-1818578,1818584,1818651,1818662,1818727,1818801,1818803,1818807,1818868,1818871,1819036-1819037,1819043,1819049,1819052,1819093,1819146,1819162,1819444,1819556-1819557,1819603,1819804,1819911,1820044,1820046-1820047,1820518,1820627,1820718,1820778,1821183,1821224,1821621,1821678,1822401,1822587,1822591,1822996,1823202-1823203,1823211,1823327,1823791,1823966,1823989,1824033,1825024,1825045,1825215,1825266,1825306,1825709,1825711,1825721,1825736,1825778,1825783,1825787-1825788,1825979,1826747,1826811,1826814,1826877,1826907,1826971,1827105,1827114,1827562,1827670
+/subversion/trunk:1817837,1817856,1818577-1818578,1818584,1818651,1818662,1818727,1818801,1818803,1818807,1818868,1818871,1819036-1819037,1819043,1819049,1819052,1819093,1819146,1819162,1819444,1819556-1819557,1819603,1819804,1819911,1820044,1820046-1820047,1820518,1820627,1820718,1820778,1821183,1821224,1821621,1821678,1822401,1822587,1822591,1822996,1823202-1823203,1823211,1823327,1823791,1823966,1823989,1824033,1825024,1825045,1825215,1825266,1825306,1825709,1825711,1825721,1825736,1825778,1825783,1825787-1825788,1825979,1826720-1826721,1826747,1826811,1826814,1826877,1826907,1826971,1827105,1827114,1827191,1827562,1827574,1827670
Modified: subversion/branches/1.10.x/STATUS
URL:
http://svn.apache.org/viewvc/subversion/branches/1.10.x/STATUS?rev=1828043&r1=1828042&r2=1828043&view=diff
==============================================================================
--- subversion/branches/1.10.x/STATUS (original)
+++ subversion/branches/1.10.x/STATUS Fri Mar 30 04:00:07 2018
@@ -20,10 +20,3 @@ Veto-blocked changes:
Approved changes:
=================
-
- * r1826720, r1826721, r1827191, r1827574
- Regression test and FSFS checksum test, part of issue 4722.
- Justification:
- Keeps 1.10 in sync with 1.11 and 1.9.
- Votes:
- +1: philip, stefan2, brane
Modified: subversion/branches/1.10.x/subversion/libsvn_fs_fs/cached_data.c
URL:
http://svn.apache.org/viewvc/subversion/branches/1.10.x/subversion/libsvn_fs_fs/cached_data.c?rev=1828043&r1=1828042&r2=1828043&view=diff
==============================================================================
--- subversion/branches/1.10.x/subversion/libsvn_fs_fs/cached_data.c (original)
+++ subversion/branches/1.10.x/subversion/libsvn_fs_fs/cached_data.c Fri Mar 30
04:00:07 2018
@@ -2103,13 +2103,14 @@ skip_contents(struct rep_read_baton *bat
/* BATON is of type `rep_read_baton'; read the next *LEN bytes of the
representation and store them in *BUF. Sum as we read and verify
- the MD5 sum at the end. */
+ the MD5 sum at the end. This is a READ_FULL_FN for svn_stream_t. */
static svn_error_t *
rep_read_contents(void *baton,
char *buf,
apr_size_t *len)
{
struct rep_read_baton *rb = baton;
+ apr_size_t len_requested = *len;
/* Get data from the fulltext cache for as long as we can. */
if (rb->fulltext_cache)
@@ -2150,6 +2151,28 @@ rep_read_contents(void *baton,
if (rb->current_fulltext)
svn_stringbuf_appendbytes(rb->current_fulltext, buf, *len);
+ /* This is a FULL_READ_FN so a short read implies EOF and we can
+ verify the length. */
+ rb->off += *len;
+ if (*len < len_requested && rb->off != rb->len)
+ {
+ /* A warning rather than an error to allow the data to be
+ retrieved when the length is wrong but the data is
+ present, i.e. if repository corruption has stored the wrong
+ expanded length. */
+ svn_error_t *err = svn_error_createf(SVN_ERR_FS_CORRUPT, NULL,
+ _("Length mismatch while reading representation:"
+ " expected %s,"
+ " got %s"),
+ apr_psprintf(rb->pool, "%" SVN_FILESIZE_T_FMT,
+ rb->len),
+ apr_psprintf(rb->pool, "%" SVN_FILESIZE_T_FMT,
+ rb->off));
+
+ rb->fs->warning(rb->fs->warning_baton, err);
+ svn_error_clear(err);
+ }
+
/* Perform checksumming. We want to check the checksum as soon as
the last byte of data is read, in case the caller never performs
a short read, but we don't want to finalize the MD5 context
@@ -2157,7 +2180,6 @@ rep_read_contents(void *baton,
if (!rb->checksum_finalized)
{
SVN_ERR(svn_checksum_update(rb->md5_checksum_ctx, buf, *len));
- rb->off += *len;
if (rb->off == rb->len)
{
svn_checksum_t *md5_checksum;
Modified: subversion/branches/1.10.x/subversion/tests/cmdline/commit_tests.py
URL:
http://svn.apache.org/viewvc/subversion/branches/1.10.x/subversion/tests/cmdline/commit_tests.py?rev=1828043&r1=1828042&r2=1828043&view=diff
==============================================================================
--- subversion/branches/1.10.x/subversion/tests/cmdline/commit_tests.py
(original)
+++ subversion/branches/1.10.x/subversion/tests/cmdline/commit_tests.py Fri Mar
30 04:00:07 2018
@@ -3113,6 +3113,39 @@ def commit_xml(sbox):
sbox.simple_append('index.html', '<Q></R>', True)
sbox.simple_commit()
+@Issue(4722)
+def commit_issue4722_checksum(sbox):
+ "commit that triggered checksum failure"
+
+ sbox.build()
+
+ # This bug only ever affected FSFS in 1.9.7. The test could be
+ # considered a bit "fragile" as any change to the on-disk
+ # representation may well make it pass trivially. On the other hand
+ # it should still pass irrespective of that representation, and for
+ # all other repository types.
+
+ # Enough data to allow the bug to occur
+ with open(sbox.ospath('f'), 'w') as fp:
+ for i in range(0, 2001):
+ fp.write('abcdefghijklmnopqrstuvwxyz')
+ sbox.simple_add('f')
+ sbox.simple_commit()
+
+ # Just the right data to trigger the bug
+ with open(sbox.ospath('f'), 'w') as fp:
+ for i in range(0, 8713):
+ fp.write(str(i))
+ fp.write("11111")
+ sbox.simple_commit()
+
+ # Trigger deduplication which is when the bug occurred
+ with open(sbox.ospath('f'), 'w') as fp:
+ for i in range(0, 2001):
+ fp.write('abcdefghijklmnopqrstuvwxyz')
+ sbox.simple_commit()
+
+
########################################################################
# Run the tests
@@ -3190,6 +3223,7 @@ test_list = [ None,
commit_mergeinfo_ood,
mkdir_conflict_proper_error,
commit_xml,
+ commit_issue4722_checksum,
]
if __name__ == '__main__':