1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
| |
%prep
if ! zmodload zsh/rlimits 2>/dev/null
then
ZTST_unimplemented="the zsh/rlimits module was disabled by configure (see config.modules)"
return 0
fi
zmodload zsh/rlimits
%test
limit | grep UNKNOWN || print OK
0:Check if there is unknown resouce(s) in the system
>OK
F:A failure here does not indicate any error in zsh. It just means there
F:is a resource in your system that is unknown to zsh developers. Please
F:report this to zsh-workers mailing list.
() {
set -- ${(f)"$(ulimit -a)"}
set -- ${@%%:*}
typeset -aU unique_options=( "$@" )
# The value of $unique_options is, e.g., ( -t -f '-N 2' -s ... ).
(( $# == $#unique_options ))
}
0:check if limit option letters are unique
if sh -c 'ulimit -f 2048' > /dev/null 2>&1; then
(
set -o braceccl -o pipefail
list=(1b 1{kmgtpe}{,b,ib})
for cmd in "limit filesize" ulimit; do
for l in $list $list:u; do
$=cmd $l &&
limit filesize &&
ulimit || exit
done
done | sed 'N;s/\n/ /;s/ */ /g'
)
else
ZTST_skip='Cannot set the filesize limit on this system'
fi
0:filesize suffixes with limit and ulimit
>filesize 1B 0
>filesize 1EiB 2251799813685248
>filesize 976562500000000KiB 1953125000000000
>filesize 1EiB 2251799813685248
>filesize 1GiB 2097152
>filesize 1000000000B 1953125
>filesize 1GiB 2097152
>filesize 1KiB 2
>filesize 1000B 1
>filesize 1KiB 2
>filesize 1MiB 2048
>filesize 1000000B 1953
>filesize 1MiB 2048
>filesize 1PiB 2199023255552
>filesize 976562500000KiB 1953125000000
>filesize 1PiB 2199023255552
>filesize 1TiB 2147483648
>filesize 976562500KiB 1953125000
>filesize 1TiB 2147483648
>filesize 1B 0
>filesize 1EiB 2251799813685248
>filesize 976562500000000KiB 1953125000000000
>filesize 1EiB 2251799813685248
>filesize 1GiB 2097152
>filesize 1000000000B 1953125
>filesize 1GiB 2097152
>filesize 1KiB 2
>filesize 1000B 1
>filesize 1KiB 2
>filesize 1MiB 2048
>filesize 1000000B 1953
>filesize 1MiB 2048
>filesize 1PiB 2199023255552
>filesize 976562500000KiB 1953125000000
>filesize 1PiB 2199023255552
>filesize 1TiB 2147483648
>filesize 976562500KiB 1953125000
>filesize 1TiB 2147483648
>filesize 1B 0
>filesize 1EiB 2251799813685248
>filesize 976562500000000KiB 1953125000000000
>filesize 1EiB 2251799813685248
>filesize 1GiB 2097152
>filesize 1000000000B 1953125
>filesize 1GiB 2097152
>filesize 1KiB 2
>filesize 1000B 1
>filesize 1KiB 2
>filesize 1MiB 2048
>filesize 1000000B 1953
>filesize 1MiB 2048
>filesize 1PiB 2199023255552
>filesize 976562500000KiB 1953125000000
>filesize 1PiB 2199023255552
>filesize 1TiB 2147483648
>filesize 976562500KiB 1953125000
>filesize 1TiB 2147483648
>filesize 1B 0
>filesize 1EiB 2251799813685248
>filesize 976562500000000KiB 1953125000000000
>filesize 1EiB 2251799813685248
>filesize 1GiB 2097152
>filesize 1000000000B 1953125
>filesize 1GiB 2097152
>filesize 1KiB 2
>filesize 1000B 1
>filesize 1KiB 2
>filesize 1MiB 2048
>filesize 1000000B 1953
>filesize 1MiB 2048
>filesize 1PiB 2199023255552
>filesize 976562500000KiB 1953125000000
>filesize 1PiB 2199023255552
>filesize 1TiB 2147483648
>filesize 976562500KiB 1953125000
>filesize 1TiB 2147483648
if sh -c 'ulimit -t 3600' > /dev/null 2>&1; then
(
set -o pipefail
list=(1h 30m 20s 30 1:23:45.123456 2:23 56.4)
for cmd in "limit cputime" "ulimit -t"; do
for l in $list ${(MU)list:#*[a-z]*}; do
$=cmd $l &&
limit cputime &&
ulimit -t || exit
done
done | sed 'N;s/\n/ /;s/ */ /g'
)
else
ZTST_skip='Cannot set the cputime limit on this system'
fi
0:time limit formats
>cputime 1:00:00 3600
>cputime 0:30:00 1800
>cputime 0:00:20 20
>cputime 0:00:30 30
>cputime 1:23:45 5025
>cputime 0:02:23 143
>cputime 0:00:56 56
>cputime 1:00:00 3600
>cputime 0:30:00 1800
>cputime 0:00:20 20
>cputime 1:00:00 3600
>cputime 0:30:00 1800
>cputime 0:00:20 20
>cputime 0:00:30 30
>cputime 1:23:45 5025
>cputime 0:02:23 143
>cputime 0:00:56 56
>cputime 1:00:00 3600
>cputime 0:30:00 1800
>cputime 0:00:20 20
ulimit 1Kite
ulimit 1D
ulimit 1s
ulimit 1MBA
limit cputime 1k
limit cputime 1:0s
limit cputime 1ss
limit cputime 1msx
limit cputime 1.0s
limit cputime .1
limit descriptors 1k
limit descriptors 1h
limit descriptors 1:0
1:invalid limit input
?(eval):ulimit:1: 1Kite: invalid unit
?(eval):ulimit:2: 1D: invalid unit
?(eval):ulimit:3: 1s: invalid unit
?(eval):ulimit:4: 1MBA: invalid unit
?(eval):limit:5: 1k: invalid time specification
?(eval):limit:6: 1:0s: invalid time specification
?(eval):limit:7: 1ss: invalid time specification
?(eval):limit:8: 1msx: invalid time specification
?(eval):limit:9: 1.0s: invalid time specification
?(eval):limit:10: .1: decimal integer expected
?(eval):limit:11: 1k: limit must be a decimal integer
?(eval):limit:12: 1h: limit must be a decimal integer
?(eval):limit:13: 1:0: limit must be a decimal integer
|