[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

wc-replacements: text base checksums

From: Ivan Zhakov <chemodax_at_gmail.com>
Date: 2005-09-26 16:52:50 CEST

Hi!
I studying working copy checksums for text base and revert base
behavior. I wonder that checksums is optional for text base. For
example if we somewhere forget write checksum for text base, working
copy would silently apply and commit txt-delta without checking
checksum:
subversion/libsvn_wc/update_editor.c:apply_textdelta()
> /* Only compare checksums this file has an entry, and the entry has
> a checksum. If there's no entry, it just means the file is
> created in this update, so there won't be any previously recorded
> checksum to compare against. If no checksum, well, for backwards
> compatibility we assume that no checksum always matches. */
> if (ent && ent->checksum)
> {

subversion/libsvn_wc/adm_crawler.c:svn_wc_transmit_text_deltas()
> /* For backwards compatibility, no checksum means assume a match. */
> if (ent->checksum)
> {
> const char *tb = svn_wc__text_base_path (path, FALSE, pool);
> unsigned char tb_digest[APR_MD5_DIGESTSIZE];

I think it is dangerous and propose fix version number in which text
base checksums required.
Next question what we should do if no checksum found: display error or
assertion?
See my proposed idea (I haven't add checking for WC format yet):
[[
Make text base checksums mandatory.
* subversion/libsvn_wc/adm_crawler.c
  (svn_wc_transmit_text_deltas): Require checksum if not full text.
* subversion/libsvn_wc/update_editor.c
  (apply_textdelta): Require checksum if text base exists.
]]
Index: subversion/libsvn_wc/adm_crawler.c
===================================================================
--- subversion/libsvn_wc/adm_crawler.c (revision 16267)
+++ subversion/libsvn_wc/adm_crawler.c (working copy)
@@ -827,7 +827,16 @@
                 }
             }
         }
+ else
+ {
+ const char *tb = svn_wc__text_base_path (path, FALSE, pool);

+ return svn_error_createf
+ (SVN_ERR_WC_CORRUPT_TEXT_BASE, NULL,
+ _("Missing checksum for '%s'"),
+ svn_path_local_style (tb, pool));
+ }
+
       SVN_ERR (svn_wc__open_text_base (&basefile, path, APR_READ, pool));
     }

Index: subversion/libsvn_wc/update_editor.c
===================================================================
--- subversion/libsvn_wc/update_editor.c (revision 16267)
+++ subversion/libsvn_wc/update_editor.c (working copy)
@@ -1666,6 +1666,18 @@
       hb->source = NULL; /* make sure */
     }

+ if (hb->source != NULL && ent && ent->checksum == NULL)
+ {
+ const char *tb;
+
+ tb = svn_wc__text_base_path (fb->path, FALSE, pool);
+
+ return svn_error_createf
+ (SVN_ERR_WC_CORRUPT_TEXT_BASE, NULL,
+ _("Missing checksum for '%s'"),
+ svn_path_local_style (tb, pool));
+ }
+
   /* Open the text base for writing (this will get us a temporary file). */
   hb->dest = NULL;
   err = svn_wc__open_text_base (&hb->dest, fb->path,

--
Ivan Zhakov
Received on Mon Sep 26 16:54:10 2005

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.