tcl::CopyDirectory copying /a/a /x/a/a error
Open875545270d5f38184be7e7c244c28f3d8c31d2d1Created 9 years agoUpdated 44 days ago
Descriptionplain2017-09-14 05:57:17
When I reading init.tcl, I think tcl::CopyDirectory may have a bug. My test is: % tcl::CopyDirectory copying /a/a /x/a/a error copying "/a/a" to "/x/a/a": trying to rename a volume or move a directory into itself
Referenced by2
616bbebb7eTicket [82049f96f8] file copy attempts to copy directory into itself status still Open with 4 other changes ticket2026-10-19 18:54:12c51f96d014Fix [82049f96f8] and [875545270d]: [file copy] of a directory into itself recursed until the path was too long; now it is an error. tcl::CopyDirectory, used for copies between file systems, rejected targets that only contained the source path, because it used [string first]; compare path prefixes instead. check-in2026-10-19 18:53:17
serhiy.storchakawiki2026-10-19 18:54:12
Still present in 8.6, 9.0 and 9.1. The check uses [string first], so a target that only contains the source path somewhere is rejected. It matters for [file copy] between file systems (from zipfs or a VFS), which uses tcl::CopyDirectory. Proposed fix in branch copy-into-itself, together with [82049f96f8]: compare the [file split] prefix. Tests init-6.0 and 6.1.
Log in (anonymous is fine) to add a comment.