After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 651260 - Pasting a cell with Comment from Excel results in an empty comment in Gnumeric
Pasting a cell with Comment from Excel results in an empty comment in Gnumeric
Status: RESOLVED NOTGNOME
Product: Gnumeric
Classification: Applications
Component: import/export MS Excel (tm)
1.10.x
Other Windows
: Normal normal
: ---
Assigned To: Jody Goldberg
Jody Goldberg
Depends on:
Blocks:
 
 
Reported: 2011-05-27 15:04 UTC by Pedro Lino
Modified: 2011-08-22 05:44 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Comment in Excel xls spreadsheet (13.50 KB, application/vnd.ms-excel)
2011-05-27 15:04 UTC, Pedro Lino
  Details
Comment pasted from Excel (1.89 KB, application/x-gnumeric)
2011-06-01 17:58 UTC, Pedro Lino
  Details
patch to favour xlsx over biff8 (1.16 KB, patch)
2011-08-21 23:30 UTC, Andreas J. Guelzow
rejected Details | Review
XML part of the clipboard (1.04 KB, text/xml)
2011-08-22 03:21 UTC, Valek Filippov
  Details

Description Pedro Lino 2011-05-27 15:04:40 UTC
Created attachment 188766 [details]
Comment in Excel xls spreadsheet

This can be reproduced easily (by someone using Windows :) ). This only happens when saving as ODS (with or without foreign elements)

Steps

1) Copy a cell with a comment from an Excel spreadsheet (see attached file) loaded in Excel (I am using Office 2003)
2) Paste into Gnumeric
3) Save as ODS

Interesting facts:
1) If the Excel file is opened in Gnumeric, it doesn't produce a crash
2) If the file is saved as .gnumeric, it doesn't produce a crash

This probably means that it is some code exported by the Excel clipboard that the ODS format doesn't support?

(I'm using Gnumeric 1.10.15 under Windows XP SP3)
Comment 1 Andreas J. Guelzow 2011-05-27 16:31:42 UTC
A few questions:

1) Would you be able to create a backtrace of the crash?
2) After you pasted the cell into Gnumeric, do you still have a comment? 
3) How does the pasted comment look like? 
4) Do you see any difference between the pasted comment and one created inside Gnumeric?

Thank you
Comment 2 Pedro Lino 2011-05-27 20:21:31 UTC
Hi Andreas

1) Of course. Just tell me what to do.
2) No. I didn't notice that before.
3) The comment doesn't show up. In fact if I choose Edit Comment it will show a blank box.
4) Visually the cells looks exactly the same. A red corner triangle. But the pasted cell contains no text.

Thank *you* for Gnumeric ;)
Comment 3 Andreas J. Guelzow 2011-05-27 20:48:04 UTC
Hi Pedro,

re 1) I have no idea how to do that (or virtually anything else) on MS Windows.

Your answers to 2,3, and 4 are very useful. I suspect that when we are writing the comment we are encountering an unexpected NULL. Clearly something is going badly wrong when the cell is pasted.
Comment 4 Andreas J. Guelzow 2011-05-29 00:42:37 UTC
I have reviewed the code in the ODF exporter that writes the comments and included some more checks (ie. made less assumptions). We will need to see whether this avoids the crash. (Of course there is still the issue of getting an empty comment in the first place.)
Comment 5 Morten Welinder 2011-06-01 00:57:21 UTC
Adding Jean -- we need someone who can reproduce.  (I do not have both
Gnumeric and Excel on any single machine.)

Pedro: can you please attach the resulting .gnumeric file?  There might be
hints in that.
Comment 6 Pedro Lino 2011-06-01 08:21:25 UTC
I can only create a gnumeric file resulting from pasting within gnumeric (but you can do the same).

There is no file output after pasting from Excel because Gnumeric crashes on Save :)

I can Paste from Excel and Save as .gnumeric though. Does that help?
Comment 7 Jean Bréfort 2011-06-01 09:38:19 UTC
Hmm, no excel around. Can't test.
Comment 8 Morten Welinder 2011-06-01 11:09:04 UTC
> I can Paste from Excel and Save as .gnumeric though. Does that help?

It might, so please do so.
Comment 9 Pedro Lino 2011-06-01 17:58:31 UTC
Created attachment 189031 [details]
Comment pasted from Excel

As mentioned before, pasting a cell with a Comment and saving as .gnumeric doesn't produce a crash but the Comment is not copied.

I don't know if this has any influence but the comment in Excel doesn't have an Author.
Comment 10 Morten Welinder 2011-06-01 18:33:01 UTC
Thanks.

The relevant part of the file is:

      <gnm:Objects>
        <gnm:CellComment ObjectBound="B2" ObjectOffset="1 0 1 0" Direction="17" Print="1"/>
      </gnm:Objects>

Note that there is no text.

Andreas: I believe this was the case you fixed recently.  Right?
Comment 11 Andreas J. Guelzow 2011-06-01 21:22:31 UTC
I fixed the ODF exporter crashing if there is no text. So the crash ought to be fixed. 

Of course there is still the problem that the text disappears on the paste in the first place. If there is no text at all we should not have a comment.
Comment 12 Pedro Lino 2011-06-01 22:54:19 UTC
Actually the crash seems to be caused by the missing Author. I just pasted from Excel an empty comment with Author and it saved correctly as .ods

