blob: 7ae0f9b214d838de499a7e36580b89b2c0a3d8d7 (
plain)
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
|
(load "../common")
(load "../perm")
(defvarl tgt [*args* 0])
(defmacro mode-bits (st-mode)
(logand st-mode #xFFF))
(defun cht (init mode expected)
(let ((ini (dec-perm init))
(exp (dec-perm expected)))
(chmod tgt ini)
(let* ((st (stat tgt))
(m (logand st.mode #xFFF)))
(unless (eql m ini)
(error "failed to set initial mode: expected: ~s, actual: ~s "
init (enc-perm m))))
(chmod tgt mode)
(let* ((st (stat tgt))
(m (logand st.mode #xFFF)))
(unless (eql m exp)
(error "failed to set mode: expected ~s, actual ~s"
expected (enc-perm m))))))
(remove-path tgt)
(with-stream (s (open-file tgt "w")))
(umask #o022)
(cht "------------" "a+strwx" "sgtrwxrwxrwx")
(cht "------------" "+strwx" "sgtrwxr-xr-x")
(cht "------------" "u+s" "s-----------")
(cht "------------" "g+s" "-g----------")
(cht "------------" "+t" "--t---------")
(cht "sgtrwxrwxrwx" "=" "------------")
|