Email List: Xaustin-review-lX
[All Lists]

Defect in XSH fopen

To: yyyyyyyyyyyyyyy@xxxxxxxxxxxxx
Subject: Defect in XSH fopen
From: yyyyyy@xxxxxxxxxxxxx
Date: Wed, 18 Feb 2004 09:26:10 GMT
        Defect report from : Andrew Josey , The Open Group

(Please direct followup comments direct to yyyyyyyyyyyyyy@xxxxxxxxxxxxx)

@ page 390 line 12624 section fopen objection {aj.fopen}

Problem:

Edition of Specification (Year): 2003

Defect code :  2. Omission

This relates to  POSIX.1-1990 section 8.2, Lines 193-197:

      "All functions specified in the C Standard as creating a file
      shall do so as if they called the creat() function with ... a
      value of S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH for
      the mode argument."

We do not have the requirement in the 2001/2003 edition.

We need another interpretation  request, since the
requirement is no longer in the standard. We need to consider what
is the best behavior for applications. 

I looked for C language functions affected and came up with
fopen/freopen/fdopen/ tmpfile. freopen/fdopen and tmpfile reference
fopen explicitly so adding wording for fopen, would handle
freopen/fdopen, tmpfile would need further text.


Action:

If standard developers agree produce an interpretation that states
"The standard does not speak to this issue, and as such
no conformance distinction can be made between alternative
implementations based on this. This is being referred to the
sponsor."

In a future revision make the following changes:

Add to the existing CX shaded block in fopen() which states:

"If mode is w, wb, a, ab, w+, wb+, w+b, a+, ab+, or a+b, and the file
did not previously exist, upon successful completion, the fopen()
function shall mark for update the st_atime, st_ctime, and st_mtime
fields of the file and the st_ctime and st_mtime fields of the parent
directory."

Add (also CX shaded):
"If mode is w, wb, a, ab, w+, wb+, w+b, a+, ab+, or a+b, and the
file did not previously exist, the fopen() function shall create a
file as if it called the creat() function with a value appropriate
for the /path/ argument interpreted from /filename/ and a value of
S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH for the mode argument"

A corresponding change is then also needed to tmpfile() to change

from:
"The file is opened as in fopen() for update (w+)"
to:
"The file is opened as in fopen() for update (w+), except implementations may 
restrict the permissions, either by clearing 
the file mode bits or setting them to the value S_IRUSR|S_IWUSR"



<Prev in Thread] Current Thread [Next in Thread>