Then I pasted the comment from the uploaded Excel file and it crashed again.
Comment 13 Andreas J. Guelzow 2011-06-01 23:03:01 UTC
My commit covered author, text and markup. We always tested whether author and/or text was NULL so that could not have been the direct reason for the crash. Of course we don't know what happened when the comment was pasted that made it have the comment text disappear in the first place.
Comment 14 sum1 2011-06-04 02:57:52 UTC
Here's a non-debug backtrace with gnumeric-1.10.15-20110524.exe:

Program received signal SIGSEGV, Segmentation fault.
[Switching to thread 1212.0xd20]
0x77c478c0 in strlen () from C:\WINDOWS\system32\msvcrt.dll
(gdb) bt
  • #0 strlen
    from C:\WINDOWS\system32\msvcrt.dll
  • #1 odf_write_objects
    from C:\Program
  • #2 odf_write_sheet
    from C:\Program
  • #3 odf_write_content
    from C:\Program
  • #4 openoffice_file_save_real
    from C:\Program
  • #5 go_plugin_file_saver_save
    from C:\Program
  • #6 wbv_save_to_output
    from C:\Program
  • #7 wb_view_save_to_uri
    from C:\Program
  • #8 wb_view_save_as
    from C:\Program
  • #9 gui_file_save_as
    from C:\Program
  • #10 g_closure_invoke
    from C:\Program
  • #11 signal_emit_unlocked_R
    from C:\Program


Here are the steps I'm using:
- Open Gnumeric
- Copy cell B2 from Attachment 188766 [details] with Excel 2003 SP3
- Paste into cell A1 in Gnumeric
- File > Save As
- Select 'ODF/OpenOffice with foreign elements' as the file type
- Press Save
--> Crash
Comment 15 Andreas J. Guelzow 2011-06-04 05:33:36 UTC
sum1, thanks. That's what I fixed already (post-gnumeric-1.10.15-20110524).
Comment 16 Pedro Lino 2011-06-04 07:39:43 UTC
Hi sum1

Would you mind writing a detailed step-by-step tutorial (or pointing me to an existing one) on how to create the backtrace log under Windows?

Thanks! ;)
Comment 17 Andreas J. Guelzow 2011-06-17 01:37:38 UTC
1.10.16 was just released with a MSWindows binary available on our website. Could somebody test whether

(a) the crash described in this bug report still happens
(b) pasting a cell with a non-empty comment creates a non-empty comment (or no comment at all)

Thank you
Comment 18 Pedro Lino 2011-06-17 10:37:30 UTC
Of course I'm available for testing. It wouldn't make sense otherwise, would it? ;)

(a) Gnumeric no longer crashes (well done!)
(b) pasting a cell with a non-empty comment creates an empty comment; pasting a cell with an empty comment creates an empty comment. The author name is transferred. Conclusion: comment contents are not transferred :)
Comment 19 Vladimir Chukharev 2011-06-17 10:57:37 UTC
I have just tested with 1.10.16, Win7, and Excel2007 (no xl2003 around).
(a) No crash happened
(b) An empty comment is created.

The saved file is opened by Gnumeric without complains.

Excel2007 writes on opening the following.
Excel found unreadable content in 'Työkirja2.ods'. Do you want to recover the
contents of theis workbook? If you trust the source of this workbook, click
Yes.

(This is in a Finnish locale, thus the name of the workbook.)

After clicking Yes, excel writes:
Excel was able to open the file by repairing or removing the unreadable
content.

Then, same previous message with additional explanation:
Excel completed file level validation and repair. Some parts of this workbook
may have been repaired or discarded.

Also, a link to the log file listing repairs is given. That file contains xml
text with the error and explanation of it...

Next, the file is opened and has an empty comment for the A1 cell.

PS. There've been a collision in the air with Pedro's comment ;-)
Comment 20 Andreas J. Guelzow 2011-06-17 18:55:30 UTC
Since only (b) is left I retitled and assigned to xl import. There is no ODF issue left here.
Comment 21 Valek Filippov 2011-08-21 22:33:49 UTC
Checked clipboard made by Excel2003.
As usual it has multiple copies of the same (more or less) content in different formats.
In my case 2nd (counting from 0) entry is "biff8", nexts are "biff5","biff4","biff3" and "biff". Entry 10 is "XML Spreadsheet".
Entries 15 and 16 are "Embed Source" and "Native", both of them are actually biff8 files.

All biffs in that file have comment text EXCEPT for 'biff8' in the 2nd entry -- this one only have cell text and comment author.
Comment 22 Andreas J. Guelzow 2011-08-21 22:53:25 UTC
Our code has preference for biff8. So we end up without comment text. What would be be losing if we switched preference to biff5?

@Valek, what are entries 0 and 1?
Comment 23 Valek Filippov 2011-08-21 23:10:50 UTC
Entry 0 has a description 'Data Object', content is just 4 bytes ('ba 05 01 00').

Entry 1 is WMF file (description '&Picture'), it doesn't have neither comment author nor comment text inside.
Comment 24 Andreas J. Guelzow 2011-08-21 23:30:01 UTC
Created attachment 194339 [details] [review]
patch to favour xlsx over biff8

@Valek, could you give this patch a try please. We also need to know whether anything else breaks when copied...
Comment 25 Valek Filippov 2011-08-22 03:21:50 UTC
Created attachment 194344 [details]
XML part of the clipboard
Comment 26 Andreas J. Guelzow 2011-08-22 03:36:41 UTC
Comment on attachment 194339 [details] [review]
patch to favour xlsx over biff8

the patch assumes incorrectly that xlsx is provided. It is not.
Comment 27 Andreas J. Guelzow 2011-08-22 05:44:34 UTC
Just to summarize:

Excel does not include the comment text in the biff8 target it provides via the clipboard. So this is clearly Excel bug.