Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 270867 - sqlite-3.6.14.2 can generate bus errors, apparently a regression from 3.6.13
Summary: sqlite-3.6.14.2 can generate bus errors, apparently a regression from 3.6.13
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: Sparc Linux
: High normal (vote)
Assignee: Arfrever Frehtes Taifersar Arahesis (RETIRED)
URL: http://www.sqlite.org/cvstrac/tktview...
Whiteboard:
Keywords:
Depends on:
Blocks: unaligned-access
  Show dependency tree
 
Reported: 2009-05-22 20:28 UTC by Ferris McCormick (RETIRED)
Modified: 2023-05-08 17:27 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
sqlite-3.6.14.2-fix_alignment.patch (sqlite-3.6.14.2-fix_alignment.patch,870 bytes, patch)
2009-05-28 15:37 UTC, Arfrever Frehtes Taifersar Arahesis (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ferris McCormick (RETIRED) gentoo-dev 2009-05-22 20:28:33 UTC
We discovered that pysqlite can build with sqlite-3.6.13, but not with sqlite-3.6.14[.1].  Using the amalgamation source for sqlite-3.6.14.1 (See Bug 270843 ) and running the tests, we encounter a Bus error almost immediately --- aggerror.test, test 4.  The SQL triggering this reduces to:
update t1 set a=41 where a=40;
(which should change the last row in the test.db to 41 from 40).

According to gdb, in this source, we are at line 30221 in sqlite3.c, and the source is:
*pRowid = p->pEntry->v;

A bus error on sparc means that something is misaligned (it's not p, which is 0xb30a8, but beyond that I don't know).  The problem is almost certainly upstream, and appears to be a regression (at least, -3.6.13 works fine with pysqlite).
Comment 1 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2009-05-22 22:41:22 UTC
Have you reported it to SQLite upstream?
Comment 2 Ferris McCormick (RETIRED) gentoo-dev 2009-05-26 12:47:41 UTC
(In reply to comment #1)
> Have you reported it to SQLite upstream?
> 

No, but I can.  I was wrong about amalgamation source --- somehow I got the original tar.gz file instead.  Right now, I'm also looking at 14.2.
Comment 3 Ferris McCormick (RETIRED) gentoo-dev 2009-05-28 14:37:44 UTC
OK, I built sqlite3 from sqlite-amalgamation-3.6.14.2.tar.gz (for real this time) and used it to attempt the tests.  The bus error is still there, so I'll look at sending it upstream.
Comment 4 Ferris McCormick (RETIRED) gentoo-dev 2009-05-28 15:16:32 UTC
(In reply to comment #3)
> OK, I built sqlite3 from sqlite-amalgamation-3.6.14.2.tar.gz (for real this
> time) and used it to attempt the tests.  The bus error is still there, so I'll
> look at sending it upstream.
> 

sqlite - Ticket #3882 
Comment 5 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2009-05-28 15:37:51 UTC
Created attachment 192727 [details, diff]
sqlite-3.6.14.2-fix_alignment.patch

Please test this patch.
Comment 6 Ferris McCormick (RETIRED) gentoo-dev 2009-05-28 16:24:01 UTC
(In reply to comment #5)
> Created an attachment (id=192727) [edit]
> sqlite-3.6.14.2-fix_alignment.patch
> 
> Please test this patch.
> 

With that patch, the entire test suite for sqlite-3.6.14.2 runs successfully.  So I'd call this bug fixed once that is applied (and upstream incorporates it).
Comment 7 Ferris McCormick (RETIRED) gentoo-dev 2009-05-28 16:26:44 UTC
(In reply to comment #6)
> (In reply to comment #5)
> > Created an attachment (id=192727) [edit]
> > sqlite-3.6.14.2-fix_alignment.patch
> > 
> > Please test this patch.
> > 
> 
> With that patch, the entire test suite for sqlite-3.6.14.2 runs successfully. 
> So I'd call this bug fixed once that is applied (and upstream incorporates it).
> 

And I notice that it's present in sqlite-3.6.15 upstream as well.
Comment 8 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2009-05-28 17:56:48 UTC
The patch has been included in dev-db/sqlite-3.6.14.2.
Please test dev-db/sqlite-3.6.14.2 (and test dev-python/pysqlite with dev-db/sqlite-3.6.14.2) and, if tests pass, add ~sparc keyword.
Comment 9 Ferris McCormick (RETIRED) gentoo-dev 2009-05-28 18:41:26 UTC
Header got messed up, so patch does not install.  cvs thoughtfully changed the 
** $Id: rowset.c,v 1.7 2009/05/22 01:00:13 drh Exp $
to
** $Id: sqlite-3.6.14.2-fix_alignment.patch,v 1.1 2009/05/28 17:53:24 arfrever Exp $

I don't remember how to prevent this from happening. :(  

I'll test without that part of the patch.
Comment 10 Ferris McCormick (RETIRED) gentoo-dev 2009-05-28 19:06:43 UTC
(In reply to comment #9)
> Header got messed up, so patch does not install.  cvs thoughtfully changed the 
> ** $Id: rowset.c,v 1.7 2009/05/22 01:00:13 drh Exp $
> to
> ** $Id: sqlite-3.6.14.2-fix_alignment.patch,v 1.1 2009/05/28 17:53:24 arfrever
> Exp $
> 
> I don't remember how to prevent this from happening. :(  
> 
> I'll test without that part of the patch.
> 

With that patch (and the $Header update removed), all sqlite tests pass (FEATURES='userpriv test') and all pysqlite tests pass.  So the patch is good.  I'll try to make a version which will apply.  I might end up taking out the $Header update and wait for that in the next sqlite release unless I can figure out how to make cvs ignore it.
Comment 11 Ferris McCormick (RETIRED) gentoo-dev 2009-05-28 20:55:00 UTC
Got it, thanks to some help from tcunha and robbat2.  Patch is now good (verfied that cvs is now correct) and installs, and on sparc, sqlite-3.6.14.2 can run all tests (with FEATURES='test userpriv') as can pysqlite,

Thus, ~sparc keyword added back and this bug can be closed.
Comment 12 Terje Bråten 2009-05-29 06:52:33 UTC
I got this error:
>>> Unpacking source...                                                                                                                            
>>> Unpacking sqlite_docs_3_6_14.zip to /usr/tmp/portage/dev-db/sqlite-3.6.14.2/work                                                               
>>> Unpacking sqlite-3.6.14.2.tar.gz to /usr/tmp/portage/dev-db/sqlite-3.6.14.2/work                                                               
 * Applying sandbox-fix2.patch ...                                                                                                            [ ok ]
 * Applying sqlite-3.6.14.2-fix_alignment.patch ...                                                                                                 

 * Failed Patch: sqlite-3.6.14.2-fix_alignment.patch !
 *  ( /usr/portage/dev-db/sqlite/files/sqlite-3.6.14.2-fix_alignment.patch )
 *                                                                          
 * Include in your bugreport the contents of:                               
 *                                                                          
 *   /usr/tmp/portage/dev-db/sqlite-3.6.14.2/temp/sqlite-3.6.14.2-fix_alignment.patch-17435.out

 * 
 * ERROR: dev-db/sqlite-3.6.14.2 failed.

# cat /usr/tmp/portage/dev-db/sqlite-3.6.14.2/temp/sqlite-3.6.14.2-fix_alignment.patch-17435.out
***** sqlite-3.6.14.2-fix_alignment.patch *****                                                        

===============================================

PATCH COMMAND:   patch -p0 -g0 -E --no-backup-if-mismatch < /usr/portage/dev-db/sqlite/files/sqlite-3.6.14.2-fix_alignment.patch

===============================================
patching file src/rowset.c                     
Hunk #1 FAILED at 60.                          
1 out of 2 hunks FAILED -- saving rejects to file src/rowset.c.rej
===============================================                   

PATCH COMMAND:   patch -p1 -g0 -E --no-backup-if-mismatch < /usr/portage/dev-db/sqlite/files/sqlite-3.6.14.2-fix_alignment.patch

===============================================
can't find file to patch at input line 3       
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:                
--------------------------                      
|--- src/rowset.c                               
|+++ src/rowset.c                               
--------------------------                      
No file to patch.  Skipping patch.              
2 out of 2 hunks ignored                        
===============================================

Comment 13 Ferris McCormick (RETIRED) gentoo-dev 2009-05-29 12:48:42 UTC
(In reply to comment #12)
> I got this error:
> >>> Unpacking source...                                                                                                                            
> >>> Unpacking sqlite_docs_3_6_14.zip to /usr/tmp/portage/dev-db/sqlite-3.6.14.2/work                                                               
> >>> Unpacking sqlite-3.6.14.2.tar.gz to /usr/tmp/portage/dev-db/sqlite-3.6.14.2/work                                                               
>  * Applying sandbox-fix2.patch ...                                             
>                                                               [ ok ]
>  * Applying sqlite-3.6.14.2-fix_alignment.patch ...                             
> 
>  * Failed Patch: sqlite-3.6.14.2-fix_alignment.patch !
>  *  ( /usr/portage/dev-db/sqlite/files/sqlite-3.6.14.2-fix_alignment.patch )
>  *                                                                          
>  * Include in your bugreport the contents of:                               
>  *                                                                          
>  *  
> /usr/tmp/portage/dev-db/sqlite-3.6.14.2/temp/sqlite-3.6.14.2-fix_alignment.patch-17435.out
> 
>  * 
>  * ERROR: dev-db/sqlite-3.6.14.2 failed.
> 
> # cat
> /usr/tmp/portage/dev-db/sqlite-3.6.14.2/temp/sqlite-3.6.14.2-fix_alignment.patch-17435.out
> ***** sqlite-3.6.14.2-fix_alignment.patch *****                                 
> 
> ===============================================
> 
> PATCH COMMAND:   patch -p0 -g0 -E --no-backup-if-mismatch <
> /usr/portage/dev-db/sqlite/files/sqlite-3.6.14.2-fix_alignment.patch
> 
> ===============================================
> patching file src/rowset.c                     
> Hunk #1 FAILED at 60.                          
> 1 out of 2 hunks FAILED -- saving rejects to file src/rowset.c.rej
> ===============================================                   
> 
> PATCH COMMAND:   patch -p1 -g0 -E --no-backup-if-mismatch <
> /usr/portage/dev-db/sqlite/files/sqlite-3.6.14.2-fix_alignment.patch
> 
> ===============================================
> can't find file to patch at input line 3       
> Perhaps you used the wrong -p or --strip option?
> The text leading up to this was:                
> --------------------------                      
> |--- src/rowset.c                               
> |+++ src/rowset.c                               
> --------------------------                      
> No file to patch.  Skipping patch.              
> 2 out of 2 hunks ignored                        
> ===============================================
> 

This was briefly a problem, but it should be fixed now.  I just did 'emerge --sync' on a sparc system and on an amd64 system --- on both systems the patch applies correctly and sqlite builds as expected.

Look at /usr/portage/dev-db/sqlite/files/sqlite-3.6.14.2-fix_alignment.patch

It should be identical to the patch attached to this file.  If it is not, please remove it,  'emerge --sync',  and check again.
Comment 14 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2009-05-29 19:27:42 UTC
(In reply to comment #11)

Thanks for fixing the patch.
Comment 15 Ferris McCormick (RETIRED) gentoo-dev 2009-05-29 20:04:07 UTC
(In reply to comment #14)
> (In reply to comment #11)
> 
> Thanks for fixing the patch.
> 
Thanks to robbat2 and tcunha for telling me how. :)