Skip to content
Tcl Source Code View Ticket
Login

View Ticket

test failures for cross-compiled HEAD

Closed / Invalid585178ffffffffffffffffffffffffffffffffffCreated 24 years agoUpdated 24 years ago
Descriptionplain2002-07-22 23:59:50
I've cross-compiled tcl HEAD as of 22.07.02 (that's
post tcl8.b1) with  mingw32 cross-compiler based on
gcc-2.95.3 and version 1.3 of the mingw-runtime and
w32api as described at http://mini.net/tcl/3102.
Running the test suite the following tests failed for
this cross-compiled tclsh, but not for a tclsh compiled
from the same sources with VC++ 6.0 on the test
maschine, a w2k:


cmdAH-29.4.1
fCmd-28.11
fCmd-28.12
fCmd-28.13
fCmd-28.15
fCmd-28.16
fCmd-28.17
fCmd-28.18
filename-11.17.2
filename-11.17.3
filename-11.17.4

All this failed tests seems to have to do with [file
link ...]. I append the detailed test run output for
this tests. 

rolf

==== cmdAH-29.4.1 Tcl_FileObjCmd: type FAILED
==== Contents of test case:

    set tempdir [makeDirectory temp]
    set linkdir [file join [temporaryDirectory] link.dir]
    file link -symbolic $linkdir $tempdir
    set result [file type $linkdir]
    file delete $linkdir
    removeDirectory $tempdir
    set result

---- Result was:
could not create new link
"C:/local/devel/mwing-tcl/tclHEAD-mingwbin/link.dir"
pointing to
"C:/local/devel/mwing-tcl/tclHEAD-mingwbin/temp":
invalid argument
---- Result should have been (exact matching):
link
---- Test generated error; Return code was: 1
---- Return code should have been one of: 0 2
==== cmdAH-29.4.1 FAILED


==== fCmd-28.11 file link: success with directory FAILED
==== Contents of test case:

    cd [temporaryDirectory]
    file delete -force abc.link
    set res [list [catch {file link abc.link abc.dir}
msg] $msg]
    cd [workingDirectory]
    set res

---- Result was:
1 {could not create new link "abc.link" pointing to
"abc.dir": invalid argument}
---- Result should have been (exact matching):
0 abc.dir
==== fCmd-28.11 FAILED


==== fCmd-28.12 file link: cd into a link FAILED
==== Contents of test case:

    cd [temporaryDirectory]
    file delete -force abc.link
    file link abc.link abc.dir
    set orig [pwd]
    cd abc.link
    set dir [pwd]
    cd ..
    set up [pwd]
    cd $orig
    # now '$up' should be either $orig or [file dirname
abc.dir],
    # depending on whether 'cd' actually moves to the
destination
    # of a link, or simply treats the link as a directory.
    # (on windows the former, on unix the latter, I
believe)
    if {([file normalize $up] != [file normalize
$orig])  && ([file normalize $up] != [file normalize
[file dirname abc.dir]])} {
set res "wrong directory with 'cd $link ; cd ..'"
    } else {
set res "ok"
    }
    cd [workingDirectory]
    set res

---- Result was:
could not create new link "abc.link" pointing to
"abc.dir": invalid argument
---- Result should have been (exact matching):
ok
---- Test generated error; Return code was: 1
---- Return code should have been one of: 0 2
==== fCmd-28.12 FAILED


==== fCmd-28.13 file link FAILED
==== Contents of test case:

    # duplicate link throws error
    cd [temporaryDirectory]
    set res [list [catch {file link abc.link abc.dir}
msg] $msg]
    cd [workingDirectory]
    set res

---- Result was:
1 {could not create new link "abc.link" pointing to
"abc.dir": invalid argument}
---- Result should have been (exact matching):
1 {could not create new link "abc.link": that path
already exists}
==== fCmd-28.13 FAILED


==== fCmd-28.15 file link: copies link not dir FAILED
==== Contents of test case:

    cd [temporaryDirectory]
    file delete -force abc.link
    file link abc.link abc.dir
    file copy abc.link abc2.link
    set res [list [file type abc2.link] [file tail
[file link abc2.link]]]
    cd [workingDirectory]
    set res

---- Result was:
could not create new link "abc.link" pointing to
"abc.dir": invalid argument
---- Result should have been (exact matching):
link abc.dir
---- Test generated error; Return code was: 1
---- Return code should have been one of: 0 2
==== fCmd-28.15 FAILED


==== fCmd-28.16 file link: glob inside link FAILED
==== Contents of test case:

    cd [temporaryDirectory]
    file delete -force abc.link
    file link abc.link abc.dir
    set res [glob -dir abc.link -tails *]
    cd [workingDirectory]
    set res

---- Result was:
could not create new link "abc.link" pointing to
"abc.dir": invalid argument
---- Result should have been (exact matching):
abc.file abc2.file
---- Test generated error; Return code was: 1
---- Return code should have been one of: 0 2
==== fCmd-28.16 FAILED


