Are you sure Ns_NormalizePath() is broken?  I haven't examined it, but
it's worth pointing out that it's most important use is normalizing
the *URL path*, called early at the start of conn processing in
request.c.

The comment for Ns_NormalizePath() says "Assumes an absolute path",
which seems reasonable when thinking about just URL paths.

We need to figure out whether Ns_NormalizePath() really is broken and
fix it, or otherwise resolve the confusion.

Also, will [file normalize $path] do the right thing to a URL when
used on Windows?



#
# ns_normalizepath --
#
#   Normalize the path. WATCH: this procedure is actually broken
#   because it will normalize "a/b/c" to "/a/b/c" which is WRONG.
#   This is because it mimics the broken Ns_NormalizePath C-API.
#
#   Please use Tcl [file normalize] instead. This always return
#   properly normalized absolute path, as expected.
#

proc ns_normalizepath {path} {
    if {[file pathtype $path] == "relative"} {
        ns_log warning "normalizepath: $path; broken for relative paths"
        ns_log warning "normalizepath: use \[file normalize\] instead"
        set path /$path
    }
    file normalize $path
}

Reply via email to