Re: [sqlite] Sqlite 3.3.13; expr.c; analyzeAggregate

2007-03-12 Thread drh
"Noah Hart" <[EMAIL PROTECTED]> wrote:
> In expr.c, around line 2253, there is a nested loop which reads:
> 
> for(i=0; inSrc; i++, pItem++){
>   if( pExpr->iTable==pItem->iCursor ){
> for(i=0; inSrc; i++, pItem++){
>   if( pCol->iTable==pExpr->iTable &&
>   pCol->iColumn==pExpr->iColumn ){
> break;
>   }
> }
> if( i>=pAggInfo->nColumn ... ){
> }
> break;
>   }
> }
> 
> In this final line, which loop variable does the i refer to?
> the first one: for(i=0; inSrc; i++, pItem++){
> Or then next : for(i=0; inSrc; i++, pItem++){
> 
> are the two "i" the same variable, and it is intended that the
> second loop reset the Outer loop variable each time the inner 
> loop is run, and that the assignment statement affect the outer 
> loop as well?
> 

Once the first "if" statement fires, the outer loop is done, and 
it is ok to reuse the outer loop variable inside the "if".  So the 
code is correct as written. Nevertheless, I have changed the loop 
variable on the inner loop to avoid unnecessary confusion.

--
D. Richard Hipp  <[EMAIL PROTECTED]>


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] SQLite-3.3.13

2007-02-15 Thread Martin Jenkins

[EMAIL PROTECTED] wrote:

Martin Jenkins <[EMAIL PROTECTED]> wrote:

Raised as ticket http://www.sqlite.org/cvstrac/tktview?tn=2232



Thanks.  Bug reports are always welcomed.

But this problem was fixed yesterday.  When you see problems in
SQLite, especially problems that have been discussed on this
mailing list, it is useful to visit the timeline to see if they
have been fixed already.


Noted, my bad. There weren't any comments on the list so I assumed I was 
talking to myself. Warnock applies. ;)


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] SQLite-3.3.13

2007-02-15 Thread drh
Martin Jenkins <[EMAIL PROTECTED]> wrote:
> Raised as ticket http://www.sqlite.org/cvstrac/tktview?tn=2232
> 

Thanks.  Bug reports are always welcomed.

But this problem was fixed yesterday.  When you see problems in
SQLite, especially problems that have been discussed on this
mailing list, it is useful to visit the timeline to see if they
have been fixed already.

   http://www.sqlite.org/cvstrac/timeline

The items with the blue dots beside them are check-ins.  I try to
put descriptive comments on each check-in to make it clear what has
changed.  If you want more information, you can click on the link
(the [3645] in this case) to see more details, including complete
diffs.  The timeline is a very useful tool to see what has been
going on with the SQLite source code.  If you are not already
familiar with the timeline, please let me call it to your attention.

Please do not interpret this message as criticism for opening a
redundant ticket - I don't mind that.  I am just using this
opportunity to point out the utility of the timeline to the many
viewers of this list (there are over 1200 subscribers) who might 
not be aware of its usefulness.  I also want to point out that 
while I do not frequently respond to reports of issues on the 
mailing list, I do in fact read them all and sometimes actually 
act upon them.

--
D. Richard Hipp  <[EMAIL PROTECTED]>


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] SQLite-3.3.13

2007-02-15 Thread Martin Jenkins

Raised as ticket http://www.sqlite.org/cvstrac/tktview?tn=2232

Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] SQLite-3.3.13

2007-02-14 Thread Martin Jenkins

Martin Jenkins wrote:

I haven't tested the other versions of Tcl yet.


I have now. s/a/RDRW/ makes corrupt2.test work with  Tcl 8.4.9, 8.4.12, 
8.4.14 and 8.5a5 on recent versions of Debian/Ubuntu on sparc64 and x86.


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] SQLite-3.3.13

2007-02-14 Thread Martin Jenkins

[EMAIL PROTECTED] wrote:

I get the same problem on OS-X.  But it appears to be a bug
in the older version of TCL you have installed, not in SQLite
itself.  Nothing to worry about.  Thanks for reporting it, though.


I was trying to make a test case to report the Tcl bug and noticed that 
(in 8.5a5 at least) they added some extra file mode tests. After looking 
at those tests I now think this is a bug in the SQLite test suite.