==== fCmd-28.17 file link: glob -type l FAILED
==== Contents of test case:

    cd [temporaryDirectory]
    set res [glob -dir [pwd] -type l -tails abc*]
    cd [workingDirectory]
    set res

---- Result was:
no files matched glob pattern "abc*"
---- Result should have been (exact matching):
abc.link
---- Test generated error; Return code was: 1
---- Return code should have been one of: 0 2
==== fCmd-28.17 FAILED


==== fCmd-28.18 file link: glob -type d FAILED
==== Contents of test case:

    cd [temporaryDirectory]
    set res [lsort [glob -dir [pwd] -type d -tails abc*]]
    cd [workingDirectory]
    set res

---- Result was:
abc.dir abc2.dir
---- Result should have been (exact matching):
abc.dir abc.link abc2.dir
==== fCmd-28.18 FAILED



==== filename-11.17.2 Tcl_GlobCmd FAILED
==== Contents of test case:

    set dir [pwd]
    set ret "error in test"
    if {[catch {
cd $globname
file link -symbolic link a1
cd $dir
set ret [list [catch {
    lsort [glob -directory $globname -join * b1]
} msg] $msg]
    }]} {
cd $dir
    }
    file delete [file join $globname link]
    set ret

---- Result was:
error in test
---- Result should have been (exact matching):
0 {globTest/a1/b1 globTest/link/b1}
==== filename-11.17.2 FAILED


==== filename-11.17.3 Tcl_GlobCmd FAILED
==== Contents of test case:

    set dir [pwd]
    set ret "error in test"
    if {[catch {
cd $globname
file link -symbolic link a1
cd $dir
set ret [list [catch {
    lsort [glob -directory $globname -type d *]
} msg] $msg]
    }]} {
cd $dir
    }
    file delete [file join $globname link]
    set ret

---- Result was:
error in test
---- Result should have been (exact matching):
0 {globTest/a1 globTest/a2 globTest/a3 globTest/link}
==== filename-11.17.3 FAILED


==== filename-11.17.4 Tcl_GlobCmd FAILED
==== Contents of test case:

    set dir [pwd]
    set ret "error in test"
    if {[catch {
cd $globname
file link -symbolic link a1
cd $dir
set ret [list [catch {
    lsort [glob -directory $globname -type l *]
} msg] $msg]
    }]} {
cd $dir
    }
    file delete [file join $globname link]
    set ret

---- Result was:
error in test
---- Result should have been (exact matching):
0 globTest/link
==== filename-11.17.4 FAILED
vincentdarleyplain2002-07-23 16:14:17
Logged In: YES 
user_id=32170

Sorry not to be more helpful, but I don't know what the 
problem is here.  I don't cross-compile Tcl, and since 
the problem only occurs there it is probably something 
to do with the header files or #defines that are used, 
since the code itself is known to work.  You're going to 
have to do some debugging.   I view it as a build issue.

Assigned to someone who does to cross-compiling.
mdejongplain2002-07-23 16:58:52
Logged In: YES 
user_id=90858

I don't think this has anything to do with
cross compiling Tcl. I am seeing problems
like the one you describe when compiling
with the native version of Mingw under
Win98. I would suggest that you take a look
at the compiled code inside a debugger and
see what is different between the VC++
version and the Mingw compiled version.
You may want to close this bug report and
open a new one, but it would be better to
look into the problem first.
pointsmanplain2002-07-24 02:53:41
Logged In: YES 
user_id=13222

Vince,

sure, could of course be a build problem or a problem of the
cross-compiler - I'm not able to decide this. But I have
some doubt.

<rant>
Obviously, you are able to claim "the code itself is known
to work" - well, absolute? as a given fact? as a law of
nature? for all platforms and compilers? You're the expert
in this area - at least I know for sure, that I'm not an
expert for this - so I stand corrected. Really? At least it
gives me a bad feeling. I'm sorry that I had the frivolity,
to report test results.
</rant>

For sure I understand, that you are not run any platform and
any compiler, that one may use. I am willing to help, if you
would say: "Could you try this and that, and tell me the
outcome?". 

Let me try it one more time, with as much info I could give.
The list of tests, I gave, are *all* tests, that failed with
the cross-compiled tclsh, but not with the VC++ compiled
tclsh. (Some more tests failed for both tclsh, all of them
are already 'known').

I find it conspicuous, that all this failed tests seems to
fail because of a [file link ...]. But it's eventually
wrong, to conclude that some winapi function of the
cross-compiler for creating links is simply broken. Even a
blockhead like me was able to realize within a minute, that
other tests with [file link ...] *do* work. So, why does -
for example - test cmdAH-29.4 work, but cmdAH-29.4.1 does not ?

