Make tests usable with path with spaces
This is somewhat subtle:
The #RUN line in a littlecheck file will be run by a posix shell,
which means the substitutions will also be mangled by it.
Now, we *have* shell-quoted them, but unfortunately what we need is to
quote them for inside a pre-existing layer of quotes, e.g.
# RUN: fish -C 'set -g fish %fish'
here, %fish can't be replaced with `'path with spaces/fish'`, because
that ends up as
# RUN: fish -C 'set -g fish 'path with spaces/fish''
which is just broken.
So instead, we pass it as a variable to that fish:
# RUN: fish=%fish fish...
In addition, we need to not mangle the arguments in our test_driver.
For that, because we insist on posix shell, which has only one array,
and we source a file, we *need* to stop having that file use
arguments.
Which is okay - test_env.sh could previously be used to start a test,
and now it no longer can because that is test_*driver*.sh's job.
For the interactive tests, it's slightly different:
pexpect.spawn(foo) is sensitive to shell metacharacters like space.
So we shell-quote it.
But if you pass any args to pexpect.spawn, it no longer uses a shell,
and so we cannot shell-quote it.
There could be a better way to fix this?
2024-12-27 19:54:43 +00:00
|
|
|
# RUN: fish=%fish %fish %s
|
2017-03-26 05:25:33 +00:00
|
|
|
# Test the umask command. In particular the symbolic modes since they've been
|
|
|
|
# broken for four years (see issue #738) at the time I added these tests.
|
|
|
|
|
|
|
|
# Establish a base line umask.
|
|
|
|
umask 027
|
|
|
|
umask
|
|
|
|
echo umask var = $umask
|
|
|
|
umask -S
|
2020-03-16 18:48:43 +00:00
|
|
|
#CHECK: 0027
|
|
|
|
#CHECK: umask var = 0027
|
|
|
|
#CHECK: u=rwx,g=rx,o=
|
2017-03-26 05:25:33 +00:00
|
|
|
|
|
|
|
# Verify that an invalid umask is rejected
|
|
|
|
umask 1234
|
|
|
|
umask 228
|
|
|
|
umask 0282
|
2020-03-16 18:48:43 +00:00
|
|
|
#CHECKERR: umask: Invalid mask '1234'
|
|
|
|
#CHECKERR: umask: Invalid mask '228'
|
|
|
|
#CHECKERR: umask: Invalid mask '0282'
|
2017-03-26 05:25:33 +00:00
|
|
|
|
|
|
|
# Verify that symbolic modifications and output is correct.
|
|
|
|
#
|
|
|
|
# When I wrote these tests I based all of the results on the behavior of bash
|
|
|
|
# when executing identical commands. So if bash has a bug with the umask
|
|
|
|
# command it's possible fish will as well. However, I did verify the result of
|
|
|
|
# each interaction and did not find any bugs in how bash or fish handled these
|
|
|
|
# scenarios.
|
|
|
|
#
|
|
|
|
umask 0777
|
|
|
|
umask a-r
|
|
|
|
umask
|
|
|
|
umask -S
|
2020-03-16 18:48:43 +00:00
|
|
|
#CHECK: 0777
|
|
|
|
#CHECK: u=,g=,o=
|
2017-03-26 05:25:33 +00:00
|
|
|
|
|
|
|
umask 0777
|
|
|
|
umask u+x
|
|
|
|
umask
|
|
|
|
umask -S
|
2020-03-16 18:48:43 +00:00
|
|
|
#CHECK: 0677
|
|
|
|
#CHECK: u=x,g=,o=
|
2017-03-26 05:25:33 +00:00
|
|
|
|
|
|
|
umask 777
|
|
|
|
umask g+rwx,o+x
|
|
|
|
umask
|
|
|
|
umask -S
|
2020-03-16 18:48:43 +00:00
|
|
|
#CHECK: 0706
|
|
|
|
#CHECK: u=,g=rwx,o=x
|
2017-03-26 05:25:33 +00:00
|
|
|
|
|
|
|
umask 0
|
|
|
|
umask u-w,o-x
|
|
|
|
umask
|
|
|
|
umask -S
|
2020-03-16 18:48:43 +00:00
|
|
|
#CHECK: 0201
|
|
|
|
#CHECK: u=rx,g=rwx,o=rw
|
2017-03-26 05:25:33 +00:00
|
|
|
|
|
|
|
umask 0
|
|
|
|
umask a-r
|
|
|
|
umask
|
|
|
|
umask -S
|
2020-03-16 18:48:43 +00:00
|
|
|
#CHECK: 0444
|
|
|
|
#CHECK: u=wx,g=wx,o=wx
|
2017-03-26 05:25:33 +00:00
|
|
|
|
|
|
|
umask 0
|
|
|
|
umask ug-rx
|
|
|
|
umask
|
|
|
|
umask -S
|
2020-03-16 18:48:43 +00:00
|
|
|
#CHECK: 0550
|
|
|
|
#CHECK: u=w,g=w,o=rwx
|
2017-03-26 05:25:33 +00:00
|
|
|
|
|
|
|
umask 777
|
|
|
|
umask u+r,g+w,o=rw
|
|
|
|
umask
|
|
|
|
umask -S
|
2020-03-16 18:48:43 +00:00
|
|
|
#CHECK: 0351
|
|
|
|
#CHECK: u=r,g=w,o=rw
|
2017-03-26 05:25:33 +00:00
|
|
|
|
|
|
|
umask 777
|
|
|
|
umask =r,g+w,o+x,o-r
|
|
|
|
umask
|
|
|
|
umask -S
|
2020-03-16 18:48:43 +00:00
|
|
|
#CHECK: 0316
|
|
|
|
#CHECK: u=r,g=rw,o=x
|
2017-03-26 05:25:33 +00:00
|
|
|
|
|
|
|
umask 0
|
|
|
|
umask rx
|
|
|
|
umask
|
|
|
|
umask -S
|
2020-03-16 18:48:43 +00:00
|
|
|
#CHECK: 0222
|
|
|
|
#CHECK: u=rx,g=rx,o=rx
|
2023-12-31 18:36:42 +00:00
|
|
|
|
|
|
|
umask u=rwx,g=rwx,o=
|
|
|
|
umask
|
|
|
|
#CHECK: 0007
|
|
|
|
umask u=rwx,g=,o=rwx
|
|
|
|
umask
|
|
|
|
#CHECK: 0070
|