Bug 159008 - Autorecovery files are deleted on close when you say no to saving a modified document - would be nice to keep anyway as a safety net.
Summary: Autorecovery files are deleted on close when you say no to saving a modified ...
Status: RESOLVED DUPLICATE of bug 89651
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: needsUXEval
Depends on:
Blocks:
 
Reported: 2024-01-03 22:54 UTC by Jeff
Modified: 2024-01-30 17:43 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jeff 2024-01-03 22:54:44 UTC
Description:
When you close a libreoffice calc document and click "do not save changes", libreoffice calc does a hard delete of some sort on the autorecovery files in the Backups path of Libreoffice.  The files are no longer recoverable using data recycle bin or even data recovery software as they should be if the files were just normally deleted.  It's like they never existed. This is a problem if you make a mistake and click no in the save dialog box.   

Using windows 11. 

Steps to Reproduce:
1.open file in libreoffice calc for example
2.Make change to a cell
3.Wait for auto backup to occur and confirm file in backups folder
4.Close libreoffice calc and do not save changes.
5.check backups folder autobackup file is gone.
6.try recycle bin or data recovery software and the files will not show up.

Actual Results:
backup autorecovery files are all gone

Expected Results:
Be able to recover the files with data recovery software

Two possible solutions:
1)different method to delete the files in the backup folder when you close without saving so that there is some way to recover the backups

2)Change libreoffice to keep backup files for x days and clean up old ones on startup.  On a normal close of a libreoffice file where someone cooses to not save the document, rename the autorecovery files so they don't impact the next time libreoffice wants to create them when the file is opened.



Reproducible: Always


User Profile Reset: Yes

Additional Info:



Version: 7.5.2.2 (X86_64) / LibreOffice Community
Build ID: 53bb9681a964705cf672590721dbc85eb4d0c3a2
CPU threads: 16; OS: Windows 10.0 Build 22621; UI render: Skia/Raster; VCL: win
Locale: en-CA (en_CA); UI: en-US
Calc: CL threaded
Comment 1 Stéphane Guillou (stragu) 2024-01-20 00:31:36 UTC
I can see that the autorecovery file (same extension as file being edited, e.g. ODT) saved in the "backup" path (specified in Tools > Options > LibreOffice > Paths, e.g. /home/username/.config/libreoffice/4/user/backup on Linux) is deleted as soon as "don't save" is clicked in the exit dialog (or as soon as the file is saved). I haven't tested if it can be somehow recovered on Linux.

That being said, I see not leaving traces as a good thing: I expect a user clicking "do not save" to not want anyone to be able to recover data they explicitly chose _not_ to store.
AutoRecovery is designed for when something unexpected happens (e.g. a crash). If the user says "don't save the changes", LO should delete those changes.

