Issue 46480

Summary: Backup before saving new version overwrites wrong backup file
Product: General Reporter: olio <nlh>
Component: uiAssignee: AOO issues mailing list <issues>
Status: CONFIRMED --- QA Contact:
Severity: Normal    
Priority: P3 CC: awf.aoo, elish, flibby05, guenter.marxen, issues, jsc, kami911, mroe.nospam, mseidel
Version: OOo 1.1.3Keywords: oooqa
Target Milestone: 4.2.0   
Hardware: PC   
OS: Windows, all   
Issue Type: DEFECT Latest Confirmation in: 4.1.0-dev
Developer Difficulty: ---
Attachments:
Description Flags
Append .bak
none
Update none

Description olio 2005-04-01 12:30:12 UTC
When checking the "Create backup" under "Save settings" in Writer and Calc 
they will create a backup under the following folder:
..\OpenOffice.org1.1.3\user\backup

The backup file will have the filename of the original file and the 
extension .bak. The error occurs when you have a file open in Writer called 
123.sxw and at the same time work on a Calc file called 123.sxc. These two 
files will overwrite each others backup file.

The problem is the same when you have to instances of Writer open with the 
same filename in different folders.
Comment 1 michael.ruess 2005-04-01 13:15:37 UTC
Framework issue.
Comment 2 flibby05 2005-04-01 17:22:53 UTC
hi olio, version 1.1.3 is too old now.
please retest with 1.1.4 and / or latest milestone build.
both of them are available free of charge from our download section.

closing for now. please reopen if you can reproduce with 1.1.4 or latest
milestone build.
Comment 3 flibby05 2005-04-01 17:23:09 UTC
.
Comment 4 olio 2005-04-02 10:37:51 UTC
Retested problem on OpenOffice 1.9.74, where the problem is the same, only the 
folder used for backup files has changed to:

C:\Documents and Settings\Administrator\Application Data\OpenOffice.org1.9.74
\user\backup
Comment 5 thorsten.martens 2005-04-08 13:12:53 UTC
TM->requirements: Please have a look. This is not a defect but seems to be worth
to think about our behaviour of backing up documents. So I set this one to
"enhancement"
Comment 6 bettina.haberer 2005-08-15 11:12:26 UTC
Reset to OOo later.
Comment 7 kami911 2007-08-17 09:44:42 UTC
This issue is simply to solve:
let's name the backup files after the full file name (with extension) of document:
test1.odt ->  test1.odt.bak
test99.ods ->  test99.ods.bak

But also there is another problem:
If you resave file from with backup:
\Document folder\Document_with_same_name.odt
then you save document with same name but from a different location
\Other document folder\Document_with_same_name.odt
the second document's backup overwrote the first one. Is this issue related to
this issue, or should I fill a new file?
Comment 8 kami911 2007-08-17 09:53:47 UTC
or we can simply introduce a new set of extensions:

ob?


for example obt - for text backups
for example obd - for draw backups
for example obp - for presentations backups

etc.
Comment 9 kami911 2007-08-17 10:45:03 UTC
sfx2/source/doc/docfile.cxx handles the backup:
void SfxMedium::DoBackup_Impl()
Comment 10 hhharry 2008-11-07 16:46:06 UTC
Same Problem under OO 3.0.

I think to fully solve this issue the Backups must be

1. named as the original file +bak. (so text.odt will bbe test.odt.bak and
test.ods will be test.ods.bak)
-  OR  - e ad other extensions like kami suggested
for example obt - for text backups
for example obd - for draw backups
for example obp - for presentations backups
etc.


