1166065Spjd#!/bin/sh
2166065Spjd# $FreeBSD$
3166065Spjd
4166065Spjddesc="mkdir creates directories"
5166065Spjd
6166065Spjddir=`dirname $0`
7166065Spjd. ${dir}/../misc.sh
8166065Spjd
9166065Spjdecho "1..36"
10166065Spjd
11166065Spjdn0=`namegen`
12166065Spjdn1=`namegen`
13166065Spjd
14166065Spjdexpect 0 mkdir ${n1} 0755
15166065Spjdcdir=`pwd`
16166065Spjdcd ${n1}
17166065Spjd
18166232Spjd# POSIX: The file permission bits of the new directory shall be initialized from
19166232Spjd# mode. These file permission bits of the mode argument shall be modified by the
20166232Spjd# process' file creation mask.
21166065Spjdexpect 0 mkdir ${n0} 0755
22166065Spjdexpect dir,0755 lstat ${n0} type,mode
23166065Spjdexpect 0 rmdir ${n0}
24166065Spjdexpect 0 mkdir ${n0} 0151
25166065Spjdexpect dir,0151 lstat ${n0} type,mode
26166065Spjdexpect 0 rmdir ${n0}
27166065Spjdexpect 0 -U 077 mkdir ${n0} 0151
28166065Spjdexpect dir,0100 lstat ${n0} type,mode
29166065Spjdexpect 0 rmdir ${n0}
30166065Spjdexpect 0 -U 070 mkdir ${n0} 0345
31166065Spjdexpect dir,0305 lstat ${n0} type,mode
32166065Spjdexpect 0 rmdir ${n0}
33166065Spjdexpect 0 -U 0501 mkdir ${n0} 0345
34166065Spjdexpect dir,0244 lstat ${n0} type,mode
35166065Spjdexpect 0 rmdir ${n0}
36166065Spjd
37166232Spjd# POSIX: The directory's user ID shall be set to the process' effective user ID.
38166232Spjd# The directory's group ID shall be set to the group ID of the parent directory
39166232Spjd# or to the effective group ID of the process.
40166065Spjdexpect 0 chown . 65535 65535
41166065Spjdexpect 0 -u 65535 -g 65535 mkdir ${n0} 0755
42166065Spjdexpect 65535,65535 lstat ${n0} uid,gid
43166065Spjdexpect 0 rmdir ${n0}
44166065Spjdexpect 0 -u 65535 -g 65534 mkdir ${n0} 0755
45166232Spjdexpect "65535,6553[45]" lstat ${n0} uid,gid
46166065Spjdexpect 0 rmdir ${n0}
47166065Spjdexpect 0 chmod . 0777
48166065Spjdexpect 0 -u 65534 -g 65533 mkdir ${n0} 0755
49166232Spjdexpect "65534,6553[35]" lstat ${n0} uid,gid
50166065Spjdexpect 0 rmdir ${n0}
51166065Spjd
52166232Spjd# POSIX: Upon successful completion, mkdir() shall mark for update the st_atime,
53166232Spjd# st_ctime, and st_mtime fields of the directory. Also, the st_ctime and
54166232Spjd# st_mtime fields of the directory that contains the new entry shall be marked
55166232Spjd# for update.
56166065Spjdexpect 0 chown . 0 0
57166065Spjdtime=`${fstest} stat . ctime`
58166065Spjdsleep 1
59166065Spjdexpect 0 mkdir ${n0} 0755
60166065Spjdatime=`${fstest} stat ${n0} atime`
61166065Spjdtest_check $time -lt $atime
62166065Spjdmtime=`${fstest} stat ${n0} mtime`
63166065Spjdtest_check $time -lt $mtime
64166065Spjdctime=`${fstest} stat ${n0} ctime`
65166065Spjdtest_check $time -lt $ctime
66166065Spjdmtime=`${fstest} stat . mtime`
67166065Spjdtest_check $time -lt $mtime
68166065Spjdctime=`${fstest} stat . ctime`
69166065Spjdtest_check $time -lt $ctime
70166065Spjdexpect 0 rmdir ${n0}
71166065Spjd
72166065Spjdcd ${cdir}
73166065Spjdexpect 0 rmdir ${n1}
74