Closed Bug 803835 Opened 12 years ago Closed 12 years ago

Address Book import of CSV files messes up on quoted fields

Categories

(Thunderbird :: Address Book, defect)

16 Branch
x86_64
All
defect
Not set
normal

Tracking

(thunderbird16 affected, thunderbird17+ fixed, thunderbird18 fixed)

RESOLVED FIXED
Thunderbird 19.0
Tracking Status
thunderbird16 --- affected
thunderbird17 + fixed
thunderbird18 --- fixed

People

(Reporter: grawlix.computing, Assigned: mconley)

References

Details

(Keywords: regression, testcase)

Attachments

(3 files)

Attached file test.csv
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20100101 Firefox/16.0
Build ID: 20121010144125

Steps to reproduce:

I've attempted to import a simple CSV file into the Address Book.  The file is attached.


Actual results:

The record was imported, but the fields were not properly extracted from their quoted format in the file.  For example, instead of getting:

Acer America

...this was imported:

"Acer Americ



Expected results:

Quoted fields should not be mangled on import.
This can be reliably reproduced on two systems running Thunderbird 16.0.1.  One system is running Windows 7 (64-bit), and the other, Windows XP SP3.
I should also add that I believe this bug has shown up with the 16.0.1 update, as I have been routinely been making this type of import up to this point with no difficulties.
Grawlix can you try to find out when this regressed (eg using nightly builds just for that) ?
Status: UNCONFIRMED → NEW
Component: Untriaged → Address Book
Ever confirmed: true
The defect is not present in 15.0.1, but appears in 16.0b1.
If the bug is *not* in the 15.0.1 release, but is in 16.0, I should be looking for 16a1, 16a2, 16aX nightlies?
Correction: 
16.0a1, 16.0a2, 16.0aX nightlies?
This is a unit test based on the testcase attached to the bug.

Hiro, could you have a look at what has regressed here?
Assignee: nobody → mconley
I think I'm narrowing down in on the problem.

This line here:

http://mxr.mozilla.org/comm-central/source/mailnews/import/text/src/nsTextAddress.cpp#175

Is supposed to return the number of quote characters are in a string.

Well, for this string:  

,,\"Acer America\",,,,,\"(800) 000-0000\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",,,\"Acer Americ

It's returning 38, when there are only 37 quotes in there. Not sure why though - my debugger seems to become useless when I start descending into macros.

Neil, any idea of what's going on?
Flags: needinfo?(neil)
There's a line missing from the patch in bug 145293.
>-    const char *pStart = pChar;
>-    PRInt32        fLen = 0;
>-    bool          quoted = false;
>-    if (*pChar == '"') {
>-        pStart++;
>+    PRInt32 fLen = 0;
>+    PRInt32 startPos = pos;
>+    bool    quoted = false;
>+    if (aLine[pos] == '"') {
Note that pStart++; was deleted but no startPos++; was added :-(
Flags: needinfo?(neil)
Attached patch FixSplinter Review
"It's a strange fate that we should suffer so much fear and doubt over something so small, such a little thing."

- Boromir, The Lord of the Rings

All import tests, including the one packaged in this bug, pass with this patch.
Attachment #677749 - Flags: review?(mbanner)
Attachment #674609 - Flags: review?(mconley)
Comment on attachment 674609 [details] [diff] [review]
Unit test from testcase

Review of attachment 674609 [details] [diff] [review]:
-----------------------------------------------------------------

Just some tailing whitespace, otherwise good.

Good stuff.

::: mailnews/import/test/unit/resources/addressbook.json
@@ +72,5 @@
> +    {
> +      "DisplayName"      : "Acer America",
> +      "Work Phone"       : "(800) 000-0000",
> +      "Organization"     : "Acer America"
> +    } 

Trailing whitespace
Attachment #674609 - Flags: review?(mconley) → review+
Attachment #677749 - Flags: review?(mbanner) → review+
Comment on attachment 674609 [details] [diff] [review]
Unit test from testcase

[Triage Comment]
We want these for 17, to fix the regression.
Attachment #674609 - Flags: approval-comm-beta+
Attachment #674609 - Flags: approval-comm-aurora+
Attachment #677749 - Flags: approval-comm-beta+
Attachment #677749 - Flags: approval-comm-aurora+
Status: NEW → RESOLVED
Closed: 12 years ago
OS: Windows 7 → All
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 19.0
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: