[Patch]: NUL and other special names

Pierre A. Humblet pierre@phumblet.no-ip.org
Thu Jun 3 20:56:00 GMT 2004

Igor Pechtchanski wrote:
> On Thu, 3 Jun 2004, Pierre A. Humblet wrote:
> > David Fritz wrote:
> >
> > [snip]
> > > Also, from the patch:
> > >
> > >           /* COM and LPT must be followed by a single digit */
> > >
> > > The code in src/winsup/cygwin/devices.cc would seem to indicate that
> > > the number is not limited to a single digit.
> >
> > From my tests that's the behavior on 9x, so it's appropriate code for
> > managed mounts.
> >
> > Today on the list Igor indicated that PRN would soon regain its old
> > behavior.  My patch was more modest, just forbid using PRN (and creating
> > a hard to delete file).
> >
> > Do we want to do what Igor suggested, although it's not Posix?
> > Pierre
> Well, if you intend to forbid the use of PRN, NUL, LPT*, COM*, etc, you
> should probably modify the User's Guide section on DOS devices
> <http://cygwin.com/cygwin-ug-net/using-specialnames.html#AEN796>, which
> explicitly states that the previous behavior is allowed/expected.
> IMO, either the names should be special DOS devices (and allow full
> functionality), or they should be non-special names that are treated just
> like any other files (e.g., allowing the "aux" directory, etc).  The prior
> choice follows the principle of least surprise; the latter may eliminate
> the need for managed mounts (eventually).
>         Igor

I was going to suggest making it a non-special name (on NT only,
so there is still a surprise effect)
That's easy, just prefix the path with //./ or //./unc/
But it's getting costly because we would need to:
- detect that the path is special initially, and each time a symlink is met
  (the outer loop of ::check)
- process the mount table normally during the inner loop of ::check
  and prefix as needed with //./ or //./unc/ (if not already there). 
Also that can push a path length past the limit.

That doesn't help for the lower/upper case issue.

Not sure if it's worth it.


More information about the Cygwin-patches mailing list