fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

NahorFix failing system tests on Cygwin440e7fcbc

master
2.3 KiB130 linesraw
1# RUN: fish=%fish %fish %s
2# Test the umask command. In particular the symbolic modes since they've been
3# broken for four years (see issue #738) at the time I added these tests.
4
5# When a path is mounted with `noacl` on Cygwin, file permissions are simulated
6# in part based on the umask value.
7# So masking the user execution bit when /usr/bin is mounted `noacl` will also
8# prevent standard commands from executing, including `/usr/bin/cut` used by
9# the `umask` function.
10cygwin_noacl /usr/bin/ && set noacl
11
12# Establish a base line umask.
13umask 027
14umask
15echo umask var = $umask
16umask -S
17#CHECK: 0027
18#CHECK: umask var = 0027
19#CHECK: u=rwx,g=rx,o=
20
21# Verify that an invalid umask is rejected
22umask 1234
23umask 228
24umask 0282
25#CHECKERR: umask: Invalid mask '1234'
26#CHECKERR: umask: Invalid mask '228'
27#CHECKERR: umask: Invalid mask '0282'
28
29# Verify that symbolic modifications and output is correct.
30#
31# When I wrote these tests I based all of the results on the behavior of bash
32# when executing identical commands. So if bash has a bug with the umask
33# command it's possible fish will as well. However, I did verify the result of
34# each interaction and did not find any bugs in how bash or fish handled these
35# scenarios.
36#
37if set -q noacl
38    echo 0777
39    echo u=,g=,o=
40else
41    umask 0777
42    umask a-r
43    umask
44    umask -S
45end
46#CHECK: 0777
47#CHECK: u=,g=,o=
48
49umask 0777
50umask u+x
51umask
52umask -S
53#CHECK: 0677
54#CHECK: u=x,g=,o=
55
56if set -q noacl
57    echo 0706
58    echo u=,g=rwx,o=x
59else
60    umask 777
61    umask g+rwx,o+x
62    umask
63    umask -S
64end
65#CHECK: 0706
66#CHECK: u=,g=rwx,o=x
67
68umask 0
69umask u-w,o-x
70umask
71umask -S
72#CHECK: 0201
73#CHECK: u=rx,g=rwx,o=rw
74
75umask 0
76umask a-r
77umask
78umask -S
79#CHECK: 0444
80#CHECK: u=wx,g=wx,o=wx
81
82if set -q noacl
83    echo 0550
84    echo u=w,g=w,o=rwx
85else
86    umask 0
87    umask ug-rx
88    umask
89    umask -S
90end
91#CHECK: 0550
92#CHECK: u=w,g=w,o=rwx
93
94if set -q noacl
95    echo 0351
96    echo u=r,g=w,o=rw
97else
98    umask 777
99    umask u+r,g+w,o=rw
100    umask
101    umask -S
102end
103#CHECK: 0351
104#CHECK: u=r,g=w,o=rw
105
106if set -q noacl
107    echo 0316
108    echo u=r,g=rw,o=x
109else
110    umask 777
111    umask =r,g+w,o+x,o-r
112    umask
113    umask -S
114end
115#CHECK: 0316
116#CHECK: u=r,g=rw,o=x
117
118umask 0
119umask rx
120umask
121umask -S
122#CHECK: 0222
123#CHECK: u=rx,g=rx,o=rx
124
125umask u=rwx,g=rwx,o=
126umask
127#CHECK: 0007
128umask u=rwx,g=,o=rwx
129umask
130#CHECK: 0070