You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by dj <dj...@shadyvale.net> on 2003/08/21 05:12:55 UTC

Hooks

While trying to fix the hook's stderr messiness on Windows, it appears
to me that on RH9 Linux, at least, hook output is not being sent back to
the client on failures.  This is using ra_local and ra_svn, haven't
tried ra_dav.  With my updated patch incorporating Brane's comments,
Windows is now working fine...but RH9 doesn't work before or after my
changes.

Can someone test and confirm?

[dj@mercury dj2]$ svn commit -m "test"
Sending        file
Transmitting file data .svn: A repository hook failed.
svn: Commit failed (details follow):
svn: 'pre-commit' hook failed with error output:
 

The pre-commit hook looks like:

-rwxrwxrwx    1 dj       dj             50 Aug 20 22:52 pre-commit

with contents:

[dj@mercury hooks]$ cat pre-commit
echo hello stdout.
echo hello stderr. 1>&2
exit 1


I'm not a Linux expert so perhaps someone can tell me what I've got
messed up?

DJ



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Hooks

Posted by "D.J. Heap" <dj...@shadyvale.net>.
Greg Hudson wrote:
> On Thu, 2003-08-21 at 01:12, dj wrote:
> 
>>While trying to fix the hook's stderr messiness on Windows, it appears
>>to me that on RH9 Linux, at least, hook output is not being sent back to
>>the client on failures.
> 
> 
> Here's what I would expect:
> 
>   ra_local: You should see hook stdout and stderr.
>   ra_svn with ssh: You should see hook stderr; hook stdout will
>    corrupt the data stream and give you malformed network data
>    errors.
>   ra_svn without ssh: hook stdout and stderr go nowhere.
>   ra_dav: hook stdout and stderr go nowhere.
> 
> The network protocols simply don't have any mechanism for conveying
> output from hook scripts; when it does work, it works by accident.


Hmm, isn't that what this piece of hooks.c at about line 100 is trying 
to do?  Read captured stderr on failure and return it as an error 
result?  Since it's part of an error message it should go through error 
message marshalling, I would think...but I'm new to this code, so I'm 
not sure.

   if (!err && check_exitcode)
     {
       /* Command failed. */
       if (! APR_PROC_CHECK_EXIT (exitwhy) || exitcode != 0)
         {
           svn_stringbuf_t *error;

           /* Read the file's contents into a stringbuf, allocated in 
POOL. */
           SVN_ERR (svn_stringbuf_from_aprfile (&error, read_errhandle, 
pool));

           err = svn_error_createf
               (SVN_ERR_REPOS_HOOK_FAILURE, err,
                "'%s' hook failed with error output:\n%s",
                name, error->data);
         }
     }


DJ


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Hooks

Posted by Ben Collins-Sussman <su...@collab.net>.
Greg Hudson <gh...@MIT.EDU> writes:

>   ra_dav: hook stdout and stderr go nowhere.

Now go look at issue 443.

I'm baffled by my comment from last December:

   "Great!  start-commit and pre-commit hook errors are now marshalled
back to the client as a normal svn_error_t."

Have we regressed somehow?



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Hooks

Posted by Greg Hudson <gh...@MIT.EDU>.
On Thu, 2003-08-21 at 01:12, dj wrote:
> While trying to fix the hook's stderr messiness on Windows, it appears
> to me that on RH9 Linux, at least, hook output is not being sent back to
> the client on failures.

Here's what I would expect:

  ra_local: You should see hook stdout and stderr.
  ra_svn with ssh: You should see hook stderr; hook stdout will
   corrupt the data stream and give you malformed network data
   errors.
  ra_svn without ssh: hook stdout and stderr go nowhere.
  ra_dav: hook stdout and stderr go nowhere.

The network protocols simply don't have any mechanism for conveying
output from hook scripts; when it does work, it works by accident.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org