Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004973OCamlOCaml generalpublic2010-02-05 14:302012-03-24 15:01
ReporterChristoph Bauer 
Assigned Togildor 
PrioritynormalSeveritytweakReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version3.11.0 
Target VersionFixed in Version3.12.0+dev 
Summary0004973: Failure "Unknown handle"
DescriptionOnly Windows is affected.

I open a process and call select on stdin/stdout pipes. If the
process terminates on Unix, I get an Unix_error exception (Broken
pipe). Under windows I get 'Failure "Unknown handle"`. This comes
from select.c. It would be nice to have also a Unix_error, because
it reduces the number of portability problems.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0005473)
gildor (developer)
2010-05-20 16:36

I think you mean the contrary, when testing I get:
- a Sys_error("Bad file descriptor") on Linux
- a Broken pipe on Windows

let dummy_exec =
 Compile.compile_one_liner "dummy" [] ""
in
let (chn_in, chn_out) as proc =
 open_process dummy_exec
in
let _s : process_status =
 close_process proc
in
 select
  [descr_of_in_channel chn_in]
  [descr_of_out_channel chn_out]
  []
  1.0

Is this what you mean ?
(0005474)
gildor (developer)
2010-05-20 16:57

Check a little further, Sys_error("Bad file descriptor") | EPIPE is raised by descr_of_in_channel/descr_of_out_channel.

If I rework the program in this way:
let dummy_exec =
 Compile.compile_one_liner "dummy" [] ""
in
let (chn_in, chn_out) as proc =
 open_process dummy_exec
in
let fd_in =
 descr_of_in_channel chn_in
in
let fd_out =
 descr_of_out_channel chn_out
in
let _s : process_status =
 close_process proc
in
 select
  [fd_in]
  [fd_out]
  []
  1.0

I get:
- Unix.Unix_error(3, "select", "") on Linux
- Failure("Unknown handle") on Windows
(0005505)
gildor (developer)
2010-05-25 15:21

Be consistent between Windows and Linux, raise an EBADF Unix_error for a closed pipe handle.

- Issue History
Date Modified Username Field Change
2010-02-05 14:30 Christoph Bauer New Issue
2010-05-19 14:37 xleroy Status new => assigned
2010-05-19 14:37 xleroy Assigned To => gildor
2010-05-20 16:36 gildor Note Added: 0005473
2010-05-20 16:57 gildor Note Added: 0005474
2010-05-25 15:21 gildor Note Added: 0005505
2010-05-25 15:21 gildor Status assigned => resolved
2010-05-25 15:21 gildor Fixed in Version => 3.12.0+dev
2010-05-25 15:21 gildor Resolution open => fixed
2012-03-24 15:01 xleroy Status resolved => closed


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker