Bug 149716 - Content that was Cut is treated as deleted content by AutoRecovery
Summary: Content that was Cut is treated as deleted content by AutoRecovery
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.3.4.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: AutoSave-AutoRecovery-Backup
  Show dependency treegraph
 
Reported: 2022-06-24 14:21 UTC by jakkdl
Modified: 2023-07-18 20:22 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
The file as it was recovered, rows 3 to ~55 had textlabels in col A, then numbers & empty cells in B-V (64.34 KB, application/vnd.oasis.opendocument.spreadsheet)
2022-06-24 14:21 UTC, jakkdl
Details
File before cutting (13.58 KB, application/vnd.oasis.opendocument.spreadsheet)
2022-07-02 11:47 UTC, jakkdl
Details
Backup file (12.85 KB, application/vnd.oasis.opendocument.spreadsheet)
2022-07-02 11:47 UTC, jakkdl
Details
Recovered file, missing the cut cells (12.85 KB, application/vnd.oasis.opendocument.spreadsheet)
2022-07-02 11:47 UTC, jakkdl
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jakkdl 2022-06-24 14:21:50 UTC
Created attachment 180948 [details]
The file as it was recovered, rows 3 to ~55 had textlabels in col A, then numbers & empty cells in B-V

Heya,
I just selected a bunch of cells in my spreadsheet and (C-x) cut them. Calc immediately crashed, restarted & recovered the file - but it recovered the file as it was after the cells had been cut, but with an empty paste buffer, and an empty undo buffer, so all my cell data is (afaict) irrevocably lost since I last saved.

It was a large chunk of cells (like 30*50 cells), referenced in formulas & graphs both in this and in other sheets, so the crash may be due to any number of things

I'm failing to reproduce it, partly because I lost the sheet that was the cause of it. But regardless of why it crashed, it seems *extremely* bad that the document recovery does not handle a case like this and I might now become paranoid about cutting cells of data at all. This lost me many hours of work, and logged data that is now impossible to reproduce.
Comment 1 Rafael Lima 2022-06-24 18:21:23 UTC
Hi, thanks for your report.

Simply cutting a range with Ctrl+X does not remove it from the file unless it is saved. I ran a test on my PC:

1) Created a sheet with bogus data
2) Saved the file
3) Selected a range with data and Ctrl+X (the selected data disappears from the view)
4) I forced a crash by killing LO process
5) Restarted LO and File Recovery dialog showed up
6) Proceeded with recovery
7) The file with all the data was recovered, including the range I had cut

What may have happened is that the file was restored to the last point it was saved before the crash.
Comment 2 Rafael Lima 2022-06-27 21:34:09 UTC
Hi, can you please try to provide a sample file and the steps to reproduce the error?
Comment 3 jakkdl 2022-07-02 11:46:36 UTC
Huh, that's strange. It definitely was not restored to an older point, as I had newer data in other tabs and cells that did not get lost.

But yeah I can easily reproduce the error by following the same steps as you:

1. Create new file, filled with values and saved (reproduce_error_pre_cut.ods)
2. Cut a bunch of cells
3. Waited 10 minutes for file to show up in `.config/libreoffice/4/backup` (reproduce_error.ods_0.ods)
4. `pkill -f libreoffice`
5. Start libreoffice, recover files, they now don't have the cut cells. (reproduce_error_post_crash.ods)

(adding the files as attachments)


Version: 7.3.4.2 / LibreOffice Community
Build ID: 30(Build:2)
CPU threads: 8; OS: Linux 5.18; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
7.3.4-2
Calc: threaded
Comment 4 jakkdl 2022-07-02 11:47:12 UTC
Created attachment 181083 [details]
File before cutting
Comment 5 jakkdl 2022-07-02 11:47:35 UTC
Created attachment 181084 [details]
Backup file
Comment 6 jakkdl 2022-07-02 11:47:58 UTC
Created attachment 181085 [details]
Recovered file, missing the cut cells
Comment 7 Rafael Lima 2022-07-02 13:01:22 UTC
Thanks for the info.

So I'm assuming you have the option "Save AutoRecovery information every 10 minutes" enabled, right? It is found under Tools - Options - Load/Save - General

If this option is enabled, the AutoRecovery information is automatically saved every 10 minutes and if LO crashes and you choose to recover the file, then the recovery info will be applied on top of the existing file. So any editing you did to the file, including data deletion, is applied to the file. This is why you had the data loss.

Please confirm if the option I mentioned is enabled.

The weird thing in your case is that you did not delete the content, but instead Cut it. IMO cutting cells should not be treated as deleting content with respect to Recovery information. We may need to revise this behavior.
Comment 8 jakkdl 2022-07-02 14:33:09 UTC
It's not checked, and I'm a bit confused because checking it and changing the value does not seem to do anything - it seems to ignore whatever is set in that window and treat it as checked and 10 minutes (AutoRecovery file reliably shows up after 10 minutes).

But yeah it's just as you say, the cut data is treated as deleted and as such if there's new info entered there since you last manually saved the file it is gone. Unclear why it differs from your system though.

Tried it in Writer and cut data was lost there as well.
Comment 9 Rafael Lima 2022-07-03 12:52:59 UTC
I reproduced the steps in Comment #3 and indeed the cells that were cut (not deleted) are lost after recovery even with the option "Save AutoRecovery information every 10 minutes" unchecked.

I believe the expected behavior would be to have these cells that were cut recovered to the file, since they were not deleted (neither was their content) by the user.

I am setting this to NEW.

Confirmed in

Version: 7.3.4.2 / LibreOffice Community
Build ID: 30(Build:2)
CPU threads: 12; OS: Linux 5.15; UI render: default; VCL: kf5 (cairo+xcb)
Locale: pt-BR (pt_BR.UTF-8); UI: en-US
Ubuntu package version: 1:7.3.4-0ubuntu0.22.04.1
Calc: threaded
Comment 10 Justin L 2023-07-18 20:22:16 UTC
This is not a bug.

What would happen if, after you cut the cells, that you saved the document and exited? The same thing would happen.

AutoSave is nothing more than "10 minutes are up - let me save a recovery copy", and so is no different than if you do the same steps manually. And Emergency save is the same thing - "oh no, I'm crashing. Let me try to save a recovery copy first".

You cannot expect clipboard (which is an OS thing) to be saved along with your LibreOffice document.

While the crash certainly is a bug, the recovery process described here is NOTABUG. (LibreOffice cannot anticipate your preferred state of the document in order to prepare for a possible crash.)

P.S. These config options required a restart of LibreOffice in order to take effect. Since 7.5 the user is warned about that.