* RE: [Test Breakage 2.46.0-rc0] Test t0021.35 fails on NonStop
2024-07-14 17:00 ` Junio C Hamano
@ 2024-07-14 17:29 ` rsbecker
2024-07-14 18:15 ` brian m. carlson
2024-07-14 21:27 ` Eric Sunshine
2 siblings, 0 replies; 18+ messages in thread
From: rsbecker @ 2024-07-14 17:29 UTC (permalink / raw)
To: 'Junio C Hamano'; +Cc: git
On Sunday, July 14, 2024 1:00 PM, Junio C Hamano wrote:
><rsbecker@nexbridge.com> writes:
>
>> This looks like a different between ksh and bash. Under bash, the test
>> works. I can live with that but will have to force bash to be used as
>> the shebang #!/bin/sh defaults to ksh on this box.
>
>It turns out that the version of ksh I used in my description does not seem
to grok
>"local" at all. I vaguely recall that we've written off various hobbist
>reimplementation of ksh as unusable enough, but this one is ksh93 direct
from
>AT&T Research.
>
>I guess when we said "as long as we limit our use to a simple 'this
variable has
>visibility limited to the function and its children'
>and nothing else, it is portable enough across practically everybody we
care about",
>we have written off the real ksh, too.
>
>In the meantime, we may want to document this in a more prominent way.
>Perhaps like so:
>
>-------- >8 --------------- >8 --------------- >8 --------
>Subject: doc: guide to use of "local" shell language construct
>
>The scripted Porcelain commands do not allow use of "local" because it is
not
>universally supported, but we use it liberally in our test scripts, which
means some
>POSIX compliant shells (like "ksh93") can not be used to run our tests.
>
>Document the status quo, and hint that we might want to change the
situation in
>the fiture.
>
>Signed-off-by: Junio C Hamano <gitster@pobox.com>
>---
> Documentation/CodingGuidelines | 4 +++-
> t/README | 8 ++++++++
> 2 files changed, 11 insertions(+), 1 deletion(-)
>
>diff --git c/Documentation/CodingGuidelines
w/Documentation/CodingGuidelines
>index 1d92b2da03..68b7210f48 100644
>--- c/Documentation/CodingGuidelines
>+++ w/Documentation/CodingGuidelines
>@@ -186,7 +186,9 @@ For shell scripts specifically (not exhaustive):
> - Even though "local" is not part of POSIX, we make heavy use of it
> in our test suite. We do not use it in scripted Porcelains, and
> hopefully nobody starts using "local" before they are reimplemented
>- in C ;-)
>+ in C ;-) Notably, ksh (not just reimplementations but the real one
>+ from AT&T Research) does not support "local" and cannot be used,
>+ which we might want to reconsider.
>
> - Some versions of shell do not understand "export variable=value",
> so we write "variable=value" and then "export variable" on two diff
--git
>c/t/README w/t/README index d9e0e07506..1d39d8cfd5 100644
>--- c/t/README
>+++ w/t/README
>@@ -850,6 +850,14 @@ And here are the "don'ts:"
> but the best indication is to just run the tests with prove(1),
> it'll complain if anything is amiss.
>
>+ - Don't overuse "local"
>+
>+ Because strictly POSIX-compliant shells do not have to support
>+ "local", we avoid using it in our scripted Porcelain scripts, but
>+ we have allowed use of "local" in test scripts. We may want to
>+ reconsider this and rewrite our tests to also run on shells like
>+ ksh93. Do not add new use of "local" unnecessarily.
>+
>
> Skipping tests
> --------------
Thanks. I approve. I'm currently working on trying to get the test suite to
run under bash. It looks like TEST_SHELL_PATH is not propagated to the inner
make -C test. My current approach is to run the inner make without the outer
make. Otherwise I am forced to use ksh, which is known not to work. Will
advice when this runs - I have to rebuild, and that takes about an hour.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Test Breakage 2.46.0-rc0] Test t0021.35 fails on NonStop
2024-07-14 17:00 ` Junio C Hamano
2024-07-14 17:29 ` rsbecker
@ 2024-07-14 18:15 ` brian m. carlson
2024-07-14 18:28 ` rsbecker
2024-07-15 15:05 ` Junio C Hamano
2024-07-14 21:27 ` Eric Sunshine
2 siblings, 2 replies; 18+ messages in thread
From: brian m. carlson @ 2024-07-14 18:15 UTC (permalink / raw)
To: Junio C Hamano; +Cc: rsbecker, git
[-- Attachment #1: Type: text/plain, Size: 2074 bytes --]
On 2024-07-14 at 17:00:12, Junio C Hamano wrote:
> <rsbecker@nexbridge.com> writes:
>
> > This looks like a different between ksh and bash. Under bash, the test
> > works. I can live with that but will have to force bash to be used as the
> > shebang #!/bin/sh defaults to ksh on this box.
>
> It turns out that the version of ksh I used in my description does
> not seem to grok "local" at all. I vaguely recall that we've written
> off various hobbist reimplementation of ksh as unusable enough, but
> this one is ksh93 direct from AT&T Research.
>
> I guess when we said "as long as we limit our use to a simple 'this
> variable has visibility limited to the function and its children'
> and nothing else, it is portable enough across practically everybody
> we care about", we have written off the real ksh, too.
>
> In the meantime, we may want to document this in a more prominent
> way. Perhaps like so:
>
> -------- >8 --------------- >8 --------------- >8 --------
> Subject: doc: guide to use of "local" shell language construct
>
> The scripted Porcelain commands do not allow use of "local" because
> it is not universally supported, but we use it liberally in our test
> scripts, which means some POSIX compliant shells (like "ksh93") can
> not be used to run our tests.
>
> Document the status quo, and hint that we might want to change the
> situation in the fiture.
I don't think this is the right approach. Every version of ksh _except_
AT&T ksh works just fine here. pdksh, mksh, lksh, OpenBSD's ksh (which
is also its /bin/sh) work fine, as do bash, dash, FreeBSD's sh (ash),
Busybox's sh (also ash), and zsh (when run in sh mode with 5.9 or
newer). AT&T ksh is considering adding local in a newer version for
this reason.
Literally only AT&T ksh is not supported here, and so anyone can set
SHELL_PATH to any suitable shell. I don't think it's useful to get rid
of local when there are a variety of acceptable and portable options.
--
brian m. carlson (they/them or he/him)
Toronto, Ontario, CA
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* RE: [Test Breakage 2.46.0-rc0] Test t0021.35 fails on NonStop
2024-07-14 18:15 ` brian m. carlson
@ 2024-07-14 18:28 ` rsbecker
2024-07-14 22:01 ` brian m. carlson
2024-07-15 15:05 ` Junio C Hamano
1 sibling, 1 reply; 18+ messages in thread
From: rsbecker @ 2024-07-14 18:28 UTC (permalink / raw)
To: 'brian m. carlson', 'Junio C Hamano'; +Cc: git
On Sunday, July 14, 2024 2:16 PM, brian m. carlson wrote:
>To: Junio C Hamano <gitster@pobox.com>
>Cc: rsbecker@nexbridge.com; git@vger.kernel.org
>Subject: Re: [Test Breakage 2.46.0-rc0] Test t0021.35 fails on NonStop
>
>On 2024-07-14 at 17:00:12, Junio C Hamano wrote:
>> <rsbecker@nexbridge.com> writes:
>>
>> > This looks like a different between ksh and bash. Under bash, the
>> > test works. I can live with that but will have to force bash to be
>> > used as the shebang #!/bin/sh defaults to ksh on this box.
>>
>> It turns out that the version of ksh I used in my description does not
>> seem to grok "local" at all. I vaguely recall that we've written off
>> various hobbist reimplementation of ksh as unusable enough, but this
>> one is ksh93 direct from AT&T Research.
>>
>> I guess when we said "as long as we limit our use to a simple 'this
>> variable has visibility limited to the function and its children'
>> and nothing else, it is portable enough across practically everybody
>> we care about", we have written off the real ksh, too.
>>
>> In the meantime, we may want to document this in a more prominent way.
>> Perhaps like so:
>>
>> -------- >8 --------------- >8 --------------- >8 --------
>> Subject: doc: guide to use of "local" shell language construct
>>
>> The scripted Porcelain commands do not allow use of "local" because it
>> is not universally supported, but we use it liberally in our test
>> scripts, which means some POSIX compliant shells (like "ksh93") can
>> not be used to run our tests.
>>
>> Document the status quo, and hint that we might want to change the
>> situation in the fiture.
>
>I don't think this is the right approach. Every version of ksh _except_ AT&T ksh
>works just fine here. pdksh, mksh, lksh, OpenBSD's ksh (which is also its /bin/sh)
>work fine, as do bash, dash, FreeBSD's sh (ash), Busybox's sh (also ash), and zsh
>(when run in sh mode with 5.9 or newer). AT&T ksh is considering adding local in a
>newer version for this reason.
>
>Literally only AT&T ksh is not supported here, and so anyone can set SHELL_PATH to
>any suitable shell. I don't think it's useful to get rid of local when there are a variety
>of acceptable and portable options.
We can add NonStop's ksh to the list of not supported. I'm using TEST_SHELL_PATH while running make all in the t directory. Test passes when I use bash. For some reason (maybe GNUMake 4.1, which is what I have in my POSIX environment, I don't get TEST_SHELL_PATH passed down from the outer Makefile, but I can work with that. t0021 is now passing in my current CI stream using bash 5.0.18.
--Randall
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Test Breakage 2.46.0-rc0] Test t0021.35 fails on NonStop
2024-07-14 18:28 ` rsbecker
@ 2024-07-14 22:01 ` brian m. carlson
2024-07-14 22:14 ` rsbecker
2024-07-15 15:20 ` Junio C Hamano
0 siblings, 2 replies; 18+ messages in thread
From: brian m. carlson @ 2024-07-14 22:01 UTC (permalink / raw)
To: rsbecker; +Cc: 'Junio C Hamano', git
[-- Attachment #1: Type: text/plain, Size: 1946 bytes --]
On 2024-07-14 at 18:28:56, rsbecker@nexbridge.com wrote:
> On Sunday, July 14, 2024 2:16 PM, brian m. carlson wrote:
> >I don't think this is the right approach. Every version of ksh _except_ AT&T ksh
> >works just fine here. pdksh, mksh, lksh, OpenBSD's ksh (which is also its /bin/sh)
> >work fine, as do bash, dash, FreeBSD's sh (ash), Busybox's sh (also ash), and zsh
> >(when run in sh mode with 5.9 or newer). AT&T ksh is considering adding local in a
> >newer version for this reason.
> >
> >Literally only AT&T ksh is not supported here, and so anyone can set SHELL_PATH to
> >any suitable shell. I don't think it's useful to get rid of local when there are a variety
> >of acceptable and portable options.
>
> We can add NonStop's ksh to the list of not supported. I'm using TEST_SHELL_PATH while running make all in the t directory. Test passes when I use bash. For some reason (maybe GNUMake 4.1, which is what I have in my POSIX environment, I don't get TEST_SHELL_PATH passed down from the outer Makefile, but I can work with that. t0021 is now passing in my current CI stream using bash 5.0.18.
I think we had discussed that you were using AT&T ksh on NonStop, which
would explain the situation. That's the most common version of ksh on
proprietary Unix systems, and you can usually detect it with something
like this:
% ksh -c 'echo $KSH_VERSION'
Version AJM 93u+m/1.0.8 2024-01-01
Variants of pdksh look like this (this one from OpenBSD):
% ksh -c 'echo $KSH_VERSION'
@(#)PD KSH v5.2.14 99/07/13.2
And mksh and lksh (which are the same shell, just compiled differently,
look like this:
% mksh -c 'echo $KSH_VERSION'
@(#)MIRBSD KSH R59 2024/02/01 +Debian
% lksh -c 'echo $KSH_VERSION'
@(#)LEGACY KSH R59 2024/02/01 +Debian
I think using bash as a workaround is the right choice here if all you
have is AT&T ksh.
--
brian m. carlson (they/them or he/him)
Toronto, Ontario, CA
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* RE: [Test Breakage 2.46.0-rc0] Test t0021.35 fails on NonStop
2024-07-14 22:01 ` brian m. carlson
@ 2024-07-14 22:14 ` rsbecker
2024-07-15 15:20 ` Junio C Hamano
1 sibling, 0 replies; 18+ messages in thread
From: rsbecker @ 2024-07-14 22:14 UTC (permalink / raw)
To: 'brian m. carlson'; +Cc: 'Junio C Hamano', git
On Sunday, July 14, 2024 6:02 PM, brian m. carlson wrote:
>On 2024-07-14 at 18:28:56, rsbecker@nexbridge.com wrote:
>> On Sunday, July 14, 2024 2:16 PM, brian m. carlson wrote:
>> >I don't think this is the right approach. Every version of ksh
>> >_except_ AT&T ksh works just fine here. pdksh, mksh, lksh, OpenBSD's
>> >ksh (which is also its /bin/sh) work fine, as do bash, dash,
>> >FreeBSD's sh (ash), Busybox's sh (also ash), and zsh (when run in sh
>> >mode with 5.9 or newer). AT&T ksh is considering adding local in a newer
>version for this reason.
>> >
>> >Literally only AT&T ksh is not supported here, and so anyone can set
>> >SHELL_PATH to any suitable shell. I don't think it's useful to get
>> >rid of local when there are a variety of acceptable and portable options.
>>
>> We can add NonStop's ksh to the list of not supported. I'm using
>TEST_SHELL_PATH while running make all in the t directory. Test passes when I use
>bash. For some reason (maybe GNUMake 4.1, which is what I have in my POSIX
>environment, I don't get TEST_SHELL_PATH passed down from the outer Makefile,
>but I can work with that. t0021 is now passing in my current CI stream using bash
>5.0.18.
>
>I think we had discussed that you were using AT&T ksh on NonStop, which would
>explain the situation. That's the most common version of ksh on proprietary Unix
>systems, and you can usually detect it with something like this:
>
>% ksh -c 'echo $KSH_VERSION'
>Version AJM 93u+m/1.0.8 2024-01-01
>
>Variants of pdksh look like this (this one from OpenBSD):
>
>% ksh -c 'echo $KSH_VERSION'
>@(#)PD KSH v5.2.14 99/07/13.2
>
>And mksh and lksh (which are the same shell, just compiled differently, look like
>this:
>
>% mksh -c 'echo $KSH_VERSION'
>@(#)MIRBSD KSH R59 2024/02/01 +Debian
>
>% lksh -c 'echo $KSH_VERSION'
>@(#)LEGACY KSH R59 2024/02/01 +Debian
>
>I think using bash as a workaround is the right choice here if all you have is AT&T
>ksh.
We did discuss the ksh issue on NonStop but the check for whether this is an AT&T ksh is non-functional (KSH_VERSION is not set). What we did was change SHELL=/usr/coreutils/bin/bash and TEST_LINT= to get the tests to execute. Unfortunately, the GNU Make we have (4.1) does not pass TEST_SHELL_PATH (also set) down to inner make processes, so we still get stuck with ksh. I changed our CI system to run the test make on its own, which is now working on this test.
Regards,
Randall
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Test Breakage 2.46.0-rc0] Test t0021.35 fails on NonStop
2024-07-14 22:01 ` brian m. carlson
2024-07-14 22:14 ` rsbecker
@ 2024-07-15 15:20 ` Junio C Hamano
2024-07-15 15:32 ` rsbecker
1 sibling, 1 reply; 18+ messages in thread
From: Junio C Hamano @ 2024-07-15 15:20 UTC (permalink / raw)
To: brian m. carlson; +Cc: rsbecker, git
"brian m. carlson" <sandals@crustytoothpaste.net> writes:
> I think we had discussed that you were using AT&T ksh on NonStop, which
> would explain the situation. That's the most common version of ksh on
> proprietary Unix systems, and you can usually detect it with something
> like this:
What is sad is that we have this as literally the very first thing
in our test suite, as t0000.1, but ...
try_local_xy () {
local x="local" y="alsolocal" &&
echo "$x $y"
}
# Check whether the shell supports the "local" keyword. "local" is not
# POSIX-standard, but it is very widely supported by POSIX-compliant
# shells, and we rely on it within Git's test framework.
#
# If your shell fails this test, the results of other tests may be
# unreliable. You may wish to report the problem to the Git mailing
# list <git@vger.kernel.org>, as it could cause us to reconsider
# relying on "local".
test_expect_success 'verify that the running shell supports "local"' '
x="notlocal" &&
y="alsonotlocal" &&
echo "local alsolocal" >expected1 &&
try_local_xy >actual1 &&
test_cmp expected1 actual1 &&
echo "notlocal alsonotlocal" >expected2 &&
echo "$x $y" >actual2 &&
test_cmp expected2 actual2
'
... apparently it is just like any other test failure, so unless the
tester is running
$ shell t0000-basic.sh -i
reading the output, *AND* goes to the test script to read that
comment, the helpful comment can easily be missed.
I am wondering if it is worth doing something like this.
t/t0000-basic.sh | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git c/t/t0000-basic.sh w/t/t0000-basic.sh
index 98b81e4d63..3cb8243cb4 100755
--- c/t/t0000-basic.sh
+++ w/t/t0000-basic.sh
@@ -34,7 +34,7 @@ try_local_xy () {
# unreliable. You may wish to report the problem to the Git mailing
# list <git@vger.kernel.org>, as it could cause us to reconsider
# relying on "local".
-test_expect_success 'verify that the running shell supports "local"' '
+test_lazy_prereeq WORKING_LOCAL '
x="notlocal" &&
y="alsonotlocal" &&
echo "local alsolocal" >expected1 &&
@@ -45,6 +45,17 @@ test_expect_success 'verify that the running shell supports "local"' '
test_cmp expected2 actual2
'
+if ! test_have_prereq WORKING_LOCAL
+then
+ skip_all='
+ Your shell has no working "local", no tests will work.
+ You may wish to report the problem to the Git mailing
+ list <git@vger.kernel.org>, unless it is AT&T ksh,
+ which we know lacks "local". In the meantime, use
+ shells that support "local", like dash, bash, pdksh...'
+ test_done
+fi
+
################################################################
# git init has been done in an empty repository.
# make sure it is empty.
^ permalink raw reply related [flat|nested] 18+ messages in thread
* RE: [Test Breakage 2.46.0-rc0] Test t0021.35 fails on NonStop
2024-07-15 15:20 ` Junio C Hamano
@ 2024-07-15 15:32 ` rsbecker
2024-07-15 16:41 ` Junio C Hamano
0 siblings, 1 reply; 18+ messages in thread
From: rsbecker @ 2024-07-15 15:32 UTC (permalink / raw)
To: 'Junio C Hamano', 'brian m. carlson'; +Cc: git
On Monday, July 15, 2024 11:20 AM, Junio C Hamano wrote:
>"brian m. carlson" <sandals@crustytoothpaste.net> writes:
>
>> I think we had discussed that you were using AT&T ksh on NonStop,
>> which would explain the situation. That's the most common version of
>> ksh on proprietary Unix systems, and you can usually detect it with
>> something like this:
>
>What is sad is that we have this as literally the very first thing in our
test suite, as
>t0000.1, but ...
>
> try_local_xy () {
> local x="local" y="alsolocal" &&
> echo "$x $y"
> }
>
> # Check whether the shell supports the "local" keyword. "local" is
not
> # POSIX-standard, but it is very widely supported by
POSIX-compliant
> # shells, and we rely on it within Git's test framework.
> #
> # If your shell fails this test, the results of other tests may be
> # unreliable. You may wish to report the problem to the Git mailing
> # list <git@vger.kernel.org>, as it could cause us to reconsider
> # relying on "local".
> test_expect_success 'verify that the running shell supports
"local"' '
> x="notlocal" &&
> y="alsonotlocal" &&
> echo "local alsolocal" >expected1 &&
> try_local_xy >actual1 &&
> test_cmp expected1 actual1 &&
> echo "notlocal alsonotlocal" >expected2 &&
> echo "$x $y" >actual2 &&
> test_cmp expected2 actual2
> '
>
>... apparently it is just like any other test failure, so unless the tester
is running
>
> $ shell t0000-basic.sh -i
>
>reading the output, *AND* goes to the test script to read that comment, the
helpful
>comment can easily be missed.
>
>I am wondering if it is worth doing something like this.
>
>
> t/t0000-basic.sh | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
>
>diff --git c/t/t0000-basic.sh w/t/t0000-basic.sh index
98b81e4d63..3cb8243cb4
>100755
>--- c/t/t0000-basic.sh
>+++ w/t/t0000-basic.sh
>@@ -34,7 +34,7 @@ try_local_xy () {
> # unreliable. You may wish to report the problem to the Git mailing #
list
><git@vger.kernel.org>, as it could cause us to reconsider # relying on
"local".
>-test_expect_success 'verify that the running shell supports "local"' '
>+test_lazy_prereeq WORKING_LOCAL '
> x="notlocal" &&
> y="alsonotlocal" &&
> echo "local alsolocal" >expected1 &&
>@@ -45,6 +45,17 @@ test_expect_success 'verify that the running shell
supports
>"local"' '
> test_cmp expected2 actual2
> '
>
>+if ! test_have_prereq WORKING_LOCAL
>+then
>+ skip_all='
>+ Your shell has no working "local", no tests will work.
>+ You may wish to report the problem to the Git mailing
>+ list <git@vger.kernel.org>, unless it is AT&T ksh,
>+ which we know lacks "local". In the meantime, use
>+ shells that support "local", like dash, bash, pdksh...'
>+ test_done
>+fi
>+
> ################################################################
> # git init has been done in an empty repository.
> # make sure it is empty.
What is strange is that when running on NonStop using ksh, t0000.1 has never
failed. I think the situation is subtly different from what we are solving.
My take is that there is a difference in the local vs. non-local variable
set semantic, rather than just accepting the keyword. I would propose that
we need a more comprehensive local test to verify the actual expected
semantics rather than just testing the syntax.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Test Breakage 2.46.0-rc0] Test t0021.35 fails on NonStop
2024-07-15 15:32 ` rsbecker
@ 2024-07-15 16:41 ` Junio C Hamano
2024-07-15 17:39 ` rsbecker
0 siblings, 1 reply; 18+ messages in thread
From: Junio C Hamano @ 2024-07-15 16:41 UTC (permalink / raw)
To: rsbecker; +Cc: 'brian m. carlson', git
<rsbecker@nexbridge.com> writes:
> What is strange is that when running on NonStop using ksh, t0000.1 has never
> failed. I think the situation is subtly different from what we are solving.
> My take is that there is a difference in the local vs. non-local variable
> set semantic, rather than just accepting the keyword. I would propose that
> we need a more comprehensive local test to verify the actual expected
> semantics rather than just testing the syntax.
It is possible that I may be misreading that first test, but as far
as I can tell, it is testing not just the syntax but tests how the
variables declared "local" behaves and should notice if they are not
localized. It checks that "local" assignments in try_local_xy does
take effect, and (more importantly) after try_local_xy returns, the
original values are restored.
As I speculated earlier in an earlier message, the breakage you
reported may have to do with interaction between "local" and use of
a subshell, and perhaps we can also check that pattern in the test.
Thanks.
^ permalink raw reply [flat|nested] 18+ messages in thread
* RE: [Test Breakage 2.46.0-rc0] Test t0021.35 fails on NonStop
2024-07-15 16:41 ` Junio C Hamano
@ 2024-07-15 17:39 ` rsbecker
2024-07-15 18:33 ` Junio C Hamano
0 siblings, 1 reply; 18+ messages in thread
From: rsbecker @ 2024-07-15 17:39 UTC (permalink / raw)
To: 'Junio C Hamano'; +Cc: 'brian m. carlson', git
On Monday, July 15, 2024 12:42 PM, Junio C Hamano wrote:
><rsbecker@nexbridge.com> writes:
>
>> What is strange is that when running on NonStop using ksh, t0000.1 has
>> never failed. I think the situation is subtly different from what we are
solving.
>> My take is that there is a difference in the local vs. non-local
>> variable set semantic, rather than just accepting the keyword. I would
>> propose that we need a more comprehensive local test to verify the
>> actual expected semantics rather than just testing the syntax.
>
>It is possible that I may be misreading that first test, but as far as I
can tell, it is
>testing not just the syntax but tests how the variables declared "local"
behaves and
>should notice if they are not localized. It checks that "local"
assignments in
>try_local_xy does take effect, and (more importantly) after try_local_xy
returns, the
>original values are restored.
>
>As I speculated earlier in an earlier message, the breakage you reported
may have to
>do with interaction between "local" and use of a subshell, and perhaps we
can also
>check that pattern in the test.
That is that I am also suggesting but did not say it as precisely. Thanks.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Test Breakage 2.46.0-rc0] Test t0021.35 fails on NonStop
2024-07-15 17:39 ` rsbecker
@ 2024-07-15 18:33 ` Junio C Hamano
2024-07-15 19:03 ` rsbecker
0 siblings, 1 reply; 18+ messages in thread
From: Junio C Hamano @ 2024-07-15 18:33 UTC (permalink / raw)
To: rsbecker; +Cc: 'brian m. carlson', git
<rsbecker@nexbridge.com> writes:
>>As I speculated earlier in an earlier message, the breakage you reported
> may have to
>>do with interaction between "local" and use of a subshell, and perhaps we
> can also
>>check that pattern in the test.
>
> That is that I am also suggesting but did not say it as precisely. Thanks.
Oh, I see. Are you volunteering to come up with a minimum addition
to t0000.1 then?
Thanks.
^ permalink raw reply [flat|nested] 18+ messages in thread
* RE: [Test Breakage 2.46.0-rc0] Test t0021.35 fails on NonStop
2024-07-15 18:33 ` Junio C Hamano
@ 2024-07-15 19:03 ` rsbecker
0 siblings, 0 replies; 18+ messages in thread
From: rsbecker @ 2024-07-15 19:03 UTC (permalink / raw)
To: 'Junio C Hamano'; +Cc: 'brian m. carlson', git
On Monday, July 15, 2024 2:34 PM, Junio C Hamano wrote:
><rsbecker@nexbridge.com> writes:
>
>>>As I speculated earlier in an earlier message, the breakage you
>>>reported
>> may have to
>>>do with interaction between "local" and use of a subshell, and perhaps
>>>we
>> can also
>>>check that pattern in the test.
>>
>> That is that I am also suggesting but did not say it as precisely.
Thanks.
>
>Oh, I see. Are you volunteering to come up with a minimum addition to
t0000.1
>then?
I'll have to give this some thought on the best way to verify local that
does not break the various other shells. I only have a limited set (ksh,
bash). Maybe someone with a linux system might be in a better position.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Test Breakage 2.46.0-rc0] Test t0021.35 fails on NonStop
2024-07-14 18:15 ` brian m. carlson
2024-07-14 18:28 ` rsbecker
@ 2024-07-15 15:05 ` Junio C Hamano
1 sibling, 0 replies; 18+ messages in thread
From: Junio C Hamano @ 2024-07-15 15:05 UTC (permalink / raw)
To: brian m. carlson; +Cc: rsbecker, git
"brian m. carlson" <sandals@crustytoothpaste.net> writes:
> I don't think this is the right approach. Every version of ksh
> _except_ AT&T ksh works just fine here. ... AT&T ksh is
> considering adding local in a newer version for this reason.
Thanks. That is nice to know, though unfortunately I didn't see
signs of them making much progress.
Let's not make or change any policy but just document what we found
to help the next person.
------ >8 ----------- >8 ----------- >8 ------
Subject: [PATCH] doc: note that AT&T ksh does not work with our test suite
The scripted Porcelain commands do not allow use of "local" because
it is not universally supported, but we use it liberally in our test
scripts, which means some POSIX compliant shells (like "ksh93") can
not be used to run our tests.
Document the status quo, to help the next person who gets perplexed
seeing our tests fail.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
Documentation/CodingGuidelines | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
index 1d92b2da03..94ca5cf7c0 100644
--- a/Documentation/CodingGuidelines
+++ b/Documentation/CodingGuidelines
@@ -185,8 +185,8 @@ For shell scripts specifically (not exhaustive):
- Even though "local" is not part of POSIX, we make heavy use of it
in our test suite. We do not use it in scripted Porcelains, and
- hopefully nobody starts using "local" before they are reimplemented
- in C ;-)
+ hopefully nobody starts using "local" before all shells that matter
+ support it (notably, ksh from AT&T Research does not support it yet).
- Some versions of shell do not understand "export variable=value",
so we write "variable=value" and then "export variable" on two
--
2.46.0-rc0-140-g824782812f
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [Test Breakage 2.46.0-rc0] Test t0021.35 fails on NonStop
2024-07-14 17:00 ` Junio C Hamano
2024-07-14 17:29 ` rsbecker
2024-07-14 18:15 ` brian m. carlson
@ 2024-07-14 21:27 ` Eric Sunshine
2 siblings, 0 replies; 18+ messages in thread
From: Eric Sunshine @ 2024-07-14 21:27 UTC (permalink / raw)
To: Junio C Hamano; +Cc: rsbecker, git
On Sun, Jul 14, 2024 at 1:00 PM Junio C Hamano <gitster@pobox.com> wrote:
> Subject: doc: guide to use of "local" shell language construct
>
> The scripted Porcelain commands do not allow use of "local" because
> it is not universally supported, but we use it liberally in our test
> scripts, which means some POSIX compliant shells (like "ksh93") can
> not be used to run our tests.
>
> Document the status quo, and hint that we might want to change the
> situation in the fiture.
s/fiture/future/
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
> diff --git c/Documentation/CodingGuidelines w/Documentation/CodingGuidelines
> @@ -186,7 +186,9 @@ For shell scripts specifically (not exhaustive):
> - Even though "local" is not part of POSIX, we make heavy use of it
> in our test suite. We do not use it in scripted Porcelains, and
> hopefully nobody starts using "local" before they are reimplemented
> - in C ;-)
> + in C ;-) Notably, ksh (not just reimplementations but the real one
> + from AT&T Research) does not support "local" and cannot be used,
> + which we might want to reconsider.
The last bit ("which we might want to reconsider") probably belongs in
the commit message rather than here in the actual documentation.
Saying "we might want to reconsider" doesn't help people new to the
project who are looking for guidance _today_.
> diff --git c/t/README w/t/README
> @@ -850,6 +850,14 @@ And here are the "don'ts:"
> + - Don't overuse "local"
> +
> + Because strictly POSIX-compliant shells do not have to support
> + "local", we avoid using it in our scripted Porcelain scripts, but
> + we have allowed use of "local" in test scripts. We may want to
> + reconsider this and rewrite our tests to also run on shells like
> + ksh93. Do not add new use of "local" unnecessarily.
Same comment regarding "We may want to reconsider..."; it probably
belongs in the commit message, not here.
^ permalink raw reply [flat|nested] 18+ messages in thread