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

[PATCH] Fix log output when iconv is not available

From: Justin Erenkrantz <jerenkrantz_at_apache.org>
Date: 2002-07-28 02:49:50 CEST

On platforms without iconv (*BSDs), 'svn log' exits with a fatal
error when a unconvertable log message is encountered. It has to
do with check_non_ascii returning SVN_ERR_UNSUPPORTED_FEATURE when
it encounters this case and log_message_receiver only checking for
APR_EINVAL.

So, there are two solutions:

1) Alter check_non_ascii to return APR_EINVAL.
2) Have all callers of the utf conversion functions check for
   APR_EINVAL *and* SVN_ERR_UNSUPPORTED_FEATURE.

My vote is for #1. The crew on #svn seemed much more in favor of #2.
I believe it makes more sense to have a consistent API in this case.
But, I just want it to work. =) -- justin

* subversion/libsvn_subr/utf.c:
  (check_non_ascii): Return APR_EINVAL instead of
  SVN_ERR_UNSUPPORTED_FEATURE.

Index: ./subversion/libsvn_subr/utf.c
===================================================================
--- ./subversion/libsvn_subr/utf.c
+++ ./subversion/libsvn_subr/utf.c Sat Jul 27 17:31:09 2002
@@ -202,10 +202,9 @@
 }
 
 
-/* Return SVN_ERR_UNSUPPORTED_FEATURE if the first LEN bytes of DATA
- contain anything other than seven-bit, non-control (except for
- whitespace) ascii characters, finding the error pool from POOL.
- Otherwise, return SVN_NO_ERROR. */
+/* Return APR_EINVAL if the first LEN bytes of DATA contain anything other
+ than seven-bit, non-control (except for whitespace) ascii characters,
+ finding the error pool from POOL. Otherwise, return SVN_NO_ERROR. */
 static svn_error_t *
 check_non_ascii (const char *data, apr_size_t len, apr_pool_t *pool)
 {
@@ -231,7 +230,7 @@
                 = apr_pstrndup (pool, data_start, (data - data_start));
 
               return svn_error_createf
- (SVN_ERR_UNSUPPORTED_FEATURE, 0, NULL, pool,
+ (APR_EINVAL, 0, NULL, pool,
                  "Safe data:\n"
                  "\"%s\"\n"
                  "... was followed by non-ascii byte %d.\n"
@@ -243,7 +242,7 @@
           else
             {
               return svn_error_createf
- (SVN_ERR_UNSUPPORTED_FEATURE, 0, NULL, pool,
+ (APR_EINVAL, 0, NULL, pool,
                  "Non-ascii character (code %d) detected, "
                  "and unable to convert to UTF-8.\n",
                  *((unsigned char *) data));

==== Option #2 ====

* subversion/clients/cmdline/log-cmd
  (log_message_receiver): Check for SVN_ERR_UNSUPPORTED_FEATURE
  instead of APR_EINVAL.

Index: ./subversion/clients/cmdline/log-cmd.c
===================================================================
--- ./subversion/clients/cmdline/log-cmd.c
+++ ./subversion/clients/cmdline/log-cmd.c Sat Jul 27 15:07:05 2002
@@ -150,7 +150,8 @@
      stuff can come later! */
 
   err = svn_utf_cstring_from_utf8 (&author_native, author, pool);
- if (err && (APR_STATUS_IS_EINVAL (err->apr_err)))
+ if (err && (APR_STATUS_IS_EINVAL (err->apr_err) ||
+ err->apr_err == SVN_ERR_UNSUPPORTED_FEATURE))
     {
     
       SVN_ERR (svn_utf_cstring_from_utf8
@@ -163,7 +164,8 @@
     return err;
 
   err = svn_utf_cstring_from_utf8 (&date_native, date, pool);
- if (err && (APR_STATUS_IS_EINVAL (err->apr_err))) /* unlikely! */
+ if (err && (APR_STATUS_IS_EINVAL (err->apr_err) ||
+ err->apr_err == SVN_ERR_UNSUPPORTED_FEATURE)) /* unlikely! */
     {
       SVN_ERR (svn_utf_cstring_from_utf8
                (&date_native,
@@ -175,7 +177,8 @@
     return err;
 
   err = svn_utf_cstring_from_utf8 (&msg_native, msg, pool);
- if (err && (APR_STATUS_IS_EINVAL (err->apr_err)))
+ if (err && (APR_STATUS_IS_EINVAL (err->apr_err) ||
+ err->apr_err == SVN_ERR_UNSUPPORTED_FEATURE))
     {
       SVN_ERR (svn_utf_cstring_from_utf8
                (&msg_native,

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Jul 28 02:50:28 2002

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.