WG15 Defect Report Ref: 9945-2-67
Topic: mkdir -m mode

This is an approved interpretation of 9945-2:1993.


Last update: 1997-05-20



	Topic:			mkdir -m mode
	Relevant Sections:	4.41

Defect Report:
This problem was encountered while using the POSIX.2 Commands test

Should mkdir -m mode utilize the current umask in setting permissions?
I would propose that it does not.

The test assertion in 2003.2 Draft 9 say it should based on the 
DESCRIPTION for mkdir which says it "shall perform actions equivalent 
to the POSIX.1 mkdir()"

However, existing practise in System V (on which the rationale
says this option was added) is to set the permission to the explict
value specified by the mode argument to -m; and the text in lines
6950-6956 state that "The mode option-argument  shall be the same as
the mode operand defined for the chmod utility". The chmod utility
ignores the umask.

So for an example, say

$ umask 22
$ mkdir -m 456 foodir
$ ls -ld

gives (on System V)

dr--r-xrw-    2 andrew   relx         512 Jul  1 04:29 foodir    

whereas the 2003.2 draft wants

dr--r-xr--    2 andrew   relx         512 Jul  1 04:29 foodir    

The System V behaviour seems more inituitive as a user, and usage has 
been to, in a single command set the mode explicitly with the -m option,
rather than call umask followed by mkdir -m xxx.

My understanding of the rationale text lines 7184-7187 "For example,
by default, the mode of the directory is affected by the file mode
creation mask" is that this does not apply to the -m case, which
is not the default.

WG15 response for 9945-2:1993 

The standard is unclear on this issue, and no conformance distinction can
be made between alternative implementations based on this.  This is being
referred to the sponsor.

Rationale for Interpretation: