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

[PATCH] Global errno and dav_svn_convert_err

From: Philip Martin <philip_at_codematters.co.uk>
Date: 2004-02-20 21:21:57 CET

I'm seeing httpd errors like this

[Fri Feb 20 20:00:24 2004] [error] [client 127.0.0.1] (84)Invalid or incomplete multibyte or wide character: 'pre-revprop-change' hook failed with error output:

The "(84)Invalid or incomplete multibyte or wide character" bit is a
result of the mod_dav error code storing global errno at the point a
dav_error is created. Now global errno is only valid between a failed
system call and the next system call, one cannot assume that a
successful system call will set it to zero, not that a successful
system call will leave it unchanged. On my system errno=84 is a side
effect of a successful iconv() call, it is confusing to report this in
the httpd error log.

I'm don't know whether the mod_dav code is diligent about making sure
that only valid errno values make it into dav_errors, but mod_dav_svn
certainly isn't. Rather than put misleading information into the
error log I propose we clear errno as follows

* subversion/mod_dav_svn/util.c (dav_svn_convert_err): Clear errno.

Index: subversion/mod_dav_svn/util.c
===================================================================
--- subversion/mod_dav_svn/util.c (revision 8789)
+++ subversion/mod_dav_svn/util.c (working copy)
@@ -17,6 +17,7 @@
  */
 
 #include <apr_xml.h>
+#include <apr_errno.h>
 #include <apr_uri.h>
 #include <mod_dav.h>
 
@@ -51,6 +52,12 @@
         /* add other mappings here */
       }
 
+ /* dav_new_error_tag will record errno but Subversion makes no attempt
+ to ensure that it is valid. We reset it to avoid putting incorrect
+ information into the error log, at the expense of possibly removing
+ valid information. */
+ errno = 0;
+
     derr = dav_new_error_tag(pool, status,
                              serr->apr_err, apr_pstrdup(pool, serr->message),
                              SVN_DAV_ERROR_NAMESPACE,

-- 
Philip Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Feb 20 21:21:58 2004

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.