You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by da...@apache.org on 2013/01/04 02:44:11 UTC

svn commit: r1428700 - /subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c

Author: danielsh
Date: Fri Jan  4 01:44:11 2013
New Revision: 1428700

URL: http://svn.apache.org/viewvc?rev=1428700&view=rev
Log:
Fix issue #4277: FSFS commit should sanity check representation offsets
retrieved from rep-cache.

* subversion/libsvn_fs_fs/fs_fs.c
  (verify_walker): Add forward declaration.  Assert that BATON remains NULL.
  (get_shared_rep): Verify representations retrieved from rep-cache.

For reference, currently the error is:

    % $svnadmin verify r
    subversion/libsvn_repos/dump.c:1401: (apr_err=160004)
    subversion/libsvn_fs/fs-loader.c:500: (apr_err=160004)
    subversion/libsvn_fs_fs/fs_fs.c:10347: (apr_err=160004)
    subversion/libsvn_fs_fs/fs_fs.c:10309: (apr_err=160004)
    subversion/libsvn_fs_fs/fs_fs.c:4486: (apr_err=160004)
    svnadmin: E160004: Corrupt representation '1 1 16 4 (null) f1d2d2f924e986ac86fdf7b36c94bcdf32beec15 (null)'
    subversion/libsvn_fs_fs/fs_fs.c:4427: (apr_err=160004)
    subversion/libsvn_fs_fs/fs_fs.c:2775: (apr_err=160004)
    svnadmin: E160004: Malformed representation header at r/db/revs/0/1:6
    zsh: exit 1     $svnadmin verify r

Modified:
    subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c

Modified: subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c?rev=1428700&r1=1428699&r2=1428700&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c Fri Jan  4 01:44:11 2013
@@ -178,6 +178,12 @@ update_min_unpacked_rev(svn_fs_t *fs, ap
 static svn_error_t *
 get_youngest(svn_revnum_t *youngest_p, const char *fs_path, apr_pool_t *pool);
 
+static svn_error_t *
+verify_walker(representation_t *rep,
+              void *baton,
+              svn_fs_t *fs,
+              apr_pool_t *scratch_pool);
+
 /* Pathname helper functions */
 
 /* Return TRUE is REV is packed in FS, FALSE otherwise. */
@@ -7378,10 +7384,14 @@ get_shared_rep(representation_t **old_re
       err = svn_fs_fs__get_rep_reference(old_rep, fs, rep->sha1_checksum,
                                          pool);
       /* ### Other error codes that we shouldn't mask out? */
-      if (err == SVN_NO_ERROR
-          || err->apr_err == SVN_ERR_FS_CORRUPT
-          || SVN_ERROR_IN_CATEGORY(err->apr_err,
-                                   SVN_ERR_MALFUNC_CATEGORY_START))
+      if (err == SVN_NO_ERROR)
+        {
+          if (*old_rep)
+            SVN_ERR(verify_walker(*old_rep, NULL, fs, pool));
+        }
+      else if (err->apr_err == SVN_ERR_FS_CORRUPT
+               || SVN_ERROR_IN_CATEGORY(err->apr_err,
+                                        SVN_ERR_MALFUNC_CATEGORY_START))
         {
           /* Fatal error; don't mask it.
 
@@ -10290,6 +10300,11 @@ verify_walker(representation_t *rep,
   struct rep_state *rs;
   struct rep_args *rep_args;
 
+#ifdef SVN_DEBUG
+  /* verify_walker() is called directly by get_shared_rep() with baton=NULL. */
+  SVN_ERR_ASSERT(!baton);
+#endif
+
   /* ### Should this be using read_rep_line() directly? */
   SVN_ERR(create_rep_state(&rs, &rep_args, NULL, NULL, rep, fs, scratch_pool));