Bug Hunting Session
Bug 94542 - ScPostIt's GetText() replaces tabs with U+0001
Summary: ScPostIt's GetText() replaces tabs with U+0001
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: Other All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:5.1.0 target:5.0.3
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-27 06:05 UTC by Joan Paraiso
Modified: 2016-10-25 19:19 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
The test file which has tabs inside its comments (7.91 KB, application/vnd.oasis.opendocument.spreadsheet)
2015-09-27 06:05 UTC, Joan Paraiso
Details
Patch to make unit test test for tabs (1.06 KB, patch)
2015-09-27 18:50 UTC, Joan Paraiso
Details
The resulting output of when the test is run with the patch applied to test for tabs. (68.93 KB, text/plain)
2015-09-27 18:51 UTC, Joan Paraiso
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Joan Paraiso 2015-09-27 06:05:10 UTC
Created attachment 119065 [details]
The test file which has tabs inside its comments

As the title says, GetText() replaces tab characters with:

http://www.decodeunicode.org/u+0001

This isn't obvious since when the user edits the text with the GUI, they're able to navigate the tab characters normally (which're between A and b; and b and c in the attached test file test).

I initially discovered this when I was trying to write a patch for the html exporter to include the comments inside the appropriate cells. To reproduce, simply do the following:

0. Compile libreoffice's sc module with debug symbols
1. run libreoffice through gdb
2. Set a breakpoint for ScPostIt::GetText
3. Open the sample file
4. I'm not sure which point in the GUI is GetText() called, but I know the unit test doesn't test for plaintext with tabs.
5. Point is, when you get tot he point in GetText(), you'll see U+0001 littered wherever tabs are.
Comment 1 Joan Paraiso 2015-09-27 18:50:22 UTC
Created attachment 119075 [details]
Patch to make unit test test for tabs

This is a patch to make the unit test test for tabs. This is needed for easier demonstration of the bug.
Comment 2 Joan Paraiso 2015-09-27 18:51:08 UTC
Created attachment 119076 [details]
The resulting output of when the test is run with the patch applied to test for tabs.
Comment 3 Commit Notification 2015-09-27 19:13:43 UTC
Markus Mohrhard committed a patch related to this issue.
It has been pushed to "master":

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

don't try to create OUString from editeng directly, tdf#94542

It will be available in 5.1.0.

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 4 Commit Notification 2015-10-01 14:46:26 UTC
Markus Mohrhard committed a patch related to this issue.
It has been pushed to "libreoffice-5-0":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=e108b24c1b63128f3ace77d0642d56179172ffed&h=libreoffice-5-0

don't try to create OUString from editeng directly, tdf#94542

It will be available in 5.0.3.

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.