Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH 1/3] rebase: avoid non-function use of "return" on FreeBSD

From: Junio C Hamano <hidden>
Date: 2016-06-15 23:00:43

Junio C Hamano [off-list ref] writes:
By the way, you have this in your log message:

    ... the git-rebase--*.sh scripts have used a "return" to return
    from the "dot" command that runs them.  While this is allowed by
    POSIX,...


Is it "this is allowed", or is it "this should be the way and shells
that do not do so are buggy"?
Answering myself...

The only "unspecified" I see is this:

    If the shell is not currently executing a function or dot
    script, the results are unspecified.

which clearly does not apply to the version before this patch (we
are executing a dot script).  And

    The return utility shall cause the shell to stop executing the
    current function or dot script.

would mean that we are correct to expect that "should not get here"
is not reached, as the "return 5" would cause the shell to stop
executing the dot script there.

So "while this is allowed by POSIX" may be a bit misleading and
needs to be reworded, I guess?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help