Cygwin files and devices philosophy

Jason Curl j.m.curl@optusnet.com.au
Sat Nov 27 17:54:00 GMT 2004


Hello,

I have a general question for the developers of cygwin.

When I open the file "\\.\COM37" this is not opened by cygwin as a 
serial port, but rather as a file. The reasoning (that I'm not 
disputing) is cygwin should have more of a posix/unix flavour. And so 
specific functionality to treat this as a COM port was removed.

So what "should ideally" happen when I open the file?

1. The file should be opened and no error

2. The file should be rejected by cygwin, as the paths don't look "posix".

If we take 1, it makes the rules simpler. Maybe this was provided 
because we really do want to open this and get a handle. Maybe we want 
to open a network device instead of a hardware device (which has similar 
sematics).

For point 2, this might be considered valid because the path is not 
POSIX and may confuse programs where the file to open is part of a 
command line argument.

In my case, I provide an option for a terminal program what device 
should be used to open the file. I don't want to restrict what devices 
are or are not allowed, except by using function calls to the Posix API 
to determine if the required functionality can be met.

However, if a user passes '\\.\COM37' it opens, isatty() is successful 
and my software hangs. Should it be up to my program to filter out nasty 
devices, or the underlying API? Needless to say, that this file doesn't 
behave as a tty because the fhandler_disk functions are being used. But 
other functions that I would expect to fail, don't.

I ask, so that I may understand in what direction cygwin developers 
prefer so I can modify my software in the appropriate way. I'd like it 
not to have any specific knowledge of cygwin, but it will if need be.

Could something of this nature lead to a security vulnerability in cygwin?


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list