Documents: Integers are getting corrupted

Bug #1181359 reported by Martin Borho
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
U1DB Qt/ QML
Fix Released
Undecided
Unassigned
qtbase-opensource-src (Ubuntu)
Fix Released
Undecided
Timo Jyrinki

Bug Description

Hi,

when saving a javascript object with an integer, the integer is not the same after retrieved from the db.

Saving {test_id:2911298} will result in {test_id:2911300}. I'm using 0.1.4bzr89quantal0

Example:

import QtQuick 2.0
import U1db 1.0 as U1db

Item{
    id: u1dbBug

    U1db.Database {
            id: testDatabase
            path: "test-database"
    }

    function testFunction() {
        testDatabase.putDoc({test_id:2911298})
        var docs = testDatabase.listDocs();
        for(var x=0;x<docs.length;x++) {
            var doc = testDatabase.getDoc(docs[x]);
            console.log(doc.test_id)
        }
    }

}

Related branches

Cris Dywan (kalikiana)
Changed in u1db-qt:
status: New → Confirmed
Revision history for this message
Cris Dywan (kalikiana) wrote :

Looks like 2911298 is stored in Sqlite as 2.9113e+06 and rounded when it comes out.

Revision history for this message
Cris Dywan (kalikiana) wrote :

This is an upstream bug hitting us in QJsonDocument::fromVariant where integer precision is only 6 digits. The test case actually starts passing if you remove a digit.

See https://bugreports.qt-project.org/browse/QTBUG-28467 (can't track this due to bug 157488)

Revision history for this message
Martin Borho (martin-borho) wrote :

Thanks!

So it will be fixed in Qt5.1, any prediction when 5.1 will land?

Changed in qtbase-opensource-src (Ubuntu):
status: New → Confirmed
assignee: nobody → Timo Jyrinki (timo-jyrinki)
Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

Current focus in small fixes is backporting them to 5.0.2. The patch from https://codereview.qt-project.org/#change,56072 applies fine on qtbase 5.0.2. But I'd like to smoketest all package changes on device before putting them in, and currently saucy device images are not usable because of the container switch work.

I've pushed a package to qt5-beta2 PPA: 5.0.2+dfsg1-4ubuntu2~saucy1~test1 and it built fine for all architectures (changelog mentions a wrong bug number there, though). So meanwhile it's testable/usable from there.

Cris Dywan (kalikiana)
Changed in u1db-qt:
milestone: none → 1.0
Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

This is available for saucy in qt5-beta2 PPA (https://launchpad.net/~canonical-qt5-edgers/+archive/qt5-beta2). I'd like to have before/after testing done on device, but using saucy on device is at the moment hard before the images generation is in full speed and network is working. The updated package also includes the fix for qtbase bug #1163687 (and the PPA contains newer qtdeclarative and qtpim).

The test procedure is: 1. Have the latest saucy image installed on your device. Log in, and do apt-get update && apt-get dist-upgrade on the device 2. apt-add-repository ppa:canonical-qt5-edgers/qt5-beta2 3. apt-get update && apt-get dist-upgrade (check that you get the PPA versions of the packages) 4. Reboot. Test!

After testing has been done, the updated version can be uploaded to saucy from lp:~kubuntu-packagers/kubuntu-packaging/qtbase-opensource-src_5.0.2 (orig tarball already in saucy archives)

Changed in qtbase-opensource-src (Ubuntu):
status: Confirmed → Fix Committed
Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

Updated at qt5-beta2 (5.0.2+dfsg1-7ubuntu2~saucy1~test1). Now this should be testable also on device, since the 'flip' was made and saucy images work again.

Revision history for this message
Cris Dywan (kalikiana) wrote :

Works fine on the device with qt5-beta2.

Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

Thanks for testing, I'm waiting for a test result for bug #1163687 as well, but it's good to already know it generally seems to work with these two bug patches added.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package qtbase-opensource-src - 5.0.2+dfsg1-7ubuntu2

---------------
qtbase-opensource-src (5.0.2+dfsg1-7ubuntu2) saucy; urgency=low

  * debian/patches/fix_number_precision_qjsondocument.patch_8e8becdc.patch:
    - Cherry-pick from upstream (LP: #1181359)
 -- Timo Jyrinki <email address hidden> Thu, 06 Jun 2013 15:15:57 +0300

Changed in qtbase-opensource-src (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
Sam Segers (sam-sgrs) wrote :

Will this fix also come to raring?

Sam Segers (sam-sgrs)
Changed in u1db-qt:
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.