Subject: Re: Tcl7.4 and Tk4.0
To: None <netbsd-help@NetBSD.ORG>
From: Alistair G. Crooks <azcb0@juts.ccc.amdahl.com>
List: netbsd-help
Date: 02/20/1996 08:37:00
>    Has anyone managed to get a fully functioning set of Tcl7.4 and 
> Tk4.0 running on NetBSD1.1 ??
>  
> I am using an Amiga 3000 running NetBSD1.1 with gcc2.7.2 and can 
> get both packages to compile but I get errors running the test 
> programs.
>  
> The Tk4.0 test programs give a large number of errors, none of 
> which seem to be fatal. The Tcl7.4 test programs come up with the
> following errors which cause problems later when trying to run the
> TclX7.4a extensions.

I put both of these down to NetBSD's lack of a unified buffer/VM cache.
  
> file.test
>  
> ==== file-11.1 mtime and atime and size options
> ==== Contents of test case:
>  
>     catch {unset stat}
>     file stat gorp.file stat
>     list [expr {[file mtime gorp.file] == $stat(mtime)}]  [expr {[file atime gorp.file] == $stat(atime)}]  [file size gorp.file]
>  
> ==== Result was:
> 1 1 0
> ---- Result should have been:
> 1 1 11
> ---- file-11.1 FAILED

i.e. this test tells you that the size of the file `gorp.file' that
was found was 0 bytes, whilst it should have been 11 bytes.

> ==== file-11.3 size option
> ==== Contents of test case:
>  
>     set oldsize [file size gorp.file]
>     set f [open gorp.file a]
>     puts $f "More text"
>     close $f
>     expr {[file size gorp.file] - $oldsize}
>  
> ==== Result was:
> 0
> ---- Result should have been:
> 10
> ---- file-11.3 FAILED

This one is more obvious - the tcl code here opens a file called
`gorp.file' in append mode, appends the string "More text\n" to the
file, then closes it.  It then uses stat(2) to compare the new size of
the file, against the old one, expecting there to be 10 more bytes. 
Because the version of the file that was "stat"ed wasn't the same
version which had the "More text" appended to it, presumably because
one version existed in the VM cache and the other in the buffer cache,
the difference that you found was 0 bytes.

> I am not sure where to look in the source to fix this.

There is a directory /sys/vm which needs to be sorted out. This would
best be done (for the moment) by importing the FreeBSD-current vm code.
:-)

Alistair
--
Alistair G. Crooks (agc@uts.amdahl.com)                    +44 125 234 6377
Amdahl European HQ, Dogmersfield Park, Hartley Wintney, Hants RG27 8TE, UK.
[These are only my opinions, and certainly not those of Amdahl Corporation]