Re: [Test Breakage 2.46.0-rc0] Test t0021.35 fails on NonStop

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



<rsbecker@xxxxxxxxxxxxx> 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)?




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux