Community Packages

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#45378 - [lua-sql-sqlite] v2.3.0-4 curser fetching with lua 5.3 produces segfault

Attached to Project: Community Packages
Opened by Nimrod Maclomhair (nimrod_mack) - Thursday, 18 June 2015, 15:57 GMT
Last edited by Sergej Pupykin (sergej) - Friday, 19 June 2015, 14:06 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Sergej Pupykin (sergej)
Anatol Pomozov (anatolik)
Architecture i686
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
============
Using lua-sql-sqlite v2.3.0-4, lua v5.3.0-2, sqlite v3.8.10.2-1

When fetching data after a SELECT statement, the process segfaults. It usually happened after the last result, when fetch() should actually return nil. I also had cases in which fetch failed at the second call even though there were more lines to fetch.
The segfaults produced entries in the journal looking like this:
kernel: lua[4954]: segfault at c ip b77c281c sp bff03020 error 6 in sqlite3.so[b77c1000+4000]
The number after "sp" changed with every process but always started with "bf".
The number at the end in brackets also changed with every process except the first numbers "b77" and the number after the + (4000)

Furthermore there appears to be a problem with integers. In my test, I got for a sql 1 the number -5226363819227348991, for 2 a -5226363819227348990 and so on.

I tried to use the lua-sql-sqlite3 module in lua5.2 and encounterd no errors.

When searching Google, I couldn't find any posts or entries describing the problem.

lua-sql-sqlite started working normally with lua v5.3 when I dropped the compile option "-DLUA_32BITS" from the PKGBUILD and recompiled.



Steps to reproduce:
===================

Example script for lua:

conn = require "luasql.sqlite3".sqlite3():connect("testdb.db")
cur = conn:execute("SELECT id, name FROM test");
while true do
local id, name = cur:fetch()
if not id then break; end
print(id, name);
end
if cur then cur:close(); end
conn:close()

I attached a test database for easier reproduction
This task depends upon

Closed by  Sergej Pupykin (sergej)
Friday, 19 June 2015, 14:06 GMT
Reason for closing:  Fixed
Comment by Anatol Pomozov (anatolik) - Thursday, 18 June 2015, 17:07 GMT
Thanks for this great report.

Sergej, do you know why the package is compiled with "-DLUA_32BITS" flag? It seems causes number overflow.
Comment by Anatol Pomozov (anatolik) - Thursday, 18 June 2015, 18:02 GMT
Using -std=c99 is enough, no need for "-DLUA_32BITS". Tested with 64bit & lua 5.3.1. I am going to push a new lua-sql package to [testing].
Comment by Anatol Pomozov (anatolik) - Thursday, 18 June 2015, 18:14 GMT
And we can drop '-fPIC' as it is provided by the package build.
Comment by Sergej Pupykin (sergej) - Friday, 19 June 2015, 14:06 GMT
Probably LUA_32BITS was a mistake. I've removed it and fPIC

Loading...