Does This Scare You?

Jon Ribbens jon+usenet at unequivocal.eu
Fri Aug 26 07:28:54 EDT 2016


On 2016-08-24, Chris Angelico <rosuav at gmail.com> wrote:
> On Thu, Aug 25, 2016 at 7:00 AM, eryk sun <eryksun at gmail.com> wrote:
>> I discovered why "Logs/con.txt" isn't working right in Windows 7,
>> while "Logs/nul.txt" does get redirected correctly to r"\\.\nul".
>> Prior to Windows 8 the console doesn't use an NT device, so the base
>> API has a function named BaseIsThisAConsoleName that looks for names
>> such as r"\\.CON", r"\\.CONIN$", "CON", or r"C:\Temp\con.txt" and
>> returns either "CONIN$" or "CONOUT$" if there's a match. A match for
>> just "CON" maps to one or the other of the latter depending on whether
>> read or write access is desired.
>
> See? This is why *even after I tested it* I wasn't sure I was right!
> The rules are... complicated.

Hence my doubts about this function - it has almost no chance of not
being broken, potentially leading to whatever code was using it having
security holes. Perhaps it should be deprecated or at least attract a
large caveat in the documentation.



More information about the Python-list mailing list