Tcl Source Code

View Ticket
Login
Ticket UUID: f34cf83dd0150cbbea33469d70a6a400559979c1
Title: unexpected result for "file normalize"
Type: Bug Created on: 2017-04-25 09:48:09
Submitter: gustafn2 Assigned to: dgp
Subsystem: 37. File System Severity: Minor
Priority: 5 Medium Last modified: 2017-05-06 12:52:37
Status: Closed Closed by: gustafn2
Resolution: Fixed Closed on: 2017-05-06 12:52:37
Version: 8.6.6 and 8.7
Description:
Two slashes in paths are only sometimes reduced to a single slash. This inconsistent behavior contradicts the aim that "file normalize" returns 'the “standard” format for the native platform'. 

This is seen at least with tcl 8.6.6 and Tcl 8.7a0 on MacOS X and Linux.

   % file normalize //foo
   //foo
   % file normalize //foo/
   /foo
   % file normalize ///foo
   /foo
   % file normalize /foo//bar
   /foo/bar
   % file normalize //foo/bar
   //foo/bar
   % file normalize //foo//bar
   /foo/bar
   % file normalize //foo/bar/
   /foo/bar

   % set tcl_patchLevel
   8.6.6
User Comments:
dgp added on 2017-04-27 14:29:53:
Bisecting points the blame at

https://core.tcl.tk/tcl/info/9cfcca63fb0

dgp added on 2017-04-28 16:41:03:
It appears this traces down to a flaw in [file join]
machinery:

% info patch
8.4.20
% file join foo /bar
/bar
%  file join foo //bar
/bar
%  file join foo ///bar
/bar

% info patch
8.6.6
% file join foo /bar
/bar
% file join foo //bar
//bar
% file join foo ///bar
/bar

dgp added on 2017-04-28 17:59:43:
Fixed on all dev branches

gustafn2 added on 2017-05-06 12:52:37:
Great, Many thanks!