summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsebres <sebres@users.sourceforge.net>2024-09-13 12:37:53 (GMT)
committersebres <sebres@users.sourceforge.net>2024-09-13 12:37:53 (GMT)
commitbddda240611ea5ba0974d4e6d424c29f29f7057c (patch)
treedd33dba24e080fb02c9214a2fd0f2eb1bb4e4e91
parent1dab1b639f04dd5e46745e32cddba2475ae9a1d3 (diff)
downloadtcl-bddda240611ea5ba0974d4e6d424c29f29f7057c.zip
tcl-bddda240611ea5ba0974d4e6d424c29f29f7057c.tar.gz
tcl-bddda240611ea5ba0974d4e6d424c29f29f7057c.tar.bz2
amend considering possible tilde expansion in absolute paths starting with ~, so proper error message by tests *io-40.17 "tilde substitution in open"
-rw-r--r--generic/tclIOUtil.c11
1 files 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;