Tcl Source Code

View Ticket
Login
Ticket UUID: 875545270d5f38184be7e7c244c28f3d8c31d2d1
Title: tcl::CopyDirectory copying /a/a /x/a/a error
Type: Bug Created on: 2017-09-14 05:57:17
Submitter: raymin Assigned to: nobody
Subsystem: 38. Init - Library - Autoload Severity: Minor
Priority: 5 Medium Last modified: 2026-10-19 18:54:12
Status: Open Closed by: nobody
Resolution: None Closed on:
Version: 8.6.18, 9.0.5, 9.1.0
Description:
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
User Comments:
serhiy.storchaka added on 2026-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.