ISTM opening files in corrupt2-1.x with an 'a' flag writes all changes 
to the end, which is what I'm seeing. 'a' for append. I think the files 
should be opened with a 'RDWR' flag instead. Making that changes means 
the tests pass under Tcl 8.5a5 but I haven't tested the other versions 
of Tcl yet. I don't know why the test passed under Tcl8.4.9 either.


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] SQLite-3.3.13

2007-02-13 Thread Martin Jenkins

[EMAIL PROTECTED] wrote:

> in the older version of TCL you have installed, not in SQLite

Hmm. It's definitely a Tcl bug, but I'm not convinced about it being in 
the older Tcl that I have - the SPARC machine that fails corrupt2.test 
has a newer version than the PC that passes.


[later]

I built tcl8.4.14 and tcl8.5a5 on both machines and the corrupt2.test 
fails identically under both versions. There were some new failures in 
8.5a5; a couple of printf.test tests fail because of a minor formatting 
mismatch and a tclsqlite.test fails because of a new error message.


I built tcl8.4.9 from source on both machines and all tests pass on both.

So, the failure is a regression in Tcl sometime between 8.4.9 and 
8.4.14. I'm going to wimp out and file a bug report rather than spend 
any more time pinning down the exact version.


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] SQLite-3.3.13

2007-02-13 Thread Martin Jenkins

[EMAIL PROTECTED] wrote:

I get the same problem on OS-X.  But it appears to be a bug
in the older version of TCL you have installed, not in SQLite
It's definitely a bug in Tcl. I'll post the log for posterity and get a 
newer version.


[EMAIL PROTECTED]:~/dev/sqlite/bld$ echo "Hello SQLite" >  fred
[EMAIL PROTECTED]:~/dev/sqlite/bld$ echo "Hello SQLite" >> fred
[EMAIL PROTECTED]:~/dev/sqlite/bld$ echo "Hello SQLite" >> fred
[EMAIL PROTECTED]:~/dev/sqlite/bld$ echo "Hello SQLite" >> fred
[EMAIL PROTECTED]:~/dev/sqlite/bld$ cat fred
Hello SQLite
Hello SQLite
Hello SQLite
Hello SQLite
[EMAIL PROTECTED]:~/dev/sqlite/bld$ cat tcl.test
source ../test/tester.tcl

do_test test_tcl {
 set f [open fred a]
 seek $f 8 start
 puts $f blah
 close $f
} {}
[EMAIL PROTECTED]:~/dev/sqlite/bld$ ./testfixture tcl.test
test_tcl... Ok
[EMAIL PROTECTED]:~/dev/sqlite/bld$ cat fred
Hello SQLite
Hello SQLite
Hello SQLite
Hello SQLite
blah

Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] SQLite-3.3.13

2007-02-13 Thread drh
Martin Jenkins <[EMAIL PROTECTED]> wrote:
> Build fails on Solaris 9/Ultra5/csw tools
> Can't find 'ar' so substitutes and attempts to fun 'false'
> TMP FIX: AR=gar ../configure...
> 
> corrupt2 tests fail on Solaris 9/Ultra5/csw tools
>  Test file is not actually corrupted (ie altered at all AFAICS)
> 

I get the same problem on OS-X.  But it appears to be a bug
in the older version of TCL you have installed, not in SQLite
itself.  Nothing to worry about.  Thanks for reporting it, though.
--
D. Richard Hipp  <[EMAIL PROTECTED]>


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] SQLite-3.3.13

2007-02-13 Thread Martin Jenkins

Martin Jenkins wrote:

corrupt2 tests fail on Solaris 9/Ultra5/csw tools
Test file is not actually corrupted (ie altered at all AFAICS)
Exact same failure on a fresh Debian 3.1r4 install too. All other tests 
passed OK.


[EMAIL PROTECTED]:~/dev/sqlite/bld$ uname -a
Linux ultra5b 2.4.27-3-sparc64 #1 Thu Sep 14 07:31:38 UTC 2006 sparc64 
GNU/Linux

