zorba-coders team mailing list archive
-
zorba-coders team
-
Mailing list archive
-
Message #09635
[Bug 997230] Re: open filestream prevents file deletion on windows
Even this doesn't work:
import module namespace file = "http://expath.org/ns/file";
declare variable $file := "C:\data.txt";
let $data := file:read-text($file)
return $data;
file:delete($file);
I think that even if scoping worked it wouldn't be sufficient. A user
should be able to read data into a global variable and delete a file,
no? In this case the user wants materialization in memory not only on
windows but also on any other OS, right?
This example throws an error even on linux:
import module namespace file = "http://expath.org/ns/file";
declare variable $file := "/home/dknochen/test.txt";
declare variable $data := ();
$data := file:read-text($file);
file:delete($file);
$data
As the streaming part is hidden from the user, the materialization part
could be hidden as well, don't you think? For this we need to identify
the operations that force materialization. Would that make sense? Is it
feasible?
--
You received this bug notification because you are a member of Zorba
Coders, which is the registrant for Zorba.
https://bugs.launchpad.net/bugs/997230
Title:
open filestream prevents file deletion on windows
Status in Zorba - The XQuery Processor:
New
Bug description:
the bug fix for bug #996084 seems to be a bit more tricky on windows.
If you execute the attached example on a windows machine you will get:
user-defined error [file:FOFL9999]: An unknown error occured:
"C:\data.txt": I/O error: 32 failed (error The process cannot access
the file because it is being used by another process): Can not delete
file: C:\data.txt; raised at
zorba\modules\org\expath\ns\file.xq.src\file_function.cpp:82
The problem is that the file cannot be deleted as long as the file
stream is open. This example query works on linux.
This makes the 2 tests test/rbkt/zorba/file/copy_* fail on windows.
Any idea how to solve this?
To manage notifications about this bug go to:
https://bugs.launchpad.net/zorba/+bug/997230/+subscriptions
References