post-commit hook stderr not marshalled back

7 views
Skip to first unread message

Bastien Semene

unread,
Jan 21, 2010, 9:06:45 AM1/21/10
to us...@subversion.apache.org
Hi list,

I currently can't get the stderr output of the post-commit hook script
back to the client.

The goal of this part of this post-commit hook script is to update a
specific working copy when someone commit on a particular folder, and
the commiter to verify the version of this working copy.

Everything works fine except that the client (Tortoise) doesn't display
the version of the working copy.

To display the new version of the working copy, I've done a nasty hack
to redirect the stdout to stderr so svn should marshalled back the
message to the client as described in the documentation :
"If the post-commit hook returns a nonzero exit status, the commit will
not be aborted since it has already completed. However, anything that
the hook printed to stderr will be marshalled back to the client, making
it easier to diagnose hook failures."

This is the interesting part of my script :
"
#!/bin/sh
[...]
/usr/bin/grep revision -f $1/hooks/revision 1>&2
exit 1
"

When I add 2>test before 1>&2, it works, so stdout is correctly
redirected to stderr. The exit 1 should correctly send a nonzero exit
status.
So, I don't know what's wrong.

If someone can help this will be great. :)


--
Bastien Semene
Administrateur Réseau & Système

ad...@cyanide-studio.com
+33 (0)1 47 86 30 80

Cyanide S.A.
5, Boulevard des Bouvets
92000 Nanterre - FRANCE

Andy Levy

unread,
Jan 21, 2010, 9:25:01 AM1/21/10
to Bastien Semene, us...@subversion.apache.org
On Thu, Jan 21, 2010 at 09:06, Bastien Semene
<bse...@cyanide-studio.com> wrote:
> Hi list,
>
> I currently can't get the stderr output of the post-commit hook script back
> to the client.
>
> The goal of this part of this post-commit hook script is to update a
> specific working copy when someone commit on a particular folder, and the
> commiter to verify the version of this working copy.
>
> Everything works fine except that the client (Tortoise) doesn't display the
> version of the working copy.

If the WC is being updated in the post-commit, then wouldn't the
revision number reported at the successful completion of the commit
(standard client behavior) be the same as what you've just updated to
in the post-commit hook?

Am I misunderstanding something?

Bastien Semene

unread,
Jan 21, 2010, 9:35:58 AM1/21/10
to us...@subversion.apache.org
Yes, it should be.
Actually everything works in a perfect world in my example, 99.9% of the time the commiter should see the same number. But if something goes wrong during the update the commiter should be aware of it asap.
I can handle more problems later in the script (or in another script as adviced in the documentation).

But this is not in the scope of my question, that is summarized in my first sentece.

Andy Levy a écrit :

Giulio Troccoli

unread,
Jan 21, 2010, 9:42:31 AM1/21/10
to Bastien Semene, us...@subversion.apache.org
>


Linedata Services (UK) Ltd
Registered Office: Bishopsgate Court, 4-12 Norton Folgate, London, E1 6DB
Registered in England and Wales No 3027851 VAT Reg No 778499447

-----Original Message-----

Why don't you just redirect directly to stderr like

/usr/bin/grep revision -f $1/hooks/revision > stderr

And shouldn't exit 1 be on another line?

Bastien Semene

unread,
Jan 21, 2010, 10:04:19 AM1/21/10
to us...@subversion.apache.org
Giulio Troccoli a écrit :
Actually it seems there's a problem with my mail, "exit 1" is on another line (the double quote was also on another line).
I didn't know the shorcut to redirect to stderr, but I think this will not answer my problem as the test to a file writing worked.

I'll give a look to this "> stderr", thanks.
Reply all
Reply to author
Forward
0 new messages