You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Dario Niedermann <dn...@tiscali.it> on 2016/10/12 07:47:00 UTC

Fwd: [Linux] Hook hashbang hardships

Hi! Having received no relevant replies on users@ in 15 days, I'm
forwarding my message here. Thanks for looking into the issue.

----- Forwarded message from Dario Niedermann <dn...@tiscali.it> -----

Hello! I've been having trouble getting my own pre-revprop-change
hook script to work. Svn was refusing any change to a revprop with
the following error:
________________________________________
svn: E165001: Revprop change blocked by pre-revprop-change hook
(exit code 1) with no output.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Until I found out that the issue was in the script's shebang:

	#!/bin/bash -e

which wouldn't work. Had to remove ' -e'. Is this expected behaviour
or is there something wrong with svn (version 1.9.4 (r1740329) on
Linux/x86_64) ?

Thanks,
DN

----- End forwarded message -----

Re: Fwd: [Linux] Hook hashbang hardships

Posted by Branko Čibej <br...@apache.org>.
[switching back to users@]

On 12.10.2016 12:04, Dario Niedermann wrote:
> Il 12/10/2016 alle 11:29, Stefan ha scritto:
>
>> Forwarding messages to the dev list is not really considered good
>> practice.
> The community guide on Subversion's website says it's OK to ask on
> dev@ if a report on a possible issue with svn doesn't goes unanswered
> on users@. Considering that the only reply I got on users@ was from
> someone who completely misread the problem, it seemed to me that the
> last-ditch attempt before opening an issue was to report it is dev@.
>
> Returning to the original topic, and just to be even clearer: this is
> about Subversion NOT RUNNING a script because it has a FLAG FOR THE
> SHELL in its SHEBANG LINE. Not because I got the path to bash wrong or
> because there is some other error in my script (as should be *OBVIOUS*
> from my very first email).

How do you know the script isn't running? On the contrary, your report
implies that the script /is/ running and exits with an error code; when
you modified it, it stopped exiting with an error.


> I was asking if not running a script under these circumstances is
> INTENDED BEHAVIOUR for svn or if it might be a BUG IN SUBVERSION.

It has nothing to do with Subversion. Subversion is not responsible for
interpreting the #! line at the beginning of the script; the kernel does
that.

-- Brane

Re: Fwd: [Linux] Hook hashbang hardships

Posted by Stefan Sperling <st...@elego.de>.
On Wed, Oct 12, 2016 at 12:29:55PM +0200, Dario Niedermann wrote:
> That is true. I was mostly wondering if Subversion was (for example)
> running hook scripts via /usr/bin/env; so that it's expected for any
> flags on the shebang line to cause errors. Or if I'm onto something
> and opening a bug is justified.
> 
> Thank you,
> DN

Subversion uses APR's apr_proc_create to run the hook, with the
command type attribute set to APR_PROGRAM (not APR_SHELLCMD!).
On Unix, APR then uses execve() to run the program.

The relevant code from APR trunk is here:
https://svn.apache.org/repos/asf/apr/apr/trunk/threadproc/unix/proc.c

Re: Fwd: [Linux] Hook hashbang hardships

Posted by Dario Niedermann <dn...@tiscali.it>.
Il 12/10/2016 alle 12:18, Stefan Sperling ha scritto:

> I don't think it's a very important bug to fix though because there is
> an easy workaround. You should be able to work around this by adding:
> 
>   set -e
> 
> on the first line of your script.

That is true. I was mostly wondering if Subversion was (for example)
running hook scripts via /usr/bin/env; so that it's expected for any
flags on the shebang line to cause errors. Or if I'm onto something
and opening a bug is justified.

Thank you,
DN

Re: Fwd: [Linux] Hook hashbang hardships

Posted by Stefan Sperling <st...@elego.de>.
On Wed, Oct 12, 2016 at 12:04:03PM +0200, Dario Niedermann wrote:
> The community guide on Subversion's website says it's OK to ask on
> dev@ if a report on a possible issue with svn doesn't goes unanswered
> on users@. Considering that the only reply I got on users@ was from
> someone who completely misread the problem, it seemed to me that the
> last-ditch attempt before opening an issue was to report it is dev@.

Thank for you for reading the guide!

