This lets littlecheck "diff" the given output with the checks, leading
to easier to understand errors.
E.g. changing some random lines in andandoror.fish yields error output
like:
```
Testing file checks/andandoror.fish ... Failure:
The CHECK on line 36 wants:
if test 4 ok
which failed to match line stdout:9:
if test 3 ok
Context:
[...] from line 17 (stdout:6):
true && false || true: 0
if test 1 ok
if test 2 ok
if test 3 ok <= no check matches this, previous check on line 35
if test 4 ok
0 0 0
1 1 1
2 2 2
3 3 3 <= does not match CHECK '3 5 3' on line 55
4 4 4
0
1
[...] from line 126 (stdout:33):
0
0
0
<= nothing to match CHECK 'banana' on line 135
when running command:
../test/root/bin/fish checks/andandoror.fish
```
This updates littlecheck to b9c24a3.
Use the `-d` parameter to `zfs list` to limit snapshots to the dataset
named in the current token being completed. Thanks to @Debilski for the
tip.
Closes#7472
This was using "/usr/local/bin/fish" for no good reason - 1. fish
might not be installed, 2. fish might not be installed *there*.
Just use /bin/sh in this case, if that doesn't exist we have bigger
problems, and this is just a simple wrapper for a command call.
[ci skip]
In #7459, asan printed error output. However, because we had a failure
on stdout already, littlecheck would only print the first unmatched
line from stderr, leading to output like
```
additional output on stderr:1:
=================================================================
```
Which is of course entirely useless.
So in that case we just let it print *all* unmatched stderr lines, so
you'd get the full asan output, which presumably is of more use.
This upgrades littlecheck to 5f7deafcea4e58dd3d369eae069a3781bb6ce75e.
Instead of using /tmp/fish as a temporary directory for this operation,
which could lead to clobbering user files, use mktemp to create an
actual temporary directory.
I *think* this might sometimes (on CI) be eating the prompt, so that the actual `prompt`
part of `expect_prompt` doesn't find anything.
On Github Actions we see things like:
```
Testing file pexpects/generic.py ... Failed to match pattern: prompt 5
generic.py:35: timeout from expect_prompt("echo .history.*")
[...]
OUTPUT +1.08 ms (Line 31): \rprompt 4>
INPUT +0.35 ms (Line 34): echo $history[1]\n
OUTPUT +1.58 ms (Line 35): echo $history[1]\r\necho $history[1]\r\n⏎ \r⏎ \r\rprompt 5>
```
so the prompt *is* printed, it's just not correctly matched.
Apparently on macOS SIGTSTP (from control-Z) causes `read()` to return
EINTR.
This means `cat | cat` will exit as soon as it's backgrounded and
brought back.
So instead we use `sleep`, which won't read(), and therefore is
impervious to these puny attacks.
See discussion in #7447.
The string "%ls is %ls", which is printed when `type <command>` is ran
for a command in PATH, couldn't be localized, since it was missing _()
around it.
Only generate the list of snapshots when
a) the argument must be a snapshot and nothing else, or
b) the argument as typed contains a literal @, or
c) a snapshot is a valid completion and there is only one dataset
matching the argument as entered.
Unfortunately, it seems the `zfs` command itself is extremely primitive
and doesn't support listing snapshots by dataset so when we need to
generate completions, we end up needing to enumerate all snapshots
(ever) across all datasets. I'd be very happy to be proven wrong, but I
think the only other way would be manually parse `zdb` output.
See #7472