Tcl Source Code

View Ticket
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.
Ticket UUID: b43efdfd61d2fbe670fdd1ebcbfce7a999c6bef0
Title: file delete -force does not work on read-only subdirectories
Type: Bug Version: 8.6.6
Submitter: agalanin Created on: 2019-03-16 16:16:38
Subsystem: 37. File System Assigned To: nobody
Priority: 5 Medium Severity: Minor
Status: Open Last Modified: 2019-03-16 16:16:38
Resolution: None Closed By: nobody
    Closed on:
If a sub-directory is not writable, file delete -force fails on the first file in the read-only subdirectory.

Platform: Debian 9.8 / Linux 4.9.0, x86_64

Script to reproduce:

package require fileutil

set tmp [::fileutil::tempdir]
file mkdir [set dir [file join $tmp test-[pid]-[clock seconds]]]
file mkdir [set subdir [file join $dir subdir]]
set f [open [file join $subdir testfile] w]
puts $f test
close $f
exec chmod a-w $subdir
file delete -force $dir

Actual result:

error deleting "/tmp/test-13462-1552752895/subdir/testfile": permission denied

Expected result:

directory removed completely, no error