~sircmpwn/ctools

53a217a9735565e479f131ad58345454ecf4ce5a — Sebastian 3 years ago fbf17d9
Fix chmod symbolic who symbols

Fixes ticket #5: https://todo.sr.ht/~sircmpwn/ctools/5

The bavhior of the who symbols `u` and `o` has been switched to conform
to the POSIX specification.

Signed-off-by: Sebastian <sebastian@sebsite.pw>
2 files changed, 3 insertions(+), 3 deletions(-)

M src/chmod.c
M test/chmod
M src/chmod.c => src/chmod.c +2 -2
@@ 136,13 136,13 @@ symbolic_mode(char *sym, mode_t *mode, enum mode_operation *op, bool *all_x)
		bool other = false;
		switch (sym[i]) {
		case 'u':
			who |= 0007;
			who |= 0700;
			break;
		case 'g':
			who |= 0070;
			break;
		case 'o':
			who |= 0700;
			who |= 0007;
			break;
		case 'a':
			who |= 0777;

M test/chmod => test/chmod +1 -1
@@ 65,7 65,7 @@ should_handle_syms() (
	cat "$TMPDIR"/map | while read testcase
	do
		mask=7
		for who in u:7 g:70 o:700 ug:77 uo:707 go:770 ugo:777
		for who in u:700 g:70 o:7 ug:770 uo:707 go:077 ugo:777
		do
			mask=$(echo "$who" | cut -d: -f2)
			mask=$(octtodec $mask)