and 
2. The backups must be in the same folder as the original files.
Thats the way it is in many applications including MSOffice.
Comment 11 lgaterarin 2010-11-11 03:30:11 UTC
Created attachment 74136
Comment 12 Edwin Sharp 2014-02-27 13:26:49 UTC
As given in description.
AOO410m1(Build:9750)  -  Rev. 1569541
Rev.1569541
Win 7
Comment 13 Andre 2014-02-27 13:39:00 UTC
Looks like sfx2/source/doc/docfile.cxx
(http://aoodev1:8080/source/xref/current/main/sfx2/source/doc/docfile.cxx#2104)
is the file where the backup is created.
Comment 14 Oliver-Rainer Wittmann 2014-02-27 13:53:24 UTC
(In reply to Edwin Sharp from comment #12)
> As given in description.
> AOO410m1(Build:9750)  -  Rev. 1569541
> Rev.1569541
> Win 7

You also requested the show-stopper status for this issue.
Could you please give corresponding reasons, why should such an old issue become a show-stopper for the next release? Thx in advance.
Comment 15 Edwin Sharp 2014-02-27 14:05:41 UTC
bug 124106 got a show-stopper and AFAIK more users are using backup than pages 5.
despite issue age, backup is a feature that IMHO should work flawlessly as users rely on it as a savior.
Comment 16 jsc 2014-02-27 14:14:44 UTC
I don't see that this issue will be fixed in time but if somebody is able to provide a fix we will integrate in 4.1. I don't see it directly as showstopper.
Comment 17 Andre 2014-02-27 15:37:45 UTC
Created attachment 82734 [details]
Append .bak

Here is the simple solution: keep existing extension and append .bak.
Made some simple tests (on Windows), works well.
Comment 18 Andre 2014-02-27 15:46:24 UTC
Created attachment 82736 [details]
Update

This time only the promised fix: Append not replace .bak
Comment 19 Edwin Sharp 2014-02-27 16:47:52 UTC
What happens if homework.ods in both Math directory and Physics directory?
IMHO full path for backup name more robust solution, i.e.:
C_Users_Edwin_Documents_Math_homework_ods.bak
C_Users_Edwin_Documents_Physics_homework_ods.bak
Comment 20 Andre 2014-02-28 08:06:20 UTC
@Edwin: That is why I called it 'simple' solution and did not commit it.  For the inclusion of the path we first have to agree on a proper naming scheme.  The use of underscores to separate directory names for instance does not work when the directory names themselves contain underscores:

a/b_c/file and a_b/c/file would both be mapped to the same a_b_c/file.

Therefore we should think whether we want an improvement now (shortly after the release) or a perfect solution in the future.
Comment 21 Edwin Sharp 2014-02-28 08:25:58 UTC
Good solution later > Not a good solution now.
The perfect solution will know how to handle built in underscores and perform truncation when necessary according OS naming limitation.
Comment 22 Andre 2014-02-28 08:37:09 UTC
@Edwin: As you wish, I have adapted importance accordingly.  Can you please reset the release blocker flag?
Comment 23 Oliver-Rainer Wittmann 2014-02-28 09:02:17 UTC
(In reply to Edwin Sharp from comment #15)
> bug 124106 got a show-stopper and AFAIK more users are using backup than
> pages 5.
> despite issue age, backup is a feature that IMHO should work flawlessly as
> users rely on it as a savior.

Some background on bug 124106 to make clear that it is not so easy to compare issues just by their summary:
- For bug 124106 corresponding related bugs exist, namely 123702, 123761 and 124058 - as given in my show-stopper status request. Four bugs recently submitted is an indication of the high relevance of this issue.
- Bug 124106 and the related ones show quite big drawbacks in our *.docx import filter which are in general not triggered by *.docx files created by Microsoft Office. But the documents are conform to the OOXML file format.
- Interoperability with documents in OOXML file format is one of the big important points for our users due to the made survey conducted last year.

Thus, please understand my question for the show-stopper status request for this issue.
This issue occurs in OpenOffice versions since 2004, it got no duplicates and no votes, and there was no activity on it since 2008. In my point of view this issue is far less important than 124106.
Comment 24 Edwin Sharp 2014-02-28 09:17:17 UTC
OK, thanks.
Do you think there is room for improvement in:
https://wiki.openoffice.org/wiki/Showstopper ?
Comment 25 g.marxen 2014-02-28 13:41:12 UTC
Please store the backup-file in the same folder as the original, like other applications do. 

Together with appending "bak" (instead of replacing) there can be no problem.

g.marxen
Comment 26 Edwin Sharp 2014-02-28 13:51:42 UTC
"don't put all your eggs in one basket"

I'm against saving backup and original in the same location.
Comment 27 Andre 2014-02-28 14:22:42 UTC
@g.marxen: The original file might be in a location that is unsuitable for backups (eg the template repository of a company).

@Edwin: Agreed, but I don't think that the use of backup in this context is not an insurance against drive failure but more a means against user error.
Comment 28 g.marxen 2014-03-01 01:02:01 UTC
The backup-copy is not a real backup but the "last saved version" before the new version. So it makes sense to have it in the same folder as the actual "new" version. So you can easily go back to the "last" version, if f.e. the new version is corrupt, f.e. caused by a crash.

The bak-version is no substitute for a backup of the new version (and older versions) on a different disk drive (Server, NAS etc.). 

So if you have your eggs only on the build-in disk drive, it makes no difference, if new and bak-version are in different folders. 

Having them in one folder, there is no need to "construct" new file names to avoid conflicts. That's the big advantage over your proposal.
Comment 29 Edwin Sharp 2014-03-21 12:55:51 UTC
Please fix this issue for the next release.
Thank you for realizing its importance.
Comment 30 mroe 2014-03-21 16:21:52 UTC
(In reply to g.marxen from comment #28)
> The backup-copy is not a real backup but the "last saved version" before the
> new version. So it makes sense to have it in the same folder as the actual
> "new" version. So you can easily go back to the "last" version, if f.e. the
> new version is corrupt, f.e. caused by a crash.
> 
> The bak-version is no substitute for a backup of the new version (and older
> versions) on a different disk drive (Server, NAS etc.). 
> 
> So if you have your eggs only on the build-in disk drive, it makes no
> difference, if new and bak-version are in different folders. 

But there are many related aspects. e. g. you have a USB stick which a large Document. (Yes documents especially with included pictures can be somewhat of big!) If you save the changed file and there is no more place left for a copy ... what should AOO do? At worst case you lost the file completely.


> Having them in one folder, there is no need to "construct" new file names to
> avoid conflicts. That's the big advantage over your proposal.

If you work on test.odt, test.ods and test.odp in the same folder you will have only one test.bak only for last saved file.


This behaviour is discussed since a long time ago. But I don't remember all the reasons why it wasn't changed. Maybe that a user have the right to edit files but not the right to create new files in the folder. Maybe the capability of OO edit documents via FTP and other protocols.
So the only "save" version is to save the copy at a place that is known that the user have the right to create a file.
Comment 31 g.marxen 2014-03-21 19:52:42 UTC
(In reply to mroe from comment #30)
> 
> But there are many related aspects. e. g. you have a USB stick which a large
> Document. (Yes documents especially with included pictures can be somewhat
> of big!) If you save the changed file and there is no more place left for a
> copy ... what should AOO do? At worst case you lost the file completely.

Working on a USB-stick is like requesting for data loss, that might be OK with tiny files you can recreate in a minute. With large documents: good luck.

> If you work on test.odt, test.ods and test.odp in the same folder you will
> have only one test.bak only for last saved file.

You forgot the proposal to append .bak and not replace the original extension.

If it's not too much work for a developer there could be addionally an option for the "bak-path" in tools/options but then it could be more complicated to avoid any overwrite of bak-files.
Comment 32 mroe 2014-03-21 20:07:38 UTC
(In reply to g.marxen from comment #31)
> > But there are many related aspects. e. g. you have a USB stick which a large
> > Document. (Yes documents especially with included pictures can be somewhat
> > of big!) If you save the changed file and there is no more place left for a
> > copy ... what should AOO do? At worst case you lost the file completely.
> 
> Working on a USB-stick is like requesting for data loss, that might be OK
> with tiny files you can recreate in a minute. With large documents: good
> luck.

It is quite clear for me and for you ... but AOO should respect all users ...

> > If you work on test.odt, test.ods and test.odp in the same folder you will
> > have only one test.bak only for last saved file.
> 
> You forgot the proposal to append .bak and not replace the original
> extension.

Sorry. I have overlooked comment 25.