hedge case?: file:copy deletes destination
Hi, I am running SaxonPE9-9-1-8J under ubuntu (from a windows10 unix subsystem bash shell) and I found this:
<xsl:variable name="src" select="file:///dir/File.ext"/>
<xsl:variable name="dst" select="file:///dir/file.ext"/>
<xsl:value-of select="file:move($src, $dst)"/>
deletes the file at $dst
The easy workaround is:
<xsl:variable name="dst_tmp" select="concat($dst, '_tmp')"/>
<xsl:value-of select="file:move($src, $dst_tmp)"/>
<xsl:value-of select="file:move($dst_tmp, $dst)"/>
but maybe this shoud be investigated.
I have not tried under a regular bash shell, so maybe this is specific to Windows10 unix subsystem
#1 Updated by Michael Kay 22 days ago
- Status changed from New to In Progress
This seems entirely consistent with the specification, which states (in §4.11):
if $target is a file, it will be overwritten
There are many other ways of having two different URIs that refer to the same file, for example by using non-normalised URIs, query parameters, or symbolic links. I'm not sure there is even a reliable way of discovering that two URIs refer to the same file.
#3 Updated by Michael Kay 22 days ago
Correct, URI's are case sensitive. So
file:///C:/X.XML are two different URIs. But (on Windows) they are different names for the same underlying resource. You can have many other URIs also referring to this resource, for example if it is on an HTTP server then
http://localhost/x.xml might be the same resource; and if you delete the resource using any of these URIs, the resource will be gone and the other URIs will fail to find it. A name is not the same as the thing it refers to; things can have more than one name.
Please register to edit this issue