Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007265OCamlplatform support (windows, cross-compilation, etc)public2016-05-27 13:052017-09-24 17:33
Reporteraha 
Assigned Todim 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version4.03.0 
Target VersionFixed in Version4.04.0 +dev / +beta1 / +beta2 
Summary0007265: Unix.fstat behaves surprisingly under OCaml 4.03.0/windows, Unix.isatty is broken
DescriptionUnix.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 Reproduce4.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 InformationNote, 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.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0016213)
dim (developer)
2016-08-19 15:12

Fixed in trunk (9d4833d604e59940b83aa5a9b86f58a4aae595a5) and 4.04 (3767d781dd8477f850c792e5ac93787a50da2355)

- Issue History
Date Modified Username Field Change
2016-05-27 13:05 aha New Issue
2016-08-19 15:12 dim Note Added: 0016213
2016-08-19 15:12 dim Status new => resolved
2016-08-19 15:12 dim Fixed in Version => 4.04.0 +dev / +beta1 / +beta2
2016-08-19 15:12 dim Resolution open => fixed
2016-08-19 15:12 dim Assigned To => dim
2017-02-23 16:46 doligez Category OCaml windows => platform support (windows, etc)
2017-02-23 17:16 doligez Category platform support (windows, etc) => platform support (windows, cross-compilation, etc)
2017-09-24 17:33 xleroy Status resolved => closed


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker