From: <rsbecker@nexbridge.com>
To: "'Junio C Hamano'" <gitster@pobox.com>
Cc: <git@vger.kernel.org>
Subject: RE: [Test Breakage 2.46.0-rc0] Test t0021.35 fails on NonStop
Date: Sun, 14 Jul 2024 09:29:41 -0400 [thread overview]
Message-ID: <001f01dad5f1$e518e6e0$af4ab4a0$@nexbridge.com> (raw)
In-Reply-To: <xmqq8qy4adl4.fsf@gitster.g>
On Saturday, July 13, 2024 10:54 PM, Junio C Hamano wrote:
><rsbecker@nexbridge.com> writes:
>
>> ok 34 # skip delayed checkout shows progress by default on tty
>> (pathspec
>> checkout) (missing TTY of PERL,TTY)
>>
>> expecting success of 0021.35 'delayed checkout ommits progress on
>> non-tty (pathspec checkout)':
>> test_delayed_checkout_progress ! git checkout $opt
>>
>> + test_delayed_checkout_progress ! git checkout .
>> test_delayed_checkout_progress: test: argument expected
>
>This "test: argument expected" is curious.
>
>The shell function reads like so and it hasn't changed since
>7a132c62 (checkout: make delayed checkout respect --quiet and
--no-progress,
>2021-08-26) introduced it, and there are 3 uses of "test" builtin function.
>
> test_delayed_checkout_progress () {
> if test "$1" = "!"
> then
> local expect_progress=N &&
> shift
> else
> local expect_progress=
> fi &&
>
> if test $# -lt 1
> then
> BUG "no command given to
test_delayed_checkout_progress"
> fi &&
>
> (
> cd progress &&
> GIT_PROGRESS_DELAY=0 &&
> export GIT_PROGRESS_DELAY &&
> rm -f *.a delay-progress.log &&
>
> "$@" 2>err &&
> grep "IN: smudge test-delay10.a .* \\[DELAYED\\]"
delay-progress.log
>&&
> if test "$expect_progress" = N
> then
> ! grep "Filtering content" err
> else
> grep "Filtering content" err
> fi
> )
> }
>
>I do not see how any of these tests can be fed a list of zero or more
argument that
>causes it to barf with "argument expected", when
>
> test_delayed_checkout_progress ! git checkout .
>
>is run. The first "are we negated?" test gets
>
> test "!" = "!"
>
>and shifts that "!" away, the second test that checks the number of
arguments do
>not need any extra quoting (in other words, $# can never be an empty
string, so
>
> test $# -lt 1
>
>cannot become "test -lt 1" that would barf, like so:
>
> $ ksh -c 'test -lt 1'
> ksh: test: argument expected
>
>And whether expect_progress gets an empty string or N (we should have got N
in
>there, if the shell is so broken that the first comparison between "!" and
"!" were
>botched and the variable got assigned an empty string, or "local" were
botched and
>the variable were somehow left uninitialized, expect_progress could be a
value we
>do not expect), the last test to switch between !grep and grep can never
break like
>so:
>
> $ ksh -c 'test = N'
> ksh: test: argument expected
>
>because $expect_progress is inside a pair of double quotes.
>
>In the above "thinking out aloud", I invoked ksh because bash and dash
gives
>different error messages.
>
>Another remotely curious thing is that I am not sure how "local" in the
outer shell
>influences the use of the variable in the subshell
>(read: now I am speculating if the above code uses some constructs that are
so
>tricky to implement correctly and an unfortunate bug gets triggered in your
shell),
>but even if such a bug caused a nonsense value to be assigned to
$expect_progress,
>I do not see how it can cause "test" to barf with "argument expected".
>
>So, I am not sure what is going on at all.
>
>In any case, this does not sound anything recent. Do you know that this
used to
>work in previous releases? Could this be caused by changes in your
environment
>(like which shell is used)?
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.
Thanks for looking.
--Randall
next prev parent reply other threads:[~2024-07-14 13:29 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-13 16:38 [Test Breakage 2.46.0-rc0] Test t0021.35 fails on NonStop rsbecker
2024-07-14 2:53 ` Junio C Hamano
2024-07-14 13:29 ` rsbecker [this message]
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-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
2024-07-15 16:41 ` Junio C Hamano
2024-07-15 17:39 ` rsbecker
2024-07-15 18:33 ` Junio C Hamano
2024-07-15 19:03 ` rsbecker
2024-07-15 15:05 ` Junio C Hamano
2024-07-14 21:27 ` Eric Sunshine
2024-07-14 13:58 ` rsbecker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='001f01dad5f1$e518e6e0$af4ab4a0$@nexbridge.com' \
--to=rsbecker@nexbridge.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).