Skip to content
Tcl Source Code View Ticket
Login

View Ticket

cmdAH-8.43, 8.45 fail spuriously when /home is symlink

Closed / Fixed703264ffffffffffffffffffffffffffffffffffCreated 24 years agoUpdated 24 years ago
Descriptionplain2003-03-13 22:24:18
On my machine, /home is a symlink to /work2 -- a
possibility that the tests cmdAH-8.43 and cmdAH-8.45
does not consider.  The results I see reported as
erroneous are in fact correct:


==== cmdAH-8.43 Tcl_FileObjCmd: dirname FAILED
==== Contents of test case:

    global env
    set temp $env(HOME)
    set env(HOME) "/home/test"
    testsetplatform unix
    set result [list [catch {file dirname ~} msg] $msg]
    set env(HOME) $temp
    set result

---- Result was:
0 /work2
---- Result should have been (exact matching):
0 /home
==== cmdAH-8.43 FAILED


==== cmdAH-8.45 Tcl_FileObjCmd: dirname FAILED
==== Contents of test case:

    global env
    set temp $env(HOME)
    set env(HOME) "/home/test"
    testsetplatform windows
    set result [list [catch {file dirname ~} msg] $msg]
    set env(HOME) $temp
    set result

---- Result was:
0 /work2
---- Result should have been (exact matching):
0 /home
==== cmdAH-8.45 FAILED

Having reviewed these failures, I am quite confident
about going ahead and installing the software.

Reported by: Jonathan Leffler <[email protected]>
<[email protected]>

Test environment is Sun UltraSparc, Solaris 7, GCC
3.2.1, Tcl 8.4.2, not that any of these are
particularly important to reproducing this problem. 
The only key to the reproduction is that /home is a
symlink to somewhere else.

One day, I'll get my Sourceforge ID reactivated.
dkf Ticket [703264ffff]: 1 change [History diff]2003-03-14 21:30:10
vincentdarleyplain2003-03-17 22:27:05
Logged In: YES 
user_id=32170

Does replacing the result line of those tests with:

} [list 0 [expr {([file type /home] == "link") ? "/home" : 
[file readlink /home]}]]

solve this testsuite issue?
vincentdarleyplain2003-03-17 22:33:58
Logged In: YES 
user_id=32170

Make that:

} [list 0 [expr {([file exists /home] && ([file type /home] 
== "link")) ? [file readlink /home] : "/home"}]]

works for me.
jlefflerplain2003-03-19 01:39:58
Logged In: YES 
user_id=22937

I modified cmdAH.test with the 'make that' version of the
change, and to my considerable surprise, cmdAH-8.43 still
failed as before but cmdAH-8.45 now passed.  The only
difference between these two tests is the testsetplatorm
(unix in 8.43, windows in 8.45).  I don't understand this
result.  I did  a double-check to ensure that I had the same
change in both places, and that was correct.  I also
reverted to the original test and got the double failure
again as originally reported.  Frankly, I'm not sure how to
debug this...
vincentdarleyplain2003-03-19 01:44:38
Logged In: YES 
user_id=32170

How about reverting to the original test, but 
replacing '/home' by '/homewontexist' i.e. a name that 
shouldn't actually exist on anyone's machine?

Seems to be closer in spirit to what the test is actually 
trying to do.
jlefflerplain2003-03-19 05:09:40
Logged In: YES 
user_id=22937

If the tests are indeed meant to be testing for a
non-existent directory, then yes, use a more obscure name --
/home/test doesn't sound very improbable to me.  In such
cases, I use a long name that makes it quite clear that it
is not supposed to exist --
/you/should/not/have/created/this/directory.  That is much
simpler to analyse -- I'd certainly recommend that if the
test is really trying to deal with non-existent directories.
 Another, less reliable but probably OK alternative, is to
use /syzygy/nadir/zenith or something similarly obscure,
watching for whether you need to obey 8.3 or similar
filename limitations.
vincentdarleyplain2003-04-11 23:32:26
Logged In: YES 
user_id=32170

fixed in cvs head
Log in (anonymous is fine) to add a comment.