Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005953OCamlOCaml otherlibspublic2013-03-15 18:202013-03-22 12:44
Reporterdim 
Assigned Todim 
PrioritylowSeverityminorReproducibilityalways
StatusresolvedResolutionopen 
PlatformOSOS Version
Product Version4.01.0+dev 
Target Version4.01.0+devFixed in Version 
Summary0005953: Unix.system does not handle EINTR
DescriptionRight now Unix.system calls waitpid and does not handle EINTR. This means that if a signal handler is set somewhere else in the program a call to Unix.system may fail with this error.

I think Unix.system should waitpid again until it does not fail with EINTR since:

- this is what the system(3) function of the libc does
- the user does not have the pid of the sub-process so it cannot restart the call if it is interrupted

The attached patch replace the call to waitpid in Unix.system by one to waitpid_non_intr.
Steps To Reproduce# #load "unix.cma";;
# Sys.set_signal Sys.sigchld (Sys.Signal_handle ignore);;
- : unit = ()
# let ic = Unix.open_process_in "sleep 5";;
val ic : in_channel = <abstr>
# Unix.system "sleep 10";;
Exception: Unix.Unix_error (Unix.EINTR, "waitpid", "").
TagsNo tags attached.
Attached Filespatch file icon 0001-handle-EINTR-in-Unix.system.patch [^] (1,321 bytes) 2013-03-15 18:20 [Show Content]

- Relationships

-  Notes
(0008995)
dim (developer)
2013-03-20 18:24

If nobody objects I'll merge the patch.
(0009001)
dim (developer)
2013-03-22 12:44

Applied in revisions 13421 and 13422.

- Issue History
Date Modified Username Field Change
2013-03-15 18:20 dim New Issue
2013-03-15 18:20 dim Status new => assigned
2013-03-15 18:20 dim Assigned To => dim
2013-03-15 18:20 dim File Added: 0001-handle-EINTR-in-Unix.system.patch
2013-03-15 18:27 dim Description Updated View Revisions
2013-03-20 18:24 dim Note Added: 0008995
2013-03-22 12:44 dim Note Added: 0009001
2013-03-22 12:44 dim Status assigned => resolved
2013-03-22 12:44 dim Target Version => 4.01.0+dev


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker