Tcl Source Code

View Ticket
Login
Ticket UUID: 859251
Title: new fileSystem.test failures
Type: Bug Version: obsolete: 8.5a0
Submitter: dgp Created on: 2003-12-12 23:54:32
Subsystem: 37. File System Assigned To: vincentdarley
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2003-12-18 00:48:43
Resolution: Fixed Closed By: vincentdarley
    Closed on: 2003-12-17 17:48:43
Description:
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
User Comments: vincentdarley added on 2003-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...

dgp added on 2003-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!

vincentdarley added on 2003-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.

dgp added on 2003-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

vincentdarley added on 2003-12-17 19:48:47:

File Added - 70833: fsfix.diff

Logged In: YES 
user_id=32170

Please test the attached patch.

vincentdarley added on 2003-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.

vincentdarley added on 2003-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....

dgp added on 2003-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>

vincentdarley added on 2003-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.

Attachments: