Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2004-02-18
01:34
* generic/tclIOUtil.c: backport of rewrite of generic file normalization code to cope with links f... check-in: f4ec15959a user: hobbs tags: core-8-4-branch
2003-12-18
00:48 • Closed ticket [859251ffff]: new fileSystem.test failures plus 7 other change... artifact: d778e0c259 user: vincentdarley
00:26 • Ticket [859251ffff]: 4 changes artifact: 37e11e4159 user: dgp
2003-12-17
23:40 • Add attachment fsfix.diff to ticket [859251ffff] artifact: d2425ae1a6 user: vincentdarley
23:40 • Ticket [859251ffff] new fileSystem.test failures status still Open with 4 ot... artifact: e073aed9f8 user: vincentdarley
23:24 • Ticket [859251ffff]: 4 changes artifact: bccab5c288 user: dgp
19:48 • Ticket [859251ffff]: 4 changes artifact: 69af6028c3 user: vincentdarley
17:25 • Ticket [859251ffff]: 4 changes artifact: a6c11d409a user: vincentdarley
17:13 • Ticket [859251ffff]: 4 changes artifact: 98df7c8258 user: vincentdarley
2003-12-15
22:28 • Ticket [859251ffff]: 4 changes artifact: aea5c9b93c user: dgp
2003-12-14
17:54 • Ticket [859251ffff]: 4 changes artifact: 46f2e4897f user: vincentdarley
2003-12-12
23:54 • New ticket [859251ffff]. artifact: dd9e6b4366 user: dgp

new fileSystem.test failures

Closed / Fixed859251ffffffffffffffffffffffffffffffffffCreated 23 years agoUpdated 23 years ago
Descriptionplain2003-12-12 23:54:32
Do you `make test` before you commit
these changes?  Or is this a cross-platform
issue?

On Solaris 9:

==== filesystem-1.7 link normalisation FAILED
==== Contents of test case:

    testPathEqual [file normalize [file join dir.link
linkinside.file foo]]  [file normalize [file join
dir.file inside.file foo]]

---- Result was:
not equal:
/local/src/tcl/solaris/dir.file/linkinside.file/foo
/local/src/tcl/solaris/dir.file/inside.file/foo
---- Result should have been (exact matching):
1
==== filesystem-1.7 FAILED


==== filesystem-1.9 link normalisation FAILED
==== Contents of test case:

    file delete -force dir.link
    file link dir.link [file nativename dir.file]
    testPathEqual [file normalize [file join dir.file
linkinside.file foo]]  [file normalize [file join
dir.link inside.file foo]]

---- Result was:
not equal:
/local/src/tcl/solaris/dir.file/linkinside.file/foo
/local/src/tcl/solaris/dir.file/inside.file/foo
---- Result should have been (exact matching):
1
==== filesystem-1.9 FAILED


==== filesystem-1.10 link normalisation: double link FAILED
==== Contents of test case:

    file link dir2.link dir.link
    testPathEqual [file normalize [file join dir.file
linkinside.file foo]]  [file normalize [file join
dir2.link inside.file foo]]

---- Result was:
not equal:
/local/src/tcl/solaris/dir.file/linkinside.file/foo
/local/src/tcl/solaris/dir.file/inside.file/foo
---- Result should have been (exact matching):
1
==== filesystem-1.10 FAILED

==== filesystem-1.11 link normalisation: double link,
back in tree FAILED
==== Contents of test case:

    file link [file join dir2.file dir2.link] dir2.link
    testPathEqual [file normalize [file join dir.file
linkinside.file foo]]  [file normalize [file join
dir2.file dir2.link inside.file foo]]

---- Result was:
not equal:
/local/src/tcl/solaris/dir.file/linkinside.file/foo
/local/src/tcl/solaris/dir2.file/dir2.link/inside.file/foo
---- Result should have been (exact matching):
1
==== filesystem-1.11 FAILED


==== filesystem-1.26 link normalisation: link and .. FAILED
==== Contents of test case:

    file delete -force dir2.link
    set dir [file join dir2 foo bar]
    file mkdir $dir
    file link dir2.link [file join dir2 foo bar]
    set res [list [file normalize [file join dir2 foo
x]]  [file normalize [file join dir2.link .. x]]]
    if {![string equal [lindex $res 0] [lindex $res 1]]} {
        set res "$res not equal"
    } else {
        set res "ok"
    }

---- Result was:
/local/src/tcl/solaris/dir2/foo/x
/local/src/tcl/solaris/x not equal
---- Result should have been (exact matching):
ok
==== filesystem-1.26 FAILED

==== filesystem-1.28 link normalisation: link with ..
and .. FAILED
==== Contents of test case:

    file delete -force dir2.link
    set dir [file join dir2 foo bar]
    file mkdir $dir
    set to [file join dir2 .. dir2 foo .. foo bar]
    file link dir2.link $to
    set res [list [file normalize [file join dir2 foo
x]]  [file normalize [file join dir2.link .. x]]]
    if {![string equal [lindex $res 0] [lindex $res 1]]} {
        set res "$res not equal"
    } else {
        set res "ok"
    }

---- Result was:
/local/src/tcl/solaris/dir2/foo/x
/local/src/tcl/solaris/x not equal
---- Result should have been (exact matching):
ok
==== filesystem-1.28 FAILED
vincentdarleyplain2003-12-14 17:54:26
Logged In: YES 
user_id=32170

