PROPOSAL: Add openFileTemplate, openBinaryFileTemplate to System.IO

Hi all, This is Add openFileTemplate, openBinaryFileTemplate to System.IO http://hackage.haskell.org/trac/ghc/ticket/3393 (originally part of http://hackage.haskell.org/trac/ghc/ticket/2610) In System.IO, openTempFile and openBinaryTempFile mask the file permissions of the file they create with 0o600. However, we would like to use it for implementing things like writeFileAtomic, in which case we want the default file permissions to be used. I propose that we add openFileTemplate and openBinaryFileTemplate functions, which use the default permissions. Deadline: 8th August (2 weeks). Thanks Ian

Sorry, I don't get this. I thought the "temp" in openTempFile stood
for "temporary" not "template". And what would the signature of these
new functions would look like and what exactly they would do.
2009/7/24 Ian Lynagh
Hi all,
This is Add openFileTemplate, openBinaryFileTemplate to System.IO http://hackage.haskell.org/trac/ghc/ticket/3393 (originally part of http://hackage.haskell.org/trac/ghc/ticket/2610)
In System.IO, openTempFile and openBinaryTempFile mask the file permissions of the file they create with 0o600. However, we would like to use it for implementing things like writeFileAtomic, in which case we want the default file permissions to be used.
I propose that we add openFileTemplate and openBinaryFileTemplate functions, which use the default permissions.
Deadline: 8th August (2 weeks).
Thanks Ian
_______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries
-- Push the envelope. Watch it bend.

Hi,
"Temp" is indeed for "temporary" but the function still takes a
template as parameters. The proposal seems to be to to have a similar
function, one that also uses a template, but with the default
permissions, not those of a temporary file create by the existing
functions.
Cheers,
Thu
2009/7/25 Thomas Schilling
Sorry, I don't get this. I thought the "temp" in openTempFile stood for "temporary" not "template". And what would the signature of these new functions would look like and what exactly they would do.
2009/7/24 Ian Lynagh
: Hi all,
This is Add openFileTemplate, openBinaryFileTemplate to System.IO http://hackage.haskell.org/trac/ghc/ticket/3393 (originally part of http://hackage.haskell.org/trac/ghc/ticket/2610)
In System.IO, openTempFile and openBinaryTempFile mask the file permissions of the file they create with 0o600. However, we would like to use it for implementing things like writeFileAtomic, in which case we want the default file permissions to be used.
I propose that we add openFileTemplate and openBinaryFileTemplate functions, which use the default permissions.
Deadline: 8th August (2 weeks).
Thanks Ian
_______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries
-- Push the envelope. Watch it bend. _______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries

I've never heard this usage of the word "template" before, so I guessed it was meant to open some kind of template file. openWithMode? openWithPermissions?

2009/7/25 Evan Laforge
I've never heard this usage of the word "template" before, so I guessed it was meant to open some kind of template file. openWithMode? openWithPermissions?
man mktemp for instance: http://www.manpagez.com/man/1/mktemp/ Thu

On Fri, Jul 24, 2009 at 11:02 PM, minh thu
2009/7/25 Evan Laforge
: I've never heard this usage of the word "template" before, so I guessed it was meant to open some kind of template file. openWithMode? openWithPermissions?
man mktemp
Ohhh, it's for the filename, sorry, all the talk about permissions got me on the wrong track.

On Fri, Jul 24, 2009 at 11:11:40PM -0700, Evan Laforge wrote:
On Fri, Jul 24, 2009 at 11:02 PM, minh thu
wrote: 2009/7/25 Evan Laforge
: I've never heard this usage of the word "template" before, so I guessed it was meant to open some kind of template file. openWithMode? openWithPermissions?
man mktemp
Ohhh, it's for the filename, sorry, all the talk about permissions got me on the wrong track.
Right. Just to clarify for anyone else reading, we currently have: openTempFile :: FilePath -> String -> IO (FilePath, Handle) openBinaryTempFile :: FilePath -> String -> IO (FilePath, Handle) which mask the mode, and we would add openFileTemplate :: FilePath -> String -> IO (FilePath, Handle) openBinaryFileTemplate :: FilePath -> String -> IO (FilePath, Handle) which do not. Theese functions are used like this: openFileTemplate "/foo/bar" "bazXXX.ext" and open a file called "baz143.ext". "bazXXX.ext" is the template. Thanks Ian

On 25/07/2009 13:35, Ian Lynagh wrote:
On Fri, Jul 24, 2009 at 11:11:40PM -0700, Evan Laforge wrote:
On Fri, Jul 24, 2009 at 11:02 PM, minh thu
wrote: 2009/7/25 Evan Laforge
: I've never heard this usage of the word "template" before, so I guessed it was meant to open some kind of template file. openWithMode? openWithPermissions?
man mktemp
Ohhh, it's for the filename, sorry, all the talk about permissions got me on the wrong track.
Right. Just to clarify for anyone else reading, we currently have: openTempFile :: FilePath -> String -> IO (FilePath, Handle) openBinaryTempFile :: FilePath -> String -> IO (FilePath, Handle) which mask the mode, and we would add openFileTemplate :: FilePath -> String -> IO (FilePath, Handle) openBinaryFileTemplate :: FilePath -> String -> IO (FilePath, Handle) which do not.
Theese functions are used like this: openFileTemplate "/foo/bar" "bazXXX.ext" and open a file called "baz143.ext". "bazXXX.ext" is the template.
I'm not too keen on the naming. openFileTemplate differs from openTempFile only in that it uses the default permissions, and yet its name suggests that it does something quite different. The fact that you don't know what the file is going to be called means that the API is only really useful for temporary files, so I have no problem with that being part of the name. Perhaps openTempFileWithDefaultPermissions? Or perhaps we deprecate openTempFile, and make a new openTemporaryFile that takes a Bool argument to say whether to make the file private or not? Cheers, Simon
participants (5)
-
Evan Laforge
-
Ian Lynagh
-
minh thu
-
Simon Marlow
-
Thomas Schilling