tclsh crashes with tilde chars in filenames
testcase:
% file normalize ~/~foo ;# tilde slash tilde something
Segmentation Fault
Same result on attempt to [open] a such-named file
I noticed it in 8.6.3 and 8.6.5, people on chat confirmed it for 8.6.8 and 8.7a2
back in 8.4 and 8.5 it didn't crash, but return a wrong result ("~foo").
91396ba981Closed ticket [2aebcbb15b]: file tail "~/~/h" and file nativename "~/~/h" is crashing plus 6 other changes ticket2018-11-28 10:25:378e8688f048merge 8.5: fixes segfault [7a9dc52b29] and wrong normalization (inside TclJoinPath) for pure relative path-segments; test-cases extended and several windows-related are fixed. check-in2018-11-22 13:58:37bcee71a177fixes segfault [7a9dc52b29] and wrong normalization (inside TclJoinPath) for pure relative path-segments; test-cases extended and several windows-related are fixed. check-in2018-11-22 12:48:4210e9bd8b12fixes segfault [7a9dc52b29]: unexpected decrement of the ref-count after TclJoinPath check-in2018-11-20 18:02:32
found the bug: `TclDecrRefCount(absolutePath)` releases absolutePath object that implicit releases the "fsPathPtr->normPathPtr" returned later. Possibly Tcl_FSConvertToPathType references objects a bit wrong (resp. misses a increment of refCount somewhere). WiP
Segfault is fixed in [10e9bd8b12], but... working on the test-cases should cover that, I found strange behavior:
I think the first is invalid, it should be similar to:
% file normalize ~/~foo
~foo
% file normalize ~/bar/~foo
/home/sebres/bar/~foo
The same doing *nix platforms, e. g. `% file normalize ~/foo
/home/sebres/foo
cd ~/foo` as well as `cd ~/~foo` just append second path-segment to current user home.
I'm trying to find a proper solution here (and will provide then the covering test-cases).
both things are fixed now in bug-7a9dc52b29 branch, the branch is tested on *nix/win and can be merged >= 8.5.
segfault & normalization bug fixed and merged to all branches (8.5...9.0).
also note: `file normalize ~/~foo` results into `/<home/user>/~foo` now, in opposite to wrong normalization `~foo` as absolute path segment previously (as it still went in old versions).