> Returning to the original topic, and just to be even clearer: this is
> about Subversion NOT RUNNING a script because it has a FLAG FOR THE
> SHELL in its SHEBANG LINE. Not because I got the path to bash wrong or
> because there is some other error in my script (as should be *OBVIOUS*
> from my very first email).

Communication over email is not guaranteed to be loss-free.
Some people will always disagree about what's obvious.
That's not a problem in itself. It only becomes a problem if
you don't have the patience to deal with it.

> I was asking if not running a script under these circumstances is
> INTENDED BEHAVIOUR for svn or if it might be a BUG IN SUBVERSION.

I suppose this could be fixed, yes, so if you like please open issue.

I don't think it's a very important bug to fix though because there is
an easy workaround. You should be able to work around this by adding:

  set -e

on the first line of your script.

Re: Fwd: [Linux] Hook hashbang hardships

Posted by Daniel Shahaf <da...@apache.org>.
Dario Niedermann wrote on Wed, Oct 12, 2016 at 12:04:03 +0200:
> Returning to the original topic, and just to be even clearer: this is
> about Subversion NOT RUNNING a script because it has a FLAG FOR THE
> SHELL in its SHEBANG LINE. Not because I got the path to bash wrong or
> because there is some other error in my script (as should be *OBVIOUS*
> from my very first email).

There is no need to shout.  Mario's theory was entirely plausible: if
some command in the script returns non-zero and prints nothing to
stderr, that will entirely explains the symptoms you saw, both before
and after removing the -e.

This relies on knowing that -e to sh means "exit the shell as soon as
any command exits non-zero".

The minimum example of this theory is:
[[[
#!/bin/sh -e
false
true
]]]

Cheers,

Daniel

Re: Fwd: [Linux] Hook hashbang hardships

Posted by Dario Niedermann <dn...@tiscali.it>.
Il 12/10/2016 alle 11:29, Stefan ha scritto:

> Forwarding messages to the dev list is not really considered good
> practice.

The community guide on Subversion's website says it's OK to ask on
dev@ if a report on a possible issue with svn doesn't goes unanswered
on users@. Considering that the only reply I got on users@ was from
someone who completely misread the problem, it seemed to me that the
last-ditch attempt before opening an issue was to report it is dev@.

Returning to the original topic, and just to be even clearer: this is
about Subversion NOT RUNNING a script because it has a FLAG FOR THE
SHELL in its SHEBANG LINE. Not because I got the path to bash wrong or
because there is some other error in my script (as should be *OBVIOUS*
from my very first email).

I was asking if not running a script under these circumstances is
INTENDED BEHAVIOUR for svn or if it might be a BUG IN SUBVERSION.

> I see that you got one reply from a user but don't see any
> reply from your side. That might lead people to assume that the issue
> was fixed for you and there's no longer any problem. May I suggest you
> just bump your post on the users list in order to see if someone else
> picks it up there?

I thought *that* was bad practice.

Thank you,
DN

Re: Fwd: [Linux] Hook hashbang hardships

Posted by Stefan <lu...@posteo.de>.
Hi Dario,
On 10/12/2016 9:47 AM, Dario Niedermann wrote:
> Hi! Having received no relevant replies on users@ in 15 days, I'm
> forwarding my message here. Thanks for looking into the issue.
>
> ----- Forwarded message from Dario Niedermann <dn...@tiscali.it> -----
>
> Hello! I've been having trouble getting my own pre-revprop-change
> hook script to work. Svn was refusing any change to a revprop with
> the following error:
> ________________________________________
> svn: E165001: Revprop change blocked by pre-revprop-change hook
> (exit code 1) with no output.
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Until I found out that the issue was in the script's shebang:
>
> 	#!/bin/bash -e
>
> which wouldn't work. Had to remove ' -e'. Is this expected behaviour
> or is there something wrong with svn (version 1.9.4 (r1740329) on
> Linux/x86_64) ?
>
> Thanks,
> DN
>
> ----- End forwarded message -----

Forwarding messages to the dev list is not really considered good
practice. I see that you got one reply from a user but don't see any
reply from your side. That might lead people to assume that the issue
was fixed for you and there's no longer any problem. May I suggest you
just bump your post on the users list in order to see if someone else
picks it up there?

Regards,
Stefan