Bug 52392 - : Bibliography database autofills empty fields with symbols
Summary: : Bibliography database autofills empty fields with symbols
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
3.5.5.2 rc
Hardware: All Linux (All)
: highest critical
Assignee: Lionel Elie Mamane
URL:
Whiteboard: BSA target:3.7.0 target:3.6.4
Keywords: regression
Depends on:
Blocks: mab3.5
  Show dependency treegraph
 
Reported: 2012-07-23 12:16 UTC by LiPi
Modified: 2012-10-27 21:22 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Screenshoot with the symbols that appear, and how it's seen in the bibliographic index. (190.68 KB, image/png)
2012-07-23 12:16 UTC, LiPi
Details

Note You need to log in before you can comment on or make changes to this bug.
Description LiPi 2012-07-23 12:16:41 UTC
Created attachment 64538 [details]
Screenshoot with the symbols that appear, and how it's seen in the bibliographic index.

Problem description: 
When you create a new entry in the Bibliographic database, the fields that you don't fill are autofilled with a buggy triangle symbol.

Then, if you add a bibliographic entry from the database to the document, and you have an index, the symbols are shown.

Appears in both 3.5.5.3 and 3.5.5.2.

Steps to reproduce:
1. From Tools -> Bibliographic database, create a new bibliographic entry filling only the Identifier and for example the Type.
2. Click on another entry or close the database navigator.

Current behavior:
The newly created one will be filled by symbols where there were no data.

Inserting into the document a reference to this new entry and updating a default Bibliographic Index will make appear these symbols into the index.

It does not happen when adding a new bibliography entry internally to the document and not to the database.

You can try to delete the "auto-filled" fields in the database, but it's difficult, you have to do from the leftiest cell to rightest, otherwise it gets filled another time.

Expected behavior:
Not to fill up the empty fields with symbols.


Platform (if different from the browser): 
              
Browser: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20100101 Firefox/12.0 Iceweasel/12.0
Comment 1 LiPi 2012-10-23 20:48:03 UTC
Bug also present in newer versions 3.6.x.
Comment 2 Alex Thurgood 2012-10-24 07:40:22 UTC
This doesn't occur on 3.5.4.2, where a new bibliography entry created via the Table view inserts no strange characters. I will try and reproduce on later versions to confirm.

I seem to recall that this was already reported somewhere, but don't know if it got fixed.

Alex
Comment 3 Alex Thurgood 2012-10-24 08:34:15 UTC
Confirming in 3.6.3 rc1

I note however, that the problem seems to have been created by entries made with 3.5.4 or earlier, because the new entry I made in 3.5.4.2 shows up in 3.6.3rc1 with garbled data in the fields which displayed as empty in 3.5.4.2.

Alex
Comment 4 Alex Thurgood 2012-10-24 08:37:58 UTC
Nominating for MAB, only problem is that 3.5 branch will no longer be maintained after 3.5.7 and this most probably won't be fixed for that release (which is at rc2 pending final release). This means that it will go into the 3.6.x MAB list, sigh and who knows when that will get dealt with.

Alex
Comment 5 Alex Thurgood 2012-10-24 08:40:06 UTC
Adding Cedric and Andras to CC.

Any chance of taking a look ? Looks like something got screwed up when the bibliography database was updated in source.


Alex
Comment 6 Alex Thurgood 2012-10-24 08:41:37 UTC
Resetting to earliest version identified as problem showing up ==> 3.5.5.3


Alex
Comment 7 Alex Thurgood 2012-10-24 08:42:55 UTC
This is also a regression on 3.5.4.2 where the problem does not show up (although the garbled data entry seems to have been inserted nonetheless, see comment 2).


Alex
Comment 8 Lionel Elie Mamane 2012-10-24 10:56:36 UTC
Reproduced in base (open file LibOPRofile/database/biblio.odb) in my 3.6 dev tree.

Seems to do that only on VARCHAR fields, not on LONGVARCHAR fields.
Comment 9 Lionel Elie Mamane 2012-10-24 17:50:27 UTC
OK, the problem is that when writing out a NULL value (a concept that the DBF file format does not support), the field in the DBF file is written as all null characters ('\0') instead of blanks ('\0x20'). It should be blanks.

This happens in connectivity/source/drivers/dbase/DTable.cxx, function connectivity::dbase::ODbaseTable::UpdateBuffer, line 1826:

        // If the variable is bound at all?
        if ( !rRow.get()[nPos]->isBound() )
        {
            // No - the next field.
            nByteOffset += nLen;
            continue;
        }

Basically, this function makes a distinction between NULL and "not bound". This distinction is bogus in case of a new row insertion, and an unset value should be treated as a NULL is treated (that is, write out an empty string).
But in the case of a row _update_, it makes sense not to touch fields that are not set (they should not be changed!).

So either we parametrise UpdateBuffer to make the distinction or not, or InsertRow sets all unbound fields to NULL.


I'll fix it. Taking bug.
Comment 10 Lionel Elie Mamane 2012-10-25 09:33:47 UTC
Fixed in my development tree
Comment 11 Not Assigned 2012-10-26 17:14:37 UTC
Lionel Elie Mamane committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=77e60c005812968af9885c20fac0a098012fbeba

fdo#52392 dbase: correctly NULL out non-filled in fields in inserted rows



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 12 Not Assigned 2012-10-27 15:41:33 UTC
Lionel Elie Mamane committed a patch related to this issue.
It has been pushed to "libreoffice-3-6":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=64b8b060a1496bb8ae85a1ef9fdc0f02f14f2813&g=libreoffice-3-6

fdo#52392 dbase: correctly NULL out non-filled in fields in inserted rows


It will be available in LibreOffice 3.6.4.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.