If you want to always store your changes, you can chose "automatically save the document too", and create n-1 backup copies with "Always create backup copy" (the .bak file in the backup directory, which does not get deleted).
[Please test with version 24.2, as this area saw some changes - see https://wiki.documentfoundation.org/ReleaseNotes/24.2#Core_/_General)

In my opinion, "not a bug". Justin and the UX/design team can weigh in.
Comment 2 Justin L 2024-01-20 02:29:02 UTC
I agree "not a bug". Libreoffice cannot keep copies of every document that has been modified on a computer - that is a privacy concern. AutoRecovery is for the recovery from computer error, not human error.

If you want to keep backups for human error, then I suggest using dedicated backup software - since that is specifically designed for doing that task. You can point your backup software to the folder that LibreOffice backs up to, and then do any kind of versioning/snapshotting at any time interval you want.

In any case, this would be a duplicate variation of other bug reports that want LibreOffice to become a full-fledged backup program.

*** This bug has been marked as a duplicate of bug 89651 ***
Comment 3 Jeff 2024-01-20 06:11:33 UTC
In my case I was unaware "Save Autorecovery information every x minutes" and "Always create backup copies" was not on by default in the install so neither were enabled for me.  

It looks like this has been changed in a recent update 24.2 - "Changes in automatic saving of documents: "Save AutoRecovery information" is turned on by default, as well as "Always create backup copies"."   

And then on top of that I accidentally clicked do not save, so I went hunting for a way to recover my lost data. 


Stéphane's solution to ensure "Always create backup copy" is checked might resolve my concern (I was unaware of the feature), however it doesn't seem to be working as I expected it.

Stéphane's comment  -  "If you want to always store your changes, you can chose "automatically save the document too", and create n-1 backup copies with "Always create backup copy" (the .bak file in the backup directory, which does not get deleted)." 

After reading it my assumption was that when Libreoffice autosaves, a backup file would be created. I figured n was a setting you could set for how many backups you wanted it to rotate through to ensure there are not too many files created. However I couldn't find a setting to change to configure n. 

From what I can tell a backup file is 'only' created when you manually save the file, and not when libreoffice autosaves.  Also there do  not look to be multiple .bak copies of the original file created.  Instead every time you manually save (and keep the app open) the single .bak file is overwritten.
   

Steps I took to test:
-------------
-Installed latest Libreoffice 7.6.4
-Rebooted
-I have ensured in Libreoffice calc both "Always create backup copy" and "Save autorecovery information every x minutes" are checked.  I then shutdown libreoffice calc and restarted it.
-I opened a blank sheet and saved it with a name "testautosave.ods"
-Then made changes to it and left it sitting.
-I see the autorecovery file testautosave.ods in the C:\Users\XXXXXX\AppData\Roaming\LibreOffice\4\user\backup Folder.  
-I see the autorecovery file in the backup folder get an updated modified time stamp per the configured time.
-However, there are no additional backup files eg testautosave.ods.bak 
-As soon as I close the libreoffice calc file, the autorecovery file "autorecovery.ods" is deleted from the backup folder and the backup folder is left empty.

2nd test for "Always create backup copy"
---------------------------------------
-opened testautosave.ods again
-make a change 
-press file->Save
-testautosave.ods.bak file created
-make another change and manually save again
-testautsave.ods.bak gets its modified time updated, but there is still only on .bak file.



I did some testing with another popular spreadsheet application to see how it operates as well. When you have autorecovery turned on, it will create the backup folder/files just as libreoffice does.  If you close the file and 'don't save' it keeps that unsaved autorecovery backup information.   When you open the original file again it versions the recovery files.  Then when you save the original file manually, only then does it delete all the the autorecovery files.  

I don't think having backups saved in your backups folder is really a privacy concern since those folders should be in profile secured locations anyhow.

Maybe this would need to move to a feature request if "Always create backup copies" is working as intended. With the way things seem to work now, a simple mistake of clicking do not save can be a loss of significant work.   

Related to Justin's note "In any case, this would be a duplicate variation of other bug reports that want LibreOffice to become a full-fledged backup program."  The ask here is not for Libreoffice to become a full fledged backup program. What is being requested is a way to ensure data you are working with in libreoffice has a way to be recovered if a mistake is made when closing the program and click do not save.  The only place this can be done is in Libreoffice since the data only resides in the programs memory or it's own autorecovery /autosave backups.  People make mistakes and technology is there to save us from them :)
Comment 4 Justin L 2024-01-20 16:43:37 UTC
(In reply to Jeff from comment #3) 
> chose "automatically save the document too", and create n-1 backup copies
Yes, there is only one backup file. The next save replaces the backup copy.

In this case, Stéphane's "n-1" probably intended to mean the "previous version" and not "the number of backups".

(In 24.2, you have the option to place that backup into the same folder as the document itself.)

> From what I can tell a backup file is 'only' created when you manually save
> the file, and not when libreoffice autosaves.
> -Installed latest Libreoffice 7.6.4
At this point it isn't terribly helpful to look at what happens in 7.6. As Buovjaga said, a lot has changed in 24.2.

However, "backup file is not updated when autoRecovery runs" is still true in 24.2. That makes sense - the backup is only a copy-before-write when the document itself is changed.

Chose "Automatically save the document too" if you want to update the backup file at every autosave interval. Note that this changes your actual document every time (and does NOT create an ODF recovery version in the backup/recovery folder).
Comment 5 Jeff 2024-01-20 17:10:32 UTC
AH I see now 24.2 is prerelease, I was confused by the numbering and though it was some other internal one the devs were using.   I only saw 7.6.4 as the latest on the webpage missed 24.2 down at the bottom.

Would it makes sense to put in a feature request to add an option for "save autorecovery backup file" which would only update the autorecovery and .bak file at the autorecovery interval?  Would that done in Bugzilla as well?

This would allow for some level of backup protection without being forced to autosave every primary document you have open all the time as "Automatically save the document too" would currently do. 

Read the full changelog for 24.2, some nice updates!
Comment 6 Justin L 2024-01-30 17:43:29 UTC
(In reply to Jeff from comment #5)
> Would it makes sense to put in a feature request to add an option for "save
> autorecovery backup file"
No - the fact that it is attached as a duplicate is enough I think.

This is an extremely niche request. LO could NOT prompt you on open to say that there is a dangling document - that would be terribly annoying and confusing because you already said you didn't want it saved on exit. So it would completely be left to the user to actively seek and recover that file.

Plus, it would eventually lead to a large build-up of files.

You can achieve the result you want by pointing your backup software at LO's backup folder.