Use of the information contained in this unapproved document is at your own risk
.Last update: 20 April,2001
1003.2-92 #68
_____________________________________________________________________________
Interpretation Number: XXXX
Topic: cp pathname arguments
Relevant Sections: 2.13.1
Interpretation Request: (Defect Report)
-----------------------
-----------------------
Dear Standards Board,
I would like to an request official, binding interpretation
from the IEEE concerning the following point in IEEE Std
1003.2-1992 (POSIX.2).
POSIX.2 defines pathname resolution by reference to POSIX.1
(IEEE Std 1003.1-1990), and specifically refers to the definition
of PATH_MAX in POSIX.1 (see subclauses 2.2.2.121, 2.2.2.123 and
2.13.1 of POSIX.2). Those utilities specified in POSIX.2 that
take pathname arguments are required to be able to resolve
pathnames that (including an implied trailing null byte) are
no more than PATH_MAX bytes in length, assuming no other system
resource limits arise.
The issue I would like resolved has to do with files that are
implicitly referenced by utilities with pathnames that are
longer than PATH_MAX. Specifically, consider the command line
cp <filename> <dirname>
where <dirname> is a pathname of length PATH_MAX-1 that refers to
a directory, and <filename> names a regular file. The semantics
of the cp utility require that (assuming no access or permission
issues interfere) cp create a copy of <filename> in <dirname>.
No pathname argument exceeds PATH_MAX-1 bytes, However, this
command implies a pathname of the target file, <dirname>/<filename>,
that exceeds PATH_MAX bytes. The reference is somewhat more than
implicit, since the description of cp (POSIX.2 subclause 4.13.2,
lines 2589-2591) states
The cp utility shall copy the contents of each source_file
to the destination path named by the concatenation of
target, a slash character and the last component of
source_file.
Is cp required to work in this case?
Note that a similar question can be asked with respect to the
mv and ln utilities and perhaps others.
Thank you for your attention to this matter.
IEEE Interpretation for 1003.2-1992
-----------------------------------
The wording in cp as specified in this interpretation
request clearly allows an implementation of cp to call open with the
pathname created by concatenating dirname, slash("/"), and filename and
in cases where this string is resulted longer than PATH_MAX there is no
requirement that this should succeed.
Rationale for Interpretation:
-----------------------------
None.
_____________________________________________________________________________