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 694408 - ssconvert -S exports multiple copies of first sheet
ssconvert -S exports multiple copies of first sheet
Status: RESOLVED FIXED
Product: Gnumeric
Classification: Applications
Component: General
git master
Other Linux
: Normal normal
: ---
Assigned To: Jody Goldberg
Jody Goldberg
: 711868 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2013-02-22 05:49 UTC by Andreas J. Guelzow
Modified: 2018-05-10 18:18 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Andreas J. Guelzow 2013-02-22 05:49:58 UTC
Given a file Book1.gnumeric with two sheets, the command

ssconvert -S Book1.gnumeric Book1.txt

creates, as expected, 2 files Book1.txt.0 and Book1.txt.2 but both files contain the information from the first sheet.

This is http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=699751
Comment 1 Morten Welinder 2013-02-23 00:33:08 UTC
The logic in there (ssconvert.c:738) is pear-shaped.  It works for .cvs,
for example.  I am guessing that for .xls you get N copies of the same
file.
Comment 2 Andreas J. Guelzow 2013-02-23 00:54:24 UTC
Well, in Gnumeric, when we export to csv, the exporter exports only the current sheet; when we export to text we can choose the sheets to export.

ssconvert -S just changes the current sheet and calls the exporter, so i guess the default in the configurable exporter is just not correct.
Comment 3 Andreas J. Guelzow 2013-02-23 00:59:28 UTC
I see the problem:

Breakpoint 1, gnm_stf_file_saver_save (fs=0x8064db0, context=0x80c1578, 
    view=0xb5a23808, output=0xb5a25018) at stf-export.c:680
680		if (!stfe->sheet_list)
(gdb) p stfe->sheet_list
$1 = (GSList *) 0x0
(gdb) c
Continuing.

Breakpoint 1, gnm_stf_file_saver_save (fs=0x8064db0, context=0x80c15d0, 
    view=0xb5a23808, output=0xb5a250c8) at stf-export.c:680
680		if (!stfe->sheet_list)
(gdb) p stfe->sheet_list
$2 = (GSList *) 0x80d31d0
(gdb) 

For the first sheet we don't have an existing stfe->sheet_list so the current sheet is added. When we run the exporter the second time (supposedly for the second sheet), the sheet_list already exists and so we do not add the current sheet.
Comment 4 Morten Welinder 2013-02-23 15:29:02 UTC
We have three situations:

* single-sheet exporters like cvs.  This is what the code was meant for.

* multi-sheet exporters with sheet selector.  Just .txt, really.  Neither
  this code nor the sheet selection was meant to be used for this.  In fact,
  one could set the list of sheets using the right export options, so I don't
  think we can use that list for anything other than the list of sheets to
  export.

* multi-sheet exporters without sheet selector.  This is .xls and .gnumeric
  The code really wasn't meant for this, but it is not an unreasonable thing
  to do.
Comment 5 Morten Welinder 2013-02-23 16:07:10 UTC
A proper fix for this is going to be 1.13 stuff, but we can probably hack
some bandaid up in the meantime.

wb_view_save_as and similar are going to need an option object.
The GOffice base class for this should probably be pretty much empty.
The Gnumeric base class for this should probably have a sheet list and
not a whole lot more.
Comment 6 Dmitry Smirnov 2013-06-12 04:29:38 UTC
This problem is very well demonstrated in the corresponding Debian bug report:

    http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=699751#20
Comment 7 Andreas J. Guelzow 2013-11-11 23:01:18 UTC
*** Bug 711868 has been marked as a duplicate of this bug. ***
Comment 8 Morten Welinder 2015-12-29 02:08:28 UTC
Fixed for .txt, i.e., basically all single-sheet exporters.  All the multi-
sheet exporters will happily will put all sheets into every file.  (And,
given how this was hacked, the sheet order will be wrong in all but the
first output file.)
Comment 9 hamid 2016-01-08 18:41:35 UTC
First of all, thanks for the amazing job you done for free.

I am about to use ssconvert in a PHP project, but I am concerned why an aged discovered bug, which I also encountered with, is not yet fiexed. Is there going to be a fix at all? Is the project still under development? Or should I use an alternative solution?
Comment 10 Morten Welinder 2016-01-08 19:42:30 UTC
From comment 8:

"Fixed for .txt, i.e., basically all single-sheet exporters."

So it is mostly fixed.

It will, eventually, get fully fixed when someone who has the inclination
and time does it.
Comment 11 hamid 2016-01-09 01:58:49 UTC
Thanks for the time and effort. You are amazing.
Comment 12 Morten Welinder 2018-05-10 18:18:32 UTC
This problem has been fixed in our software repository. The fix will go into the next software release. Once that release is available, you may want to check for a software upgrade provided by your Linux distribution.