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

Filename.temp_file doc not precise enough #2712

Closed
vicuna opened this issue Mar 20, 2001 · 2 comments
Closed

Filename.temp_file doc not precise enough #2712

vicuna opened this issue Mar 20, 2001 · 2 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Mar 20, 2001

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

Bug description

Full_Name: Judicaël Courant
Version: ocaml-3.01
OS: Linux
Submission from: ext2.lri.fr (129.175.15.5)

The doc of Filename.temp_file says

temp_file prefix suffix returns the name of a non-existent temporary file in
the temporary directory. [blabla]

It should say:

temp_file prefix suffix creates a non-existent 0-length temporary file in
the temporary directory and returns its name. [blabla]

Otherwise, you are tempted to believe that in order to prevent the race
condition,
you should typically do :
let open_temp () =
try open_out_gen [Open_excl] Oo666 (Filename.temp_file "foo" ".bar") with
| Sys_error _ -> open_temp ()

This would funnily not necessarily full the temporary directory but would
say "Filename.temp_file: temp dir nonexistent or full"...

BTW, why is there this undocumented hard limit of 1000 on the number of
temporary
file with a given prefix and suffix ? I think at least the message could be
improved.

Judicaël.

@vicuna
Copy link
Author

vicuna commented Mar 29, 2001

Comment author: administrator

The doc of Filename.temp_file says

temp_file prefix suffix returns the name of a non-existent temporary file in
the temporary directory. [blabla]

It should say:

temp_file prefix suffix creates a non-existent 0-length temporary file in
the temporary directory and returns its name. [blabla]

Fixed. Thanks for the suggestion.

This would funnily not necessarily full the temporary directory but would
say "Filename.temp_file: temp dir nonexistent or full"...
BTW, why is there this undocumented hard limit of 1000 on the number
of temporary file with a given prefix and suffix ? I think at least
the message could be improved.

The test wasn't there initially, but without it we get an infinite
loop if the temporary directory doesn't exist. This sometimes happens
on Windows machines where \temp is missing. (It actually happened to
Henri Laulhere when compiling Coq in native-code on his Windows
machine; ocamlopt just entered an endless loop trying to find a
suitable temp file for its asm output...)

  • Xavier Leroy

@vicuna
Copy link
Author

vicuna commented Mar 29, 2001

Comment author: administrator

Fixed 2001-03-29 by XL.

@vicuna vicuna closed this as completed Mar 29, 2001
@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