[Rd] minor omissions re "special" windows file names (PR#9622)

tplate at acm.org tplate at acm.org
Thu Apr 19 06:08:34 CEST 2007


"lpt1" through "lpt9" and "com1" through "com9"  are in fact "special" 
file names under various versions of Microsoft Windows.  However, "R 
Extensions" says only that "lpt1" through "lpt4" and "com1" through 
"com3" cannot be used as filenames, and "R CMD check" checks for just 
these filenames.  Consequently, "R CMD check" can let through filenames 
that are disallowed under Windows.

For references, see http://en.wikipedia.org/wiki/Filename and 
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/naming_a_file.asp
(FWIW, note however that Wikipedia *may* be mistaken in claiming that 
"com0" and "lpt0" are special file names -- these are not listed on the 
Microsoft page, and I verified that they can be used as normal file 
names on my Windows XP machine at least.)

Accordingly, the following changes might be desired:

In src/scripts/check.in:
OLD LINE:
          if(grep(/^(con|prn|aux|clock\$|nul|lpt[1-3]|com[1-4])$/,
NEW LINE:
         if(grep(/^(con|prn|aux|clock\$|nul|lpt[1-9]|com[1-9])$/,
ALSO: fix comment at beginning of check.in (search for "com1")

In doc/manuals/R-exts.texi, I would suggest changing
-----
names.  In addition, files with names @samp{con}, @samp{prn},
@samp{aux}, @samp{clock$}, @samp{nul}, @samp{com1} to @samp{com4}, and
@samp{lpt1} to @samp{lpt3} after conversion to lower case and stripping
possible ``extensions'', are disallowed.  Also, file names in the same
-----
to
-----
names.  In addition, files with names @samp{con}, @samp{prn},
@samp{aux}, @samp{clock$}, @samp{nul}, @samp{com1} to @samp{com9}, and
@samp{lpt1} to @samp{lpt9} after conversion to lower case and stripping
possible ``extensions'', are disallowed
(e.g., @samp{lpt5.foo.bar} is disallowed.)  Also, file names in the same
-----

(with the example added to clarify what "stripping possible extensions" 
means).

Obviously, not a high-priority error.

-- Tony Plate



More information about the R-devel mailing list