From bddda240611ea5ba0974d4e6d424c29f29f7057c Mon Sep 17 00:00:00 2001 From: sebres Date: Fri, 13 Sep 2024 12:37:53 +0000 Subject: amend considering possible tilde expansion in absolute paths starting with ~, so proper error message by tests *io-40.17 "tilde substitution in open" --- generic/tclIOUtil.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index 807c664..c553ef3 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -2239,11 +2239,18 @@ Tcl_FSOpenFileChannel( * We need this just to ensure we return the correct error messages under * some circumstances (relative paths only), so because the normalization * is very expensive, don't invoke it for native or absolute paths. + * Note: TODO - check one needs consider tilde expansion after TIP#602, + * (proper error message of tests *io-40.17 "tilde substitution in open") */ if ( - !TclFSCwdIsNative() && - Tcl_FSGetPathType(pathPtr) != TCL_PATH_ABSOLUTE && + ( + ( + !TclFSCwdIsNative() && + (Tcl_FSGetPathType(pathPtr) != TCL_PATH_ABSOLUTE) + ) || + (*TclGetString(pathPtr) == '~') /* possible tilde expansion */ + ) && Tcl_FSGetNormalizedPath(interp, pathPtr) == NULL ) { return NULL; -- cgit v0.12