You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 7265 Reporter: aha Assigned to:@diml Status: closed (set by @xavierleroy on 2017-09-24T15:33:23Z) Resolution: fixed Priority: normal Severity: minor Version: 4.03.0 Fixed in version: 4.04.0 +dev / +beta1 / +beta2 Category: platform support (windows, cross-compilation, etc) Monitored by:@gasche@diml
Bug description
Unix.fstat now throws an exception for file handles of FILE_TYPE_CHAR. And it reports the wrong file kind for FILE_TYPE_PIPE.
Because Unix.isatty is implemented with Unix.fstat, it's broken (and therefore utop and all similar software, that either use Unix.isatty or pass something of FILE_TYPE_CHAR to it)
Steps to reproduce
4.02.3 behavior on windows (identical to *nix)
let a,b = Unix.pipe () ;;
assert ( (Unix.fstat a).Unix.st_kind = Unix.S_FIFO );;
assert ( (Unix.fstat Unix.stdin).Unix.st_kind = Unix.S_CHR );; (* if Unix.stdin is a terminal, of course *)
Note, if you start the ocaml toplevel from within cygwin (mintty,urxvt), cygwin adds its magic. Unix.stdin/stdout/stderr will be of type FILE_TYPE_PIPE, not FILE_TYPE_CHAR. So the steps to reproduce wont work as intended.
The text was updated successfully, but these errors were encountered:
Original bug ID: 7265
Reporter: aha
Assigned to: @diml
Status: closed (set by @xavierleroy on 2017-09-24T15:33:23Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 4.03.0
Fixed in version: 4.04.0 +dev / +beta1 / +beta2
Category: platform support (windows, cross-compilation, etc)
Monitored by: @gasche @diml
Bug description
Unix.fstat now throws an exception for file handles of FILE_TYPE_CHAR. And it reports the wrong file kind for FILE_TYPE_PIPE.
Because Unix.isatty is implemented with Unix.fstat, it's broken (and therefore utop and all similar software, that either use Unix.isatty or pass something of FILE_TYPE_CHAR to it)
Steps to reproduce
4.02.3 behavior on windows (identical to *nix)
let a,b = Unix.pipe () ;;
assert ( (Unix.fstat a).Unix.st_kind = Unix.S_FIFO );;
assert ( (Unix.fstat Unix.stdin).Unix.st_kind = Unix.S_CHR );; (* if Unix.stdin is a terminal, of course *)
4.03.0 behaviour on windows
let a,b = Unix.pipe () ;;
assert ( (Unix.fstat a).Unix.st_kind = Unix.S_REG );;
assert ( try ignore(Unix.fstat Unix.stdin); false with | Unix.Unix_error(Unix.EBADF,"fstat",_) -> true);;
Additional information
Note, if you start the ocaml toplevel from within cygwin (mintty,urxvt), cygwin adds its magic. Unix.stdin/stdout/stderr will be of type FILE_TYPE_PIPE, not FILE_TYPE_CHAR. So the steps to reproduce wont work as intended.
The text was updated successfully, but these errors were encountered: