You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Bastien Semene <bs...@cyanide-studio.com> on 2010/01/21 15:06:45 UTC

post-commit hook stderr not marshalled back

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

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

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


Re: post-commit hook stderr not marshalled back

Posted by Bastien Semene <bs...@cyanide-studio.com>.
Giulio Troccoli a écrit :
>
>
> 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-----
>
>
>   
>> From: Bastien Semene [mailto:bsemene@cyanide-studio.com]
>> Sent: 21 January 2010 14:07
>> To: users@subversion.apache.org
>> Subject: post-commit hook stderr not marshalled back
>>
>> 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. :)
>>     
>
> 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?
>
>   
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.

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

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

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


Re: post-commit hook stderr not marshalled back

Posted by Bastien Semene <bs...@cyanide-studio.com>.
Giulio Troccoli a écrit :
>
>
> 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-----
>
>
>   
>> From: Bastien Semene [mailto:bsemene@cyanide-studio.com]
>> Sent: 21 January 2010 14:07
>> To: users@subversion.apache.org
>> Subject: post-commit hook stderr not marshalled back
>>
>> 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. :)
>>     
>
> 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?
>
>   
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.

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

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

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


RE: post-commit hook stderr not marshalled back

Posted by Giulio Troccoli <Gi...@uk.linedata.com>.
>


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-----


> From: Bastien Semene [mailto:bsemene@cyanide-studio.com]
> Sent: 21 January 2010 14:07
> To: users@subversion.apache.org
> Subject: post-commit hook stderr not marshalled back
>
> 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. :)

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?

RE: post-commit hook stderr not marshalled back

Posted by Giulio Troccoli <Gi...@uk.linedata.com>.
>


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-----


> From: Bastien Semene [mailto:bsemene@cyanide-studio.com]
> Sent: 21 January 2010 14:07
> To: users@subversion.apache.org
> Subject: post-commit hook stderr not marshalled back
>
> 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. :)

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?


Re: post-commit hook stderr not marshalled back

Posted by Bastien Semene <bs...@cyanide-studio.com>.
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 :
> On Thu, Jan 21, 2010 at 09:06, Bastien Semene
> <bs...@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
Administrateur Réseau & Système

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

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


Re: post-commit hook stderr not marshalled back

Posted by Bastien Semene <bs...@cyanide-studio.com>.
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 :
> On Thu, Jan 21, 2010 at 09:06, Bastien Semene
> <bs...@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
Administrateur Réseau & Système

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

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


Re: post-commit hook stderr not marshalled back

Posted by Andy Levy <an...@gmail.com>.
On Thu, Jan 21, 2010 at 09:06, Bastien Semene
<bs...@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?