Sunday, October 31, 2021

Re: LLVM 13 ports build failures (2021-10-27)

Tim van der Molen (2021-10-29 23:46 +0200):
> Christian Weisgerber (2021-10-28 00:16 +0200):
> > databases/sqlcipher
>
> I can't reproduce this on jsg's llvm13 snapshot. Can anyone else?
>
> The errors seem strange, too. It looks as if sqlite3.c somehow was
> generated incorrectly.

I've been able to reproduce this. It seems the problem is with tcl. When
compiled with llvm 13, tclsh8.6 doesn't properly read files larger than
4097 bytes.

Here's an illustration of the problem, simplified as much as I could.

Create the following tcl script, simplified from SQLCipher's
mksqlite3c.tcl:

$ cat test.tcl
set out [open out w]

while {![eof stdin]} {
puts $out [gets stdin]
}

This script should copy stdin to the file "out", and append a newline.

Now create three files of different sizes:

$ (echo abc; for i in $(jot 1022); do echo ddd; done; echo eeee) > good
$ (echo abc; for i in $(jot 1022); do echo ddd; done; echo eeeee) > bad
$ (echo abc; for i in $(jot 1022); do echo ddd; done; echo eeeeeee) > worse
$ wc -c good bad worse
4097 good
4098 bad
4100 worse
12295 total

With an llvm13-compiled tclsh8.6, first run this:

$ /usr/local/bin/tclsh8.6 test.tcl < good
$ diff -u good out
--- good Sun Oct 31 18:53:08 2021
+++ out Sun Oct 31 18:57:13 2021
@@ -1022,3 +1022,4 @@
ddd
ddd
eeee
+

All is well. The only difference is the extra newline at the end.

But now try this:

$ /usr/local/bin/tclsh8.6 test.tcl < bad
$ diff -u bad out
--- bad Sun Oct 31 18:53:08 2021
+++ out Sun Oct 31 18:57:13 2021
@@ -1021,4 +1021,5 @@
ddd
ddd
ddd
-eeeee
+eeeea
+

The last line hasn't been copied correctly. The "a" is from the first
line. It seems that after the 4097th input byte, something wrapped
around and reading continued from the start of the input. This becomes
more obvious with the "worse" file:

$ /usr/local/bin/tclsh8.6 test.tcl < worse
$ diff -u worse out
--- worse Sun Oct 31 18:53:08 2021
+++ out Sun Oct 31 18:57:14 2021
@@ -1021,4 +1021,5 @@
ddd
ddd
ddd
-eeeeeee
+eeeeabc
+
xxx

The "abc" on the last line must have come from the first line.

If you repeat these tests on a regular snapshot, you'll see that in each
case the only difference is the extra newline, as would be expected.

There seem to be more problems with tcl and llvm 13. On a regular
snapshot, running "make test" in /usr/ports/lang/tcl/8.6 gives:

all.tcl: Total 31340 Passed 30023 Skipped 1317 Failed 0

With llvm 13, however:

all.tcl: Total 31340 Passed 29902 Skipped 1317 Failed 121
Files with failing tests: chanio.test encoding.test event.test exec.test http.test http11.test httpold.test io.test iogt.test socket.test timer.test zlib.test

No comments:

Post a Comment