From 204434e4d41bb9e07b48d28331a6a63206dc36dd Mon Sep 17 00:00:00 2001 From: kjnash Date: Tue, 21 Jul 2020 03:59:35 +0000 Subject: Use suitable -errorcode in safe::AliasSource if file does not exist or is unreadable. Fixes bug f3ba57600d. --- library/safe.tcl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/library/safe.tcl b/library/safe.tcl index 4540be3..9b8a04f 100644 --- a/library/safe.tcl +++ b/library/safe.tcl @@ -968,12 +968,15 @@ proc ::safe::AliasSource {slave args} { return -code error "permission denied" } - # do the checks on the filename : + # Check that the filename exists and is readable. If it is not, deliver + # this -errorcode so that caller in tclPkgUnknown does not write a message + # to tclLog. Has no effect on other callers of ::source, which are in + # "package ifneeded" scripts. if {[catch { CheckFileName $slave $realfile } msg]} { Log $slave "$realfile:$msg" - return -code error $msg + return -code error -errorcode {POSIX EACCES} $msg } # Passed all the tests, lets source it. Note that we do this all manually -- cgit v0.12