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

[PATCH] Re: Hooks on Windows

From: D.J. Heap <dj_at_shadyvale.net>
Date: 2003-08-22 02:54:25 CEST

Branko Čibej wrote:
[snip]
>
> For the interim, I'd suggest defining the name of the null device in
> svn_private_config.h, for both Unix and Windows, then just use that
> define, and the rest of your patch can remain unchanged.
>

Is this patch what you had in mind? It builds and works well on
Windows. It builds on my RH9 box, but hook output is lost (before and
after this patch). Issue 443 implies that it was working at one time,
but it seems to be broken now on Linux. I'm going to take a look at it
this weekend and see if my meager Linux programming knowledge is up to
the task.

DJ

Index: configure.in
===================================================================
--- configure.in (revision 6809)
+++ configure.in (working copy)
@@ -422,6 +422,9 @@
 AC_DEFINE_UNQUOTED(SVN_PATH_LOCAL_SEPARATOR, '/',
         [Defined to be the path separator used on your local filesystem])
 
+AC_DEFINE_UNQUOTED(SVN_NULL_DEVICE_NAME, "/dev/null",
+ [Defined to be the null device for the system])
+
 dnl Find a python 2.X binary, test cases will not run with Python 1.X
 AC_PATH_PROG(PYTHON2, python2, none)
 if test "$PYTHON2" = "none"; then
Index: subversion/libsvn_repos/hooks.c
===================================================================
--- subversion/libsvn_repos/hooks.c (revision 6809)
+++ subversion/libsvn_repos/hooks.c (working copy)
@@ -50,7 +50,7 @@
               svn_boolean_t check_exitcode,
               apr_pool_t *pool)
 {
- apr_file_t *read_errhandle, *write_errhandle;
+ apr_file_t *read_errhandle, *write_errhandle, *null_handle;
   apr_status_t apr_err;
   svn_error_t *err;
   int exitcode;
@@ -62,8 +62,15 @@
     return svn_error_createf
       (apr_err, NULL, "can't create pipe for '%s' hook", cmd);
 
+ /* Redirect stdout to the null device */
+ apr_err = apr_file_open (&null_handle, SVN_NULL_DEVICE_NAME, APR_WRITE, APR_OS_DEFAULT,
+ pool);
+ if (apr_err)
+ return svn_error_createf
+ (apr_err, NULL, "can't create null stdout for '%s' hook", cmd);
+
   err = svn_io_run_cmd (".", cmd, args, &exitcode, &exitwhy, FALSE,
- NULL, NULL, write_errhandle, pool);
+ NULL, null_handle, write_errhandle, pool);
 
   /* This seems to be done automatically if we pass the third parameter of
      apr_procattr_child_in/out_set(), but svn_io_run_cmd()'s interface does
@@ -72,6 +79,13 @@
   if (!err && apr_err)
     return svn_error_create
       (apr_err, NULL, "can't close write end of stderr pipe");
+ if (null_handle)
+ {
+ apr_err = apr_file_close (null_handle);
+ if (!err && apr_err)
+ return svn_error_create
+ (apr_err, NULL, "can't close write end of null file");
+ }
 
   /* Function failed. */
   if (err)
Index: svn_private_config.hw
===================================================================
--- svn_private_config.hw (revision 6809)
+++ svn_private_config.hw (working copy)
@@ -39,6 +39,9 @@
 /* Path separator for local filesystem */
 #define SVN_PATH_LOCAL_SEPARATOR '\\'
 
+/* Name of system's null device */
+#define SVN_NULL_DEVICE_NAME "nul"
+
 /* Link local repos access library to client */
 #define SVN_LIBSVN_CLIENT_LINKS_RA_LOCAL
 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Aug 22 02:55:18 2003

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.