Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

readdir in a closed dirhandle (bytecode) #8481

Closed
vicuna opened this issue Feb 9, 2004 · 2 comments
Closed

readdir in a closed dirhandle (bytecode) #8481

vicuna opened this issue Feb 9, 2004 · 2 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Feb 9, 2004

Original bug ID: 2198
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

Full_Name: Didier Remy
Version: 3.07+2
OS: linux redhat 7.1
Submission from: morgon.inria.fr (128.93.8.33)

Il semble que readdir sur un descripteur ferme bloque en version bytecode.
On recoit correctement le End_of_file en version native.

Voici un example qui met le probleme en evidence.

 Didier

morgon:/tmp$ cat foo.ml
open Unix

let () = ()
let tmp = opendir "/tmp";;
let _ = closedir tmp;;
let _ = prerr_endline
"Reading to read in a closed dirhandler";;
let should_not_block =
try ignore (readdir tmp); prerr_endline "Done!"
with End_of_file -> prerr_endline "End_of_file!"
morgon:/tmp$ ocamlc -o foo.byte unix.cma foo.ml
morgon:/tmp$ ocamlopt -o foo.opt unix.cmxa foo.ml
morgon:/tmp$ ./foo.opt
Reading to read in a closed dirhandler
End_of_file!
morgon:/tmp$ ./foo.byte
Reading to read in a closed dirhandler

(* blocking *)

@vicuna
Copy link
Author

vicuna commented Feb 14, 2004

Comment author: administrator

Fixed 2004-02-14 by XL.

@vicuna vicuna closed this as completed Feb 14, 2004
@vicuna
Copy link
Author

vicuna commented Feb 14, 2004

Comment author: administrator

Il semble que readdir sur un descripteur ferme bloque en version bytecode.
On recoit correctement le End_of_file en version native.

Dans l'implémentation actuelle, utiliser readdir ou closedir sur un
directory handle déjà fermé a un comportement indéfini. (Ça revient à
accéder un bloc mémoire C déjà libéré.) Je viens de corriger cela
dans le CVS. Maintenant, ça fait une Unix_error(EBADF).

  • Xavier

@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant