Ticket #2628 (new bug)

Opened 3 years ago

Last modified 10 months ago

hIsTerminalDevice returns True for /dev/null (aka NUL) on Windows

Reported by: igloo Owned by:
Priority: normal Milestone: _|_
Component: libraries/base Version: 6.8.3
Keywords: Cc:
Operating System: Windows Architecture: x86
Type of failure: None/Unknown Difficulty: Unknown
Test Case: 2228 Blocked By:
Blocking: Related Tickets:

Description

test 2228 is failing for me in an msys window on Windows:

-BlockBuffering Nothing
+LineBuffering
 BlockBuffering Nothing

because isatty behaves unexpectedly on mingw:

#include <stdio.h>
#include <unistd.h>

int main(void) {
    int i;
    i = fileno(stdin);
    printf("%d\n", i);
    i = fileno(stdout);
    printf("%d\n", i);
    i = isatty(0);
    printf("%d\n", i);
    i = isatty(1);
    printf("%d\n", i);
    return 0;
}
$ ./w            
0
1
0
0

$ ./w < /dev/null
0
1
64
0

Change History

Changed 3 years ago by igloo

  • milestone changed from 6.10.1 to 6.10.2

Changed 3 years ago by simonmar

  • summary changed from isatty behaves unexpectedly on mingw to hIsTerminalDevice returns True for /dev/null (aka NUL) on Windows
  • milestone changed from 6.10.2 to _|_

isatty does indeed return non-zero for NUL on Windows. In fact, GetFileType also returns FILE_TYPE_CHAR for NUL, so it seems hard to tell them apart.

I'm not planning to do anything about this except for marking the bug as an expected failure, it's a fairly rare corner-case.

Changed 10 months ago by batterseapower

  • failure set to None/Unknown

This test is an unexpected pass for me on Windows. Maybe the difference is that I'm running the test within a Cygwin session (with mintty).

Note: See TracTickets for help on using tickets.