git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rebase: update comment about FreeBSD /bin/sh
@ 2016-06-17 15:33 Ed Maste
  2016-06-17 17:10 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Ed Maste @ 2016-06-17 15:33 UTC (permalink / raw)
  To: git; +Cc: mackyle, Ed Maste

Commit 9f50d32 introduced a fix for FreeBSD /bin/sh misbehaviour
when dot-sourcing a file containing "return" statements outside of
any function, from a function in another shell script. That issue
affects FreeBSD 9.x, and is not present in the /bin/sh in FreeBSD
10.3 and later. Update the comment to clarify this.

The example from 9f50d32's commit message produces the expected output
on FreeBSD 10.3 and -CURRENT (the upcoming 11.0):

% sh script1.sh
only this line should show
%

Signed-off-by: Ed Maste <emaste@freebsd.org>
---
 git-rebase--am.sh          | 4 ++--
 git-rebase--interactive.sh | 4 ++--
 git-rebase--merge.sh       | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/git-rebase--am.sh b/git-rebase--am.sh
index 9ae898b..3752393 100644
--- a/git-rebase--am.sh
+++ b/git-rebase--am.sh
@@ -9,8 +9,8 @@
 # below were not inside any function, and expected to return
 # to the function that dot-sourced us.
 #
-# However, FreeBSD /bin/sh misbehaves on such a construct and
-# continues to run the statements that follow such a "return".
+# However, older (9.x) versions of FreeBSD /bin/sh misbehave on such a
+# construct and continue to run the statements that follow such a "return".
 # As a work-around, we introduce an extra layer of a function
 # here, and immediately call it after defining it.
 git_rebase__am () {
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 6e96abc..05f22e4 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -1038,8 +1038,8 @@ check_todo_list () {
 # below were not inside any function, and expected to return
 # to the function that dot-sourced us.
 #
-# However, FreeBSD /bin/sh misbehaves on such a construct and
-# continues to run the statements that follow such a "return".
+# However, older (9.x) versions of FreeBSD /bin/sh misbehave on such a
+# construct and continue to run the statements that follow such a "return".
 # As a work-around, we introduce an extra layer of a function
 # here, and immediately call it after defining it.
 git_rebase__interactive () {
diff --git a/git-rebase--merge.sh b/git-rebase--merge.sh
index 8d43db9..06a4723 100644
--- a/git-rebase--merge.sh
+++ b/git-rebase--merge.sh
@@ -107,8 +107,8 @@ finish_rb_merge () {
 # below were not inside any function, and expected to return
 # to the function that dot-sourced us.
 #
-# However, FreeBSD /bin/sh misbehaves on such a construct and
-# continues to run the statements that follow such a "return".
+# However, older (9.x) versions of FreeBSD /bin/sh misbehave on such a
+# construct and continue to run the statements that follow such a "return".
 # As a work-around, we introduce an extra layer of a function
 # here, and immediately call it after defining it.
 git_rebase__merge () {
-- 
2.8.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] rebase: update comment about FreeBSD /bin/sh
  2016-06-17 15:33 [PATCH] rebase: update comment about FreeBSD /bin/sh Ed Maste
@ 2016-06-17 17:10 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2016-06-17 17:10 UTC (permalink / raw)
  To: Ed Maste; +Cc: git, mackyle

Ed Maste <emaste@freebsd.org> writes:

> Commit 9f50d32 introduced a fix for FreeBSD /bin/sh misbehaviour
> when dot-sourcing a file containing "return" statements outside of
> any function, from a function in another shell script. That issue
> affects FreeBSD 9.x, and is not present in the /bin/sh in FreeBSD
> 10.3 and later. Update the comment to clarify this.
>
> The example from 9f50d32's commit message produces the expected output
> on FreeBSD 10.3 and -CURRENT (the upcoming 11.0):
>
> % sh script1.sh
> only this line should show
> %
>
> Signed-off-by: Ed Maste <emaste@freebsd.org>
> ---
>  git-rebase--am.sh          | 4 ++--
>  git-rebase--interactive.sh | 4 ++--
>  git-rebase--merge.sh       | 4 ++--
>  3 files changed, 6 insertions(+), 6 deletions(-)

Nice.

It's only two years since 9f50d32b (rebase: avoid non-function use
of "return" on FreeBSD, 2014-04-11) so we still need the warning,
but eventually 9.x will die out and we can stop worrying about this
one.

Thanks, will queue.

> diff --git a/git-rebase--am.sh b/git-rebase--am.sh
> index 9ae898b..3752393 100644
> --- a/git-rebase--am.sh
> +++ b/git-rebase--am.sh
> @@ -9,8 +9,8 @@
>  # below were not inside any function, and expected to return
>  # to the function that dot-sourced us.
>  #
> -# However, FreeBSD /bin/sh misbehaves on such a construct and
> -# continues to run the statements that follow such a "return".
> +# However, older (9.x) versions of FreeBSD /bin/sh misbehave on such a
> +# construct and continue to run the statements that follow such a "return".
>  # As a work-around, we introduce an extra layer of a function
>  # here, and immediately call it after defining it.
>  git_rebase__am () {
> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
> index 6e96abc..05f22e4 100644
> --- a/git-rebase--interactive.sh
> +++ b/git-rebase--interactive.sh
> @@ -1038,8 +1038,8 @@ check_todo_list () {
>  # below were not inside any function, and expected to return
>  # to the function that dot-sourced us.
>  #
> -# However, FreeBSD /bin/sh misbehaves on such a construct and
> -# continues to run the statements that follow such a "return".
> +# However, older (9.x) versions of FreeBSD /bin/sh misbehave on such a
> +# construct and continue to run the statements that follow such a "return".
>  # As a work-around, we introduce an extra layer of a function
>  # here, and immediately call it after defining it.
>  git_rebase__interactive () {
> diff --git a/git-rebase--merge.sh b/git-rebase--merge.sh
> index 8d43db9..06a4723 100644
> --- a/git-rebase--merge.sh
> +++ b/git-rebase--merge.sh
> @@ -107,8 +107,8 @@ finish_rb_merge () {
>  # below were not inside any function, and expected to return
>  # to the function that dot-sourced us.
>  #
> -# However, FreeBSD /bin/sh misbehaves on such a construct and
> -# continues to run the statements that follow such a "return".
> +# However, older (9.x) versions of FreeBSD /bin/sh misbehave on such a
> +# construct and continue to run the statements that follow such a "return".
>  # As a work-around, we introduce an extra layer of a function
>  # here, and immediately call it after defining it.
>  git_rebase__merge () {

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-06-17 17:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-17 15:33 [PATCH] rebase: update comment about FreeBSD /bin/sh Ed Maste
2016-06-17 17:10 ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).