Another though: Most of the failed fCmd tests return the
error msg "could not create new link ".." pointing to "..":
invalid argument" instead of the expected result. Sure, I
also could dig around in the code. Seems, the error msg come
out of Tcl_FileObjCmd() ? You're the maintainer - eventually
even the author -, therefor I suspect, you know the code
much better man me (I don't know it at all). Seeing an error
msg and knowing the test code, that triggered it, it should
be much more easier for you, to say, from which parts of the
code the error msg came and what probably goes wrong at this
point, what reasons it may have, that it goes wrong and what
to do, to get more insight.

Since you don't use a cross-compiler, you could not do
tests, of course, but simply ask me, to insert debugging
code at this or that place etc. - I'll tell you the results.
Even if it turns out in the end, that the problem is indeed
not in the filesystem code, but, let's say, a build problem,
it's your knowledge about and experience with the code, that
could help to track the problem.

Therefor I ask you again, to take a look at the failed tests
(to say the truth, I have the impression you haven't done
this, as yet) - eventually that may trigger an idea, how to
search further.

rolf
nobodyplain2002-07-24 04:24:49
Logged In: NO 

Ok, you've convinced me, I will look more closely at this, and try to 
come up with some suggestions -- Vince.
vincentdarleyplain2002-07-24 18:36:57
Logged In: YES 
user_id=32170

Ok, first thing cmdAH-29.4 doesn't pass. It 
is 'unixOnly' and so never runs.  It could be, therefore, 
that no use of 'file link' actually passes here at all.

So, the first thing to determine, I think, is why a very 
simple test like cmdah-29.4.1 fails.  All it does is create 
a directory link and then check the type of the link and 
then cleanup.

From the test failure, it is clear that the creation of the 
link fails, as you've said.  This means that something 
inside TclpObjLink fails (tclWinFile.c), assuming 
that 'S_IFLNK' is defined.  This define should be forced 
to true in tclWinPort.h, but if you look at the #includes 
in tclWinFile.c:

#include "tclWinInt.h"
#include <winioctl.h>
#include <sys/stat.h>
#include <shlobj.h>
#include <lmaccess.h>

Now, what if mingw actually #undefs or otherwise 
modifies that symbol in any of the <*.h> files 
afterwards?  This is the first thing to check -- perhaps 
easiest is to replace TclpObjLink by garbage and see if 
the compiler notices anything.

Assuming it does notice something, then we should 
check if TclpObjLink is being called.  Put a 'printf' at the 
beginning of the function.  Also put a printf to 
output 'LinkTarget' and 'LinkSource' in the middle of the 
function and re-run just test cmdAH-29.4.1...

I won't continue right now, since the above may already 
show us where the problem is (else we have to continue 
deeper into the code...)

cheers,

Vince.
pointsmanplain2002-07-24 22:04:27
Logged In: YES 
user_id=13222

Vince,

thank you for jumping in !

TclpObjLink() definitely is being called. 

Assuming TCHAR is basically something like 'typedef char
TCHAR' I inserted

    if (toPtr != NULL) {
        int res;
        TCHAR* LinkTarget = (TCHAR*)Tcl_FSGetNativePath(toPtr);
        TCHAR* LinkSource =
(TCHAR*)Tcl_FSGetNativePath(pathPtr);
        fprintf (stderr, "LinkTarget: '%s' LinkSource: '%s'\n",
                     LinkTarget, LinkSource);
        if (LinkSource == NULL || LinkTarget == NULL) {
            return NULL;
        }
        /* etc. */

Running the test, that gave me:

LinkTarget: 'C' LinkSource: 'C'

which looks strange. But if I inserted that debugging
fprintf() from above also on my w2k box into the source, and
compiled with VC++ 6.0, I got the same output!. Which
datatype, the heck, has TCHAR ? tchars.h out of the VC++
include dir seems to suggest, it's something like char, but
I'm really not sure. 

I also inserted

        fprintf (stderr, "LinkTarget: '%s' LinkSource: '%s'\n",
                      Tcl_GetString (toPtr), Tcl_GetString
(pathPtr));

This gave me absolute paths, in Tcl style, exactly the ones,
that are also shown in the test output.

Please, could you guide me a bit further?

rolf
nobodyplain2002-07-25 00:13:39
Logged In: NO 

Did you get my private emails on this topic -- let's 
pursue on email it is less hassle than sourceforge for 
interaction...
vincentdarleyplain2002-08-05 16:21:19
Logged In: YES 
user_id=32170

Private emails showed that this is a problem in the 
headers which come with mingw, and not a Tcl 
problem.  It could be worked-around in tclWinFile.c, if 
desired (and if someone provides a tested patch), by 
forcing the correct defintions of various #defines.
mdejongplain2002-08-06 10:53:14
Logged In: YES 
user_id=90858

What exactly is the problem and solution that you guys
talked about
in private? It seems kind of pointless to close this bug report
without fixing the problem first.
vincentdarleyplain2002-08-06 16:18:42
Logged In: YES 
user_id=32170

Mo, I suggest you follow up direct with Rolf.  The source 
code is fine.  There appear to be some bad #defines in 
the mingw headers.  One could force the #defines in 
tclWinFile.c to override mingw to fix the problem --
vince.
Log in (anonymous is fine) to add a comment.