Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004003OCamlOCaml generalpublic2006-04-12 18:042011-05-29 12:20
Reportermottl 
Assigned Toxclerc 
PrioritynormalSeverityfeatureReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version3.10+dev 
Target VersionFixed in Version3.11.2+dev 
Summary0004003: Generation of temporary files in module Filename should be improved
DescriptionTemporary files as generated by "open_temp_file" and "temp_file" are generated in either /tmp (default) or the value of the environment variable "TMPDIR" at startup time. Unfortunately, the temporary directory may be on a different filesystem than the directory where the final file should be moved to. This means that "Sys.rename" will fail (at least on Unix-systems), and even if it worked, it would have to copy the file to the other filesystem, which may take a long time. Since the environment variable is only read at startup, this cannot be changed at runtime, and even if, it would cause problems with threads.

It seems therefore advisable to add functions that perform creation of temporary files in a directory provided at runtime, or using a given filestem.
TagsNo tags attached.
Attached Filespatch file icon temp_dir_name2.patch [^] (3,846 bytes) 2008-03-26 16:18 [Show Content]

- Relationships

-  Notes
(0004486)
spiralvoice (reporter)
2008-03-26 16:18

The attached patch updates Filename.temp_file to respect run-time changes to $TMPDIR/$TEMP.

It also adds Filename.temp_dir_name2 (), an updated function to Filename.temp_dir_name, which also respects run-time changes to $TMPDIR/$TEMP.
(0004487)
spiralvoice (reporter)
2008-03-26 16:20

This code

lprintf_nl "debug1 %s" (Filename.temp_file "blabla" "blub");
lprintf_nl "debug1a %s" (Filename.temp_dir_name);
lprintf_nl "debug1b %s" (Filename.temp_dir_name_2 ());

Unix.putenv "TMPDIR" "/root";

lprintf_nl "debug2 %s" (Filename.temp_file "blabla" "blub");
lprintf_nl "debug2a %s" (Filename.temp_dir_name);
lprintf_nl "debug2b %s" (Filename.temp_dir_name_2 ());

produces these lines with patched Ocaml 3.10.2:

2008/03/26 16:10:41 [cO] debug1 /tmp/blabla0d0cdbblub
2008/03/26 16:10:41 [cO] debug1a /tmp
2008/03/26 16:10:41 [cO] debug1b /tmp
2008/03/26 16:10:41 [cO] debug2 /root/blablaeef4c8blub
2008/03/26 16:10:41 [cO] debug2a /tmp
2008/03/26 16:10:41 [cO] debug2b /root
(0005105)
xclerc (developer)
2009-09-16 16:24

Both Filename.temp_file and Filename.open_temp_file functions now
take an additional optional parameter that is the directory in which the
temporary file should be created.

- Issue History
Date Modified Username Field Change
2006-04-12 18:04 mottl New Issue
2006-06-08 17:26 xleroy Severity minor => feature
2006-06-08 17:26 xleroy Status new => acknowledged
2008-03-26 16:18 spiralvoice File Added: temp_dir_name2.patch
2008-03-26 16:18 spiralvoice Note Added: 0004486
2008-03-26 16:20 spiralvoice Note Added: 0004487
2009-09-16 16:24 xclerc Note Added: 0005105
2009-09-16 16:24 xclerc Status acknowledged => resolved
2009-09-16 16:24 xclerc Fixed in Version => 3.11.2+dev
2009-09-16 16:24 xclerc Resolution open => fixed
2009-09-16 16:24 xclerc Assigned To => xclerc
2011-05-29 12:20 xleroy Status resolved => closed


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker