file copy -force fails when cross filesystem copy
Closed / Fixed886352ffffffffffffffffffffffffffffffffffCreated 23 years agoUpdated 23 years ago
Descriptionplain2004-01-28 17:43:18
f1 is a regular file
f2 is a regular file with read-only permissions
file copy -force $f1 $f2
Works if f1 and f2 are in a regular filesystem but fails if
f2 is in a different filesystem (e.g. inside a tclkit)
Andreas Kupries suggests this may be related to a flaw
in crossfilesystem copy function
http://www.equi4.com/pipermail/starkit/2004-
January/001814.html
And Vicent Darley finds out exactly where
http://www.equi4.com/pipermail/starkit/2004-
January/001821.html
The following test cases ilustrates the problem. The first
one pases the second one does not. You need to
execute it using
tclkit test.tcl -verbose ve
package require tcltest
package require mk4vfs
proc writeFile {dest text} {
set f [open $dest w]
puts -nonewline $f $text
close $f
}
proc readFile {dest} {
set f [open $dest r]
set r [::read $f]
close $f
return $r
}
tcltest::test copy1 {Copy file no permissions} {} {
foreach f {f1 f2} {
set $f [file join $::tcltest::testsDirectory $f]
file delete -force $f
writeFile $f $f
}
file attributes $f2 -permissions 0000
file copy -force $f1 $f2
set result [readFile $f2]
file delete -force $f1 $f2
set result
} {f1}
# For some reason, if both files in disk no problem, if
origin in tclkit, it fails
tcltest::test copy2 {Copy file from tclkit to disk no
permissions} {} {
set kitFile [file join $::tcltest::testsDirectory test.kit]
::vfs::mk4::Mount $kitFile $kitFile
set t $::tcltest::testsDirectory
set f2 [file join $t f2]
file delete -force $f2
writeFile $f2 f2
set f1 [file join $kitFile f1]
writeFile $f1 f1
file attributes $f2 -permissions 0000
file copy -force $f1 $f2
::vfs::unmount $kitFile
set result
} {f1}
vincentdarleyplain2004-01-29 01:13:45
File Added - 75018: permfix.patch Logged In: YES user_id=32170 Attached is a patch to fix this and another issue. Please test (note: on unix the eol's in the patch must be converted first).
nobodyplain2004-01-29 19:21:20
Logged In: NO Yes, it does indeed work now. Thanks! (patch took care automatically of CRLF issues too)
vincentdarley Closed ticket [886352ffff].
[History diff]2004-01-29 19:26:20
Log in (anonymous is fine) to add a comment.
Attachments:
- permfix.patch [download] added by vincentdarley on 2004-01-29 01:13:45. [details]