Most of those tests are 'macOrUnix', so don't run on my
default platform (Windows, where file-symlinks don't exist).

I always run 'make test' on Windows, and when sf's veyr
flaky compilefarm authorization works, on there too.

Anyway, these new test failures are probably a consequence
of newly allowing Tcl to create relative links (previously
they were all converted to absolute paths).

An update to tclPathObj has been checked it, which will
probably fix some of these.

It would also be helpful to know if your platform has
'realpath()' or not.
dgpplain2003-12-15 22:28:31
Logged In: YES 
user_id=80530


sorry to be grumpy.  The good news
is that there were tests at all. 

Yes, some of those failures are fixed now.

Still failing today are tests fileSystem-1.{7,9,10,11}

judging solely by the installed documentation,
it appears that on both platforms where I see
these tests fail, there is a realpath() system call,
apparently provided by <stdlib.h>
vincentdarleyplain2003-12-17 17:13:43
Logged In: YES 
user_id=32170

Hmm, can you look at what the links are that are created
with this:

if {[catch {
    file link link.file gorp.file 
    file link \
      [file join dir.dir linkinside.file] \
      [file join dir.dir inside.file]
    file link dir.link dir.dir
    file link [file join dir.dir dirinside.link] \
      [file join dir.dir dirinside.dir]
}]} {
    tcltest::testConstraint hasLinks 0
} else {
    tcltest::testConstraint hasLinks 1
}

In particular the 'linkinside.file' link is the one causing
the problems here, and those problems are almost certainly
caused by the tclUnixFile.c changes to support creation of
relative links. The problem here is that I'm not sure how to
define the link that is created. We're doing:

file link dir.dir/linkinside.file dir.dir/inside.file

i.e.  ln -s dir.dir/inside.file dir.dir/linkinside.file

But Tcl will now, I think, try to create a link
'linkinside.file' pointing to 'dir.dir/inside.file' which
isn't really correct, since the cwd is different for the two
cases.

Any ideas how this is defined consistently for 'ln'?  We
should have Tcl's file-link do the same....
vincentdarleyplain2003-12-17 17:25:54
Logged In: YES 
user_id=32170

Ok, a bit of experimentation on a unix system shows that
'file link' should really throw an error in this case (it
doesn't allow you to create links to non-existent things).

Will have to fix tclUnixFile.c and the test suite.
vincentdarleyplain2003-12-17 19:48:47
File Added - 70833: fsfix.diff

Logged In: YES 
user_id=32170

Please test the attached patch.
dgpplain2003-12-17 23:24:22
Logged In: YES 
user_id=80530


After applying that patch,
the test results are different.
Now these four tests fail
(on both Solaris 9 and Linux/Alpha):

==== fCmd-26.2 TclDeleteFilesCmd: delete dir with symlink FAILED
==== Contents of test case:

    catch {file delete -force -- tfad1 tfad2}

    file mkdir tfad1
    file mkdir tfad2
    file link -symbolic [file join tfad2 link] tfad1
    file delete -force tfad2

    set r1 [file isdir tfad1]
    set r2 [file exists tfad2]
    
    set result [expr $r1 && !$r2]
    file delete tfad1
    set result

---- Test generated error; Return code was: 1
---- Return code should have been one of: 0 2
---- errorInfo: could not create new link "tfad2/link":
target "tfad1" doesn't exist
    while executing
"file link -symbolic [file join tfad2 link] tfad1"
    ("uplevel" body line 6)
    invoked from within
"uplevel 1 $script"
---- errorCode: NONE
==== fCmd-26.2 FAILED

==== fCmd-28.20 file link: relative paths FAILED
==== Contents of test case:

    cd [temporaryDirectory]
    file mkdir d1/d2/d3
    list [catch {file link d1/l2 d1/d2} res] $res

---- Result was:
1 {could not create new link "d1/l2": target "d1/d2" doesn't
exist}
---- Result should have been (exact matching):
1 d1/d2
==== fCmd-28.20 FAILED


==== fCmd-28.22 file link: relative paths FAILED
==== Contents of test case:

    cd [temporaryDirectory]
    file mkdir d1/d2/d3
    list [catch {file link d1/l2 d2/d3} res] $res

---- Result was:
1 {could not create new link "d1/l2": that path already exists}
---- Result should have been (exact matching):
0 d2/d3
==== fCmd-28.22 FAILED

==== filesystem-1.11 link normalisation: double link, back
in tree FAILED
==== Contents of test case:

    file link [file join dir2.file dir2.link] dir2.link
    testPathEqual [file normalize [file join dir.dir
linkinside.file foo]]  [file normalize [file join dir2.file
dir2.link inside.file foo]]

---- Test generated error; Return code was: 1
---- Return code should have been one of: 0 2
---- errorInfo: could not create new link
"dir2.file/dir2.link": target "dir2.link" doesn't exist
    while executing
"file link [file join dir2.file dir2.link] dir2.link"
    ("uplevel" body line 2)
    invoked from within
"uplevel 1 $script"
---- errorCode: NONE
==== filesystem-1.11 FAILED
vincentdarleyplain2003-12-17 23:40:07
File Deleted - 70833: 



File Added - 70860: fsfix.diff

Logged In: YES 
user_id=32170

Thanks -- please try the attached new patch.  It should be
very close now.
dgpplain2003-12-18 00:26:13
Logged In: YES 
user_id=80530


After applying that patch, test
fCmd-28.20 needs another 
close-brace at the end for proper
syntax.

After making that typo correction,
all tests pass.  Success!
vincentdarleyplain2003-12-18 00:48:43
Logged In: YES 
user_id=32170

Applied the patch -- thanks for all the testing; this also
uncovered some problems on Windows...
Log in (anonymous is fine) to add a comment.

Attachments: