View Issue Details

IDProjectCategoryView StatusLast Update
0004098FreeCADBugpublic2021-12-04 23:39
ReporterTheMarkster Assigned Towmayer  
PriorityimmediateSeverityblockReproducibilitysometimes
Status closedResolutionfixed 
Target Version0.20Fixed in Version0.20 
Summary0004098: FreeCAD should not exit if unable to rename backup file to project file while exiting
Descriptionhttps://forum.freecadweb.org/viewtopic.php?f=3&t=38788

Always when saving the attached file I get a warning in the report view:

Cannot rename project file to backup file
Cannot rename file from 'C:/Users/mwganson/Downloads/GoProMount.FCStd.c27e1393-a630-4287-80f0-e7503c09798a' to 'C:/Users/mwganson/Downloads/GoProMount.FCStd'

FreeCAD

When I open that folder I see multiple files in the form of GoProMount.FCStd.long-guid-sequence-of-letters-and-numbers. The project file: GoProMount.FCStd does not contain the latest changes, which instead are (presumably) in the latest guid file.

The workaround for this is to delete all of those files (or just the GoProMount.FCStd file) and try again. No warnings and the file gets updated that way (until I need to save it again). This is only an inconvenience for me because I understand the workaround and how to recover my data, but most users will not understand. Their data is there, but might as well not be there because they won't know.

There is something failing for some reason during this process of creating the temporary guid file and renaming it to the project file.

The worst part of this is if I exit FreeCAD with unsaved changes and elect to save the changes on exit the save fails and yet FreeCAD still exits without any warning message. FreeCAD should not exit. It should remain open so the user can save as the file to another location or at least be told his data is safe in this new guid file, which must be renamed manually.
Steps To ReproduceIt is unlikely anyone can reproduce, but the file is attached. Open it, make some change to it, then click save. A warning will appear in the report view about being unable to rename the project file if you are able to reproduce. I am always 100% of the time able to reproduce with this file on my system if it is in the c:\users\mwganson\downloads folder, but if I move it from that folder, then I can no longer reproduce the issue.

One thing to try, which I haven't tried, is to step through in debug mode with a breakpoint at the line where the file is about to be renamed. Open the folder containing the file and if GoProMount.FCStd does not exist, then add it there before allowing the code to proceed past the breakpoint. I suspect the reason the renaming fails is because the file of the same name still exists. If that is what is happening, then this should reproduce the warning message upon continuing past the breakpoint.
Additional InformationThis issue existed prior to the Link merge, and is unrelated to that. I believe the warning was added to code in a commit some 10 months ago.

OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.17877 (Git)
Build type: Release
Branch: master
Hash: 1e19ef5be4735f4200eaf99ce9e487d2be6f4151
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/United States (en_US)
TagsNo tags attached.
FreeCAD Information

Activities

Kunda1

2019-08-26 12:50

administrator   ~0013468

Last edited: 2019-08-26 12:51

Changed to confirmed status since @chrisb mentions in the thread his may result in data loss.
I'll also assign it to 0.19 so devs can implement or defer it.

wmayer

2021-02-28 07:14

administrator   ~0015457

See also: https://forum.freecadweb.org/viewtopic.php?f=3&t=56062

Kunda1

2021-03-27 11:38

administrator   ~0015555

Upped the priority of this ticket as it results in data loss.

uwestoehr

2021-09-16 17:29

manager   ~0015940

partially fixed by: https://github.com/FreeCAD/FreeCAD/pull/4996

What else needs to be fixed now?

uwestoehr

2021-09-16 18:29

manager   ~0015942

reported as completely fixed: https://forum.freecadweb.org/viewtopic.php?p=533597#p533597

Issue History

Date Modified Username Field Change
2019-08-25 17:42 TheMarkster New Issue
2019-08-26 12:50 Kunda1 Status new => confirmed
2019-08-26 12:50 Kunda1 Note Added: 0013468
2019-08-26 12:50 Kunda1 Target Version => 0.19
2019-08-26 12:51 Kunda1 Note Edited: 0013468
2021-02-06 06:50 abdullah Target Version => 0.20
2021-02-28 07:14 wmayer Note Added: 0015457
2021-02-28 07:15 wmayer Assigned To => wmayer
2021-02-28 07:15 wmayer Status confirmed => assigned
2021-03-27 11:38 Kunda1 Priority normal => immediate
2021-03-27 11:38 Kunda1 Severity major => block
2021-03-27 11:38 Kunda1 Note Added: 0015555
2021-09-16 17:29 uwestoehr Note Added: 0015940
2021-09-16 18:29 uwestoehr Status assigned => resolved
2021-09-16 18:29 uwestoehr Resolution open => fixed
2021-09-16 18:29 uwestoehr Fixed in Version => 0.20
2021-09-16 18:29 uwestoehr Note Added: 0015942
2021-12-04 23:39 wmayer Status resolved => closed