You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2014/09/27 15:01:09 UTC

svn commit: r1627962 - in /subversion/trunk: notes/knobs subversion/include/private/svn_dep_compat.h

Author: stefan2
Date: Sat Sep 27 13:01:09 2014
New Revision: 1627962

URL: http://svn.apache.org/r1627962
Log:
Address a very theoretical fringe case.  We implicitly assume that chars
are of uniform size on all systems, specificly that they are 8 bits wide.
So, make that assumption explicit.

One problem is that our data files and network streams specify lenght
values in multiples of chars while actually transmitting a specific number
of bits.  On systems with e.g. 32 bit chars, we can not expect or rely on
OS / libs to convert between 8 and 32 bits.

* subversion/include/private/svn_dep_compat.h
  (): Error out if chars are defined as something other than 8 bits.
      Allow for skipping that check by defining SVN_ALLOW_NON_8_BIT_CHARS.

* notes/knobs
  (SVN_ALLOW_NON_8_BIT_CHARS): Document this new compile time option.

Modified:
    subversion/trunk/notes/knobs
    subversion/trunk/subversion/include/private/svn_dep_compat.h

Modified: subversion/trunk/notes/knobs
URL: http://svn.apache.org/viewvc/subversion/trunk/notes/knobs?rev=1627962&r1=1627961&r2=1627962&view=diff
==============================================================================
--- subversion/trunk/notes/knobs (original)
+++ subversion/trunk/notes/knobs Sat Sep 27 13:01:09 2014
@@ -55,6 +55,7 @@ SVN_SQLITE_MIN_VERSION_NUMBER
 SVN_SQLITE_MIN_VERSION
 SVN_SERF_NO_LOGGING
 SVN_ALLOW_SHORT_INTS
+SVN_ALLOW_NON_8_BIT_CHARS
 
 2.3 Debugging Support
 
@@ -290,6 +291,18 @@ SVN_I_LIKE_LATENCY_SO_IGNORE_HTTPV2
   Default:   not defined
   Suggested: not defined (to ensure correct behaviour)
 
+4.12 SVN_ALLOW_NON_8_BIT_CHARS
+
+  Scope:     global
+  Purpose:   Disables the size check for the 'char' type.  We assume char
+             has exactly 8 bits.  Other values may break the code reading,
+             interpreting and writing repository files.  Defining this option
+             will allow SVN to be compiled even if the size check would fail
+             for some reason.
+  Range:     definedness
+  Default:   not defined
+  Suggested: not defined (to ensure correct behaviour)
+
 
 5 Defines controlling debug support
 ==================================

Modified: subversion/trunk/subversion/include/private/svn_dep_compat.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_dep_compat.h?rev=1627962&r1=1627961&r2=1627962&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_dep_compat.h (original)
+++ subversion/trunk/subversion/include/private/svn_dep_compat.h Sat Sep 27 13:01:09 2014
@@ -47,6 +47,19 @@ extern "C" {
 #endif
 
 /**
+ * We assume that 'char' is 8 bits wide.  The critical interfaces are
+ * our repository formats and RA encodings.  E.g. a 32 bit wide char may
+ * mess up UTF8 parsing, how we interpret size values etc.
+ *
+ * @since New in 1.9.
+ */
+#if    defined(CHAR_BIT) \
+    && !defined(SVN_ALLOW_NON_8_BIT_CHARS) \
+    && (CHAR_BIT != 8)
+#error char is not 8 bits and may break Subversion. Define SVN_ALLOW_NON_8_BIT_CHARS to skip this check.
+#endif
+
+/**
  * Work around a platform dependency issue. apr_thread_rwlock_trywrlock()
  * will make APR_STATUS_IS_EBUSY() return TRUE if the lock could not be
  * acquired under Unix. Under Windows, this will not work. So, provide