Menu

#51 mingw: partiallly corrupted xls files

v1.0_(example)
open
nobody
None
5
2014-01-28
2013-05-02
E.Naumovich
No

I found that library, built with mingw (both gcc 4.7 and 4.8) produces partially corrupted xls files. See attachment.

1 Attachments

Discussion

  • E.Naumovich

    E.Naumovich - 2014-01-14

    After migration to gcc 4.8.2 generated files looks like OK.
    Notes (is it comments to cell?) do not work and MD5 does not calculated properly.

     
  • David Hoerl

    David Hoerl - 2014-01-14

    So what version of xlslib are you testing with? You're not giving us much to go on. So I believe you are saying that the Notes feature is not working for you with mingw - can you post your source code (at least those lines). Also, I believe you are saying the MD5 is not proper when you do "make test".

    Again, version of source would help. Note that I'm using clang/llvm to build myself, and it has a state of the art analyzer. It found (and I fixed) a few problems where items were deleted but then used on the next line. If you want to try building and running with the latest source in trunk (in svn), that might be useful.

    Do you get warning when you build? All I can say now is there are hundreds of downloads a week, the code is running on the iPhone and iPad, so its been pretty well vetted by lots of users. One guy just did 20 sheets with 50K rows on each sheet - that's 1 million rows!

     
  • E.Naumovich

    E.Naumovich - 2014-01-14

    I tried 2.4.0 and 2.4.0-svn285.
    There was no warning in regular mode (-Wall, -Wextra).
    "note" code I just uncommented in targets\test\mainCPP.cpp , line 479.
    Excel 2010 opens it in Protected view, with warning, there is no notes/comments, and corresponding cells look empty (see attach).
    Concerning MD5- it compare calculated values with zeros:


    # md5: Actual="3fc498b1ab17b91d653f75bc758d9bb6" -- Expected="00000000000000
    

    000000000000000000"
    StandardTest failed: MD5 of generated XLS mismatch or I/O failure.
    # md5: Actual="ecd86afae253fb4104a47c4f75ad9101" -- Expected="00000000000000
    000000000000000000"
    StandardTest2 failed: MD5 of generated XLS mismatch or I/O failure.
    # md5: Actual="f806e922ca26613b34864d38b611f03f" -- Expected="00000000000000
    000000000000000000"
    BlankTest failed: MD5 of generated XLS mismatch or I/O failure.
    # md5: Actual="425d53e2fa2dc137e9c345757b6f0557" -- Expected="00000000000000
    000000000000000000"
    FormulaFunctionsTest failed: MD5 of generated XLS mismatch or I/O failure.
    # md5: Actual="941d5ede7cc568050d10ef419337828f" -- Expected="00000000000000
    000000000000000000"
    StressTest(3, 100, 100) failed: MD5 of generated XLS mismatch or I/O failure.
    # md5: Actual="e01bd2e6dca1ea58d8ecbfa33c63dc56" -- Expected="00000000000000
    000000000000000000"
    StressTest(3, 4, 4) failed: MD5 of generated XLS mismatch or I/O failure.
    # md5: Actual="266b3b95690cd3e9b0298ec0a049b3a0" -- Expected="00000000000000
    000000000000000000"
    RandomTest failed: MD5 of generated XLS mismatch or I/O failure.
    # md5: Actual="a692d9c80ae396209090add36f7515f1" -- Expected="00000000000000
    000000000000000000"
    RandomCellAndFormatTest failed: MD5 of generated XLS mismatch or I/O failure.
    # md5: Actual="5f35b9ca8f9c8537079d72a1c5da919e" -- Expected="00000000000000
    000000000000000000"
    RandomCellAndFormatTestProf failed: MD5 of generated XLS mismatch or I/O failure
    .
    # md5: Actual="4fb51f4db55cd87704be31c0df06f53a" -- Expected="00000000000000
    000000000000000000"
    RandomFormatTest failed: MD5 of generated XLS mismatch or I/O failure.
    # Test finished

    Process returned 1 (0x1) execution time : 0.619 s
    Press any key to continue.


     
  • David Hoerl

    David Hoerl - 2014-01-14

    Guess I have reasonably good news for you:

    1) I can duplicate the problem with the note corrupting the file. That should be relatively easy to fix - probably not writing the correct number of bytes to the file.

    2) Regarding checksums - in mainCPP.cpp, line 149, you can see the program is trying to open a file with the checksums in it. That obviously is not working. If you can add some logs there to see what the matter is, perhaps we can refine the code to better handle that file. I wrote and tested that on a Mac, so for mingw obviously its quite different.

    I guess no one is using the "notes" or there'd be a bug report on it. This is the first I can recall.

    EDIT: I just looked and the "note" object is only partially implemented. It never worked, and guess you're the first to try it.

     

    Last edit: David Hoerl 2014-01-14
  • E.Naumovich

    E.Naumovich - 2014-01-15

    I found missing file, mainCPP.md5
    Md5 without notes:


    # md5: Actual="266b3b95690cd3e9b0298ec0a049b3a0" -- Expected="e73c451ad92717
    

    55d7b20d6023702f26"
    RandomTest failed: MD5 of generated XLS mismatch or I/O failure.
    # Test finished

    Process returned 1 (0x1) execution time : 0.622 s
    Press any key to continue.


    and with notes:

    # md5: Actual="db0082620a2c5375ef9298fb6fdd9756" -- Expected="ecd86afae253fb
    

    4104a47c4f75ad9101"
    StandardTest2 failed: MD5 of generated XLS mismatch or I/O failure.
    # md5: Actual="266b3b95690cd3e9b0298ec0a049b3a0" -- Expected="e73c451ad92717
    55d7b20d6023702f26"
    RandomTest failed: MD5 of generated XLS mismatch or I/O failure.
    # Test finished

    Process returned 1 (0x1) execution time : 0.641 s
    Press any key to continue.


     
    • NGUYEN MINH DUNG

      I have the same problem as your's when I run with 32-bit Centos 6.5 but when I run with 64-bit Centos 6.5, it passed all failed check (no failed check in "random.xls" generating in mainCpp.cpp file). So I assume that it is problem with 32-bit and 64-bit. Also, I could open "random.xls" file normally in Libre Calc but have the same problem when open this file in Excel. Hope that this can help.

       
  • David Hoerl

    David Hoerl - 2014-01-26

    I spent some very long weekends and fixed notes. Its a huge feature for what seems like a little thing. In any case, if you pull from svn you can play with it. The feature requires the library to figure out how big the note will be itself - Excel won't auto-resize them. So the "note_t" cell object lets you override the default size (if you really care) or if you find your note getting cut off append some '\n' characters. You can use comments up to 2048 characters long. You can also specify your own background color instead of the default yellow (again, using the note_t object).

    The MD5's were updated in svn as well.

     
  • E.Naumovich

    E.Naumovich - 2014-01-27

    I took svn310 and did some tests.
    1. Notes looks like OK. Thank you.
    2. MD5 did not calculated properly and "formulas.xls" is broken.


    Microsoft Windows [Version 6.1.7601]
    Copyright (c) 2009 Microsoft Corporation. All rights reserved.

    c:\mingw\projects\txt_xlslib_2.4_sz>md5_dbg
    # md5: Actual="266b3b95690cd3e9b0298ec0a049b3a0" -- Expected="e73c451ad92717
    55d7b20d6023702f26"
    RandomTest failed: MD5 of generated XLS mismatch or I/O failure.
    # Test finished


    1. configure / make can not build examples (targets/test). It can not find "_imp__GetACP@0". I suppose libiconv somewhere not listed properly?
     
  • David Hoerl

    David Hoerl - 2014-01-28

    1) Please upload the file that has the incorrect checksum.

    2) what do you mean '"formulas.xls" is broken.' Is it the last comment about imp_Get...? I googled that and yes, it came up with a link that referenced mingw and iconv. Perhaps the formulas is using some conversion that requires iconv - will look into that.

     
  • E.Naumovich

    E.Naumovich - 2014-01-28

    1-2) Please look at attached files. Excel 2010 open "formulas.xls" with error message.
    3) Concerning "_imp__GetACP": I suppose that somewhere in "configure" libiconv not included properly, as result under mingw/msys "make" can not build tests. I built test "mainCPP" with CodeBlocks.

     
  • David Hoerl

    David Hoerl - 2014-01-28

    So far:

    • it turns out that Excel hangs when it tries to open the formulas.xls file I created. Given all the changes I made in the past month to the formulas code, obviously something broke. That file tends to just create pseudo-random formulas, so now I need to find out which one(s) break. I can see about 10 bytes that differ between my file and yours, the question is whether that is due to Mac/Windows or something else (I suspect the latter). This is going to take a bit of time to track down. I don't believe in the end that I will find a bug in formulas itself, more likely in the way they are randomly constructed.

    • regarding iconv, did you run the bootstrap program (i.e. ./bootstrap) - it might better construct a configure file. Just and idea...

     

    Last edit: David Hoerl 2014-01-28

Log in to post a comment.