[EMAIL PROTECTED]:~/dev/sqlite/bld$ ./testfixture ../test/corrupt2.test
corrupt2-1.1... Ok
corrupt2-1.2...
Expected: [1 {file is encrypted or is not a database}]
Got: [0 {table abc abc 2 {CREATE TABLE abc(a, b, c)}}]
corrupt2-1.3...
Expected: [1 {file is encrypted or is not a database}]
Got: [0 {table abc abc 2 {CREATE TABLE abc(a, b, c)}}]
corrupt2-1.4...
Expected: [1 {database disk image is malformed}]
Got: [0 {table abc abc 2 {CREATE TABLE abc(a, b, c)}}]
corrupt2-1.5...
Expected: [1 {database disk image is malformed}]
Got: [0 {table abc abc 2 {CREATE TABLE abc(a, b, c)}}]
Thread-specific data deallocated properly
4 errors out of 6 tests
Failures on these tests: corrupt2-1.2 corrupt2-1.3 corrupt2-1.4 corrupt2-1.5

The corruption tests do appear to work (where v3.2.1 does does not), so 
as I said earlier it appears the test harness is not actually corrupting 
the file. I checked the file contents (with a hex viewer) on S9 but 
didn't try manually corrupting it.


[EMAIL PROTECTED]:~/dev/sqlite/bld$ sqlite3 -version
3.2.1
[EMAIL PROTECTED]:~/dev/sqlite/bld$ ./sqlite3 -version
3.3.13

NB I don't exactly replicate the real tests below.

[EMAIL PROTECTED]:~/dev/sqlite/bld$ echo "pragma integrity_check;" | sqlite3 
corrupt.db

ok
[EMAIL PROTECTED]:~/dev/sqlite/bld$ echo "pragma integrity_check;" | ./sqlite3 
corrupt.db

ok

[EMAIL PROTECTED]:~/dev/sqlite/bld$ cp test.db corrupt.db ; dd if=/dev/random 
of=corrupt.db bs=1 count=4 skip=8

4+0 records in
4+0 records out
4 bytes transferred in 0.001219 seconds (3281 bytes/sec)
[EMAIL PROTECTED]:~/dev/sqlite/bld$ echo "pragma integrity_check;" | sqlite3 
corrupt.db

ok
[EMAIL PROTECTED]:~/dev/sqlite/bld$ echo "pragma integrity_check;" | ./sqlite3 
corrupt.db

SQL error near line 1: file is encrypted or is not a database

[EMAIL PROTECTED]:~/dev/sqlite/bld$ cp test.db corrupt.db ; dd if=/dev/random 
of=corrupt.db bs=1 count=4 skip=100

4+0 records in
4+0 records out
4 bytes transferred in 0.001105 seconds (3620 bytes/sec)
[EMAIL PROTECTED]:~/dev/sqlite/bld$ echo "pragma integrity_check;" | sqlite3 
corrupt.db

ok
[EMAIL PROTECTED]:~/dev/sqlite/bld$ echo "pragma integrity_check;" | ./sqlite3 
corrupt.db

SQL error near line 1: file is encrypted or is not a database

[EMAIL PROTECTED]:~/dev/sqlite/bld$ cp test.db corrupt.db ; dd if=/dev/random 
of=corrupt.db bs=1 count=4 skip=200

4+0 records in
4+0 records out
4 bytes transferred in 0.001141 seconds (3506 bytes/sec)
[EMAIL PROTECTED]:~/dev/sqlite/bld$ echo "pragma integrity_check;" | sqlite3 
corrupt.db

ok
[EMAIL PROTECTED]:~/dev/sqlite/bld$ echo "pragma integrity_check;" | ./sqlite3 
corrupt.db

SQL error near line 1: file is encrypted or is not a database

Martin


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] SQLite-3.3.13

2007-02-13 Thread Martin Jenkins

Martin Jenkins wrote:

Build fails on Solaris 9/Ultra5/csw tools
   Can't find 'ar' so substitutes and attempts to fun 'false'
   TMP FIX: AR=gar ../configure...
Forgot - fdatasync is in librt so most of the executables need $(TLIBS)  
added to the end of their recipe.


Martin

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] SQLite-3.3.13

2007-02-13 Thread Martin Jenkins

Build fails on Solaris 9/Ultra5/csw tools
   Can't find 'ar' so substitutes and attempts to fun 'false'
   TMP FIX: AR=gar ../configure...

corrupt2 tests fail on Solaris 9/Ultra5/csw tools
Test file is not actually corrupted (ie altered at all AFAICS)

Not sure how many people (outside of Sun) are using sqlite3 on S9, but 
I'd fired the box up for something else so I thought I'd give it a go. 
The first is obviously down to the age and unmaintained status of the 
autoconf stuff, but the second...  :-/


Martin


-
To unsubscribe, send email to [EMAIL PROTECTED]
-