Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2009-12-14
22:03 • Ticket [2388866fff] file tempfile can only create file in native fs status... artifact: 6905b40018 user: kennykb
21:57 • Ticket [2388866fff]: 1 change artifact: acc6007729 user: dkf
21:42 • Open ticket [2388866fff]. artifact: 52be0c1bb4 user: dgp
17:02 • Closed ticket [2388866fff]. artifact: ee1a55addc user: dkf
2009-12-10
02:48 • Ticket [2388866fff]: 1 change artifact: 3fc5db9bc2 user: dgp
2008-12-07
03:15 • Ticket [2388866fff]: 1 change artifact: 7d4a909a99 user: dkf
03:15 • Ticket [2388866fff]: 4 changes artifact: 970e364311 user: dkf
2008-12-05
01:23 • Ticket [2388866fff]: 4 changes artifact: 0b2316902b user: hobbs
2008-12-04
21:48 • Ticket [2388866fff]: 4 changes artifact: 9f26e58698 user: ferrieux
14:30 • New ticket [2388866fff]. artifact: 0ef5b40ff9 user: dgp

[file tempfile] can only create file in native fs

Open2388866fffffffffffffffffffffffffffffffffCreated 18 years agoUpdated 17 years ago
Descriptionplain2008-12-04 14:30:10
[file tempfile var template] is supposed
to use the template as a pattern on what
pathname to give the temporary file.  If
the directory part of the template points
into a mounted vfs, though, this cannot
work, since the deep guts of [file tempfile]
are written in terms of native syscalls
such as mkstemps() which know nothing about
Tcl's collection of virtual filesystems.

[fileutil::tempfile] has other design
troubles, but it does not suffer from this
limitation.  I don't see why we should
accept it from [file tempfile].
ferrieuxplain2008-12-04 21:48:44
(I know Donal loves when I try to rewrite history, but...)
May I ask why TIP#210 was accepted then ?
Obviously all these matters cannot be handled more elegantly than by the script level, which provides the proper abstractions; moreover there's no real performance catch here.
So what's the point of a C implementation ?
hobbsplain2008-12-05 01:23:47
I would say this is a limitation of the implementation that can be fixed for 8.6.0.  All you need to do is check if template points to a non-native area and fallback to a virtual file.  I could see this potentially having issues with certain vfses, but that would be up to the end developer and their choice of vfs.
dkfplain2008-12-07 03:15:03
Forced to use the native FS for now; attempting to put the file in a virtual FS makes that part of the template get dropped instead. This means that the temporary is available for use with OS APIs and external programs.
dkf Ticket [2388866fff]: 1 change [History diff]2008-12-07 03:15:04
dgp Ticket [2388866fff]: 1 change [History diff]2009-12-10 02:48:52
dkfplain2009-12-14 17:02:16
allow_comments - 1

Since it is impossible to use a tempfile in a virtual filesystem with any non-Tcl API, why on earth would you want otherwise? Any time you need a temporary filename, it's because you're passing it off to something nasty that can't take things in some other nicer way.
dgpplain2009-12-14 21:42:43
allow_comments - 0



data_type - 360894

converted to Feature Request.

The existence of [fileutil::tempfile]
demonstrates this is not infeasible.
dkf Ticket [2388866fff]: 1 change [History diff]2009-12-14 21:57:57
kennykbplain2009-12-14 22:03:19
There are still platforms - perhaps most - where [load] from a vfs requires copying the module to a temp file. If the tempfile is in a vfs that doesn't support direct loading, THEN what are we supposed to do?
Log in (anonymous is fine) to add a comment.