Tcl Source Code

View Ticket
Login
Ticket UUID: f9fe90d0fa28fbe821db1c207de34010d51cf6e8
Title: Inconsistent handling of leading //
Type: Bug Created on: 2016-12-16 05:30:04
Submitter: aspect Assigned to: dgp
Subsystem: 36. Pathname Management Severity: Minor
Priority: 5 Medium Last modified: 2017-05-01 20:24:35
Status: Closed Closed by: dgp
Resolution: Fixed Closed on: 2017-05-01 20:24:35
Version: 8.6.5
Description:
(on Unix - no idea about Windows)

% file join //bla a
/bla/a
% file normalize //bla
//bla
% file join //bla a
//bla/a

From [::tcl::unsupported::representation] we can see what's going on - the 2nd line shimmers interned //bla to a path.

Proper UNC paths should have a trailing slash .. but then it gets even weirder:

% file join //bla/ a
/bla/a
% file normalize //bla/
/bla
% file join //bla/ a
//bla/a

Handling of //-prefixed paths seems to be inconsistent.  I *think* they're documented as special only on Windows (UNC paths), but there's code somewhere treating them specially on Unix.  It's not in TclFSNormalizeAbsolutePath.

There's an argument that treating them specially on Unix would be useful, if only as pseudo-mountpoints for VFS.

See also [bug 1752589fff].
User Comments:
rkeene added on 2016-12-16 15:38:26:
// is specified by POSIX to be special:

> A pathname that begins with two successive slashes may be interpreted in an 
> implementation-defined manner, although more than two leading slashes shall be 
> treated as a single slash.

http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap04.html#tag_04_11

aspect added on 2017-04-29 11:05:52:

The fix for [f34cf83dd0] (merged to trunk in [e895b53905]) came close to hitting this.

Attempted fix in [bug-f9fe90d0fa] ([27bac5b2c6]).


dgp added on 2017-05-01 16:12:44:
If someone wants to make // prefix special, they
should mount a Tcl_Filesystem that does so.

The "native" filesystem for unix should not be changed
in this way.

dgp added on 2017-05-01 20:24:35:
Fix for all dev branches.