Tcl Source Code

View Ticket
Login
Ticket UUID: f34cf83dd0150cbbea33469d70a6a400559979c1
Title: unexpected result for "file normalize"
Type: Bug Version: 8.6.6 and 8.7
Submitter: gustafn2 Created on: 2017-04-25 09:48:09
Subsystem: 37. File System Assigned To: dgp
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2017-05-06 12:52:37
Resolution: Fixed Closed By: gustafn2
    Closed on: 2017-05-06 12:52:37
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: gustafn2 added on 2017-05-06 12:52:37:
Great, Many thanks!

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

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-27 14:29:53:
Bisecting points the blame at

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