03-16-2015, 12:24 AM | #16 |
Ex-Helpdesk Junkie
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
True, but you did in part respond to BR -- whose additional concern was for people who don't habitually save, and might lose their work regardless.
It is a nice idea -- although I would understand if you don't feel the urge to implement it. |
03-16-2015, 12:42 AM | #17 | |
creator of calibre
Posts: 44,034
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Implementing autosaves is actually trivial, about 10 lines of code, since in the calibre editor, saving occurs as an async background process in any case. Here I mean an autosave as a normal save, just automated.
However, IMO, autosaves are a terrible idea. There is no guarantee that the state of the book is valid when an autosave occurs, for example, you could in the middle of typing a tag making the html invalid, or a multi-step search and replace or whatever. And note that BR actually said: Quote:
|
|
Advert | |
|
03-16-2015, 12:59 AM | #18 |
Ex-Helpdesk Junkie
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
We are talking at cross-purposes I think.
Consider the feature of your average word processor -- if it closes unexpectedly, it leaves the file alone but offers (Document Recovery pane) to restore you to your work-in-progress as of the last auto-pseudo-save (which doesn't write to the original, but to backup data). The user has the choice to reject the offered Restore, but if one isn't as careful at saving as they should be, it could save them quite a bit of almost-lost progress. |
03-16-2015, 01:27 AM | #19 |
creator of calibre
Posts: 44,034
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Indeed, I am talking about protection from corruption by a crash during a save operation.
You are talking about protection from losing work done since the last save. Two totally different things, that have no connection. I suggest we stop confusing the issue in this thread, which, if I understand the OP correctly is about corruption of an ebook by a crash/forced shutdown during a save operation. Last edited by kovidgoyal; 03-16-2015 at 01:31 AM. |
03-16-2015, 01:30 AM | #20 |
creator of calibre
Posts: 44,034
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
As for the OP's question, which was actually how to recover a corrupted epub file.
@Toreth: An EPUB file is really just a ZIP file. The error indicates that the underlying ZIP file itself was corrupted. calibre tries hard to recover from common forms of zip file corruption, so if calibre cannot open it, you are probably out of luck. One thing you can do is try to open it in WinZip (which has even more workarounds for zip file corruption). If it can repair the ZIP file you should then be able to open it in other programs. |
Advert | |
|
03-16-2015, 01:38 AM | #21 | |
....
Posts: 1,547
Karma: 18068960
Join Date: May 2012
Device: ....
|
I'm not sure if the problem was a crash or a forced reboot by Windows Update (the latter would surprise me), but if the latter then in addition to BR's:
Quote:
It's in Local Computer Policy>Windows Components>Windows Updates and the setting to edit is "No auto-restart with logged on users for scheduled automatic updates installations". (To get to Local Group Policy - Run gpedit.msc or for Win 8 is quicker to just type gpedit.msc on the Start Page.) If "Enabled" the computer waits for the user to restart the computer. |
|
03-16-2015, 02:52 AM | #22 |
null operator (he/him)
Posts: 20,702
Karma: 26966376
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
There's no reason why an 'autosave' cannot be done atomically. The autosave features I know of don't write over the real file they write it to a user specified location, the default of which is typically something like %appdata%\somewhere or %documents%\somewhere. Where I can I change it - word, notepad, excel and calibre.
An Autosave will not get you back to the very last keystroke, at best it will get you back to the previously completed autosave - unless of course your autosave device failed. Even Sabre's checkpoint/restart was never 100%, nor was Tandem's Non Stop. I know of 2 prize winning published authors who turned off autosave in Word (they were told by some geek that it made Windows 'really' slow). They both also lost half or more days work due to power fails - when your on a roll you don't bother with ctrl/s. BTW when I write something lengthy in Word I don't write it as a monolithic document. I use Word's Master Document feature to break it up into smaller files (parts, chapters), Master Documents first saw the light of day in Word '97. Sound familiar ? @AnotherCat - good point, pssst - I filched a Registry patch from Windows 7 Forum that puts gpedit in the control panel. BR Sabre is an airline reservations systems - one of first 24*7 transaction processing systems (initially developed in the 1950/60s). Is still used by many (most ?) international airlines ==>> Sabre (computer system) Last edited by BetterRed; 03-16-2015 at 03:24 AM. Reason: Ack AnotherCat |
03-16-2015, 03:08 AM | #23 |
creator of calibre
Posts: 44,034
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
What has autosaves being done atomically or not have to do with anything? You complained that Sigil and the calibre editor do not allow you to recover a document corrupted by a crash. I explained to you that the calibre editor cannot ever corrupt a document due to a crash.
Once again, there are two totally separate things that you seem to be conflating 1) Protection from file corruption caused by a crash/forced shutdown during a save operation 2) The ability to recover (some) unsaved work The two have nothing to do with each other. (1) is irrelevant to the calibre editor, since it can never happen. (2) is irrelevant to the topic of this thread, since it is not what the OP is asking about. And while on the subject of irrelevancy, I dont see why this thread belongs in a calibre forum at all. The EPUB in question was corrupted by Sigil and a better place to ask about techniques for recovering corrupted EPUB files would be the forum dedicated to EPUB. |
03-16-2015, 03:40 AM | #24 |
null operator (he/him)
Posts: 20,702
Karma: 26966376
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Totally agree Kovid,
However IMO your earlier post implied that an autosave written for the purpose of recoverability couldn't be done atomically. But I don't want to get into a semantic argument about it. I was minded to move the thread back to Sigil, following post 10 from Ripplinger. There's a good chance the EPUB is in %LOCALAPPDATA%\Temp\sigil\scratchpad Moved back to Sigil - OP's problem has nothing to do with Calibre |
03-16-2015, 10:36 AM | #25 |
Sigil Developer
Posts: 7,763
Karma: 5446592
Join Date: Nov 2009
Device: many
|
Sigil saves to a temp epub first and then physically overwrites the original epub to save extended file attributes on the Mac. Only once the copy is successfully complete does it delete the temp epub in the temp folder.
So since the file copy never completed, there should be a temp version of the epub as a zip file someplace in the temp directory. Unless the reboot caused the temp directory to be wiped. On Mac is typically is not wiped until needed. I am not sure how that works on Windows. So he should find the entire epub as a zip in the Sigil temporary directory on his OS. |
03-16-2015, 06:36 PM | #26 | |
null operator (he/him)
Posts: 20,702
Karma: 26966376
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Quote:
I can confirm that if Sigil is not closed gracefully in Windows then the copy of the file under edit (as originally read) remains in ...\Temp\sigil\scratchpad - it's unpacked so it would need to be zipped with epub extension. If I restart Windows and Sigil has an unsaved file, I get Sigil's normal "File hasn't been saved - Save, Discard, Cancel" popup message, and if I ignore that I get the following after ~10 seconds I think that waits forever for a response. But I'm not sure if the above is true if Windows Update initiates the Restart automatically, the way I have it configured that can't happen and I'm not minded to change it for testing. So I suggest there's nothing to do... unless if'n you wanted to implement some sort of recovery scheme via automatic periodic saves BR |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Sigil unable to open a file | Andjety | Sigil | 39 | 03-20-2017 11:08 PM |
unable to open database file | mihal.v | Calibre | 3 | 08-16-2014 09:44 AM |
Unable to open database file | wladdy | Library Management | 6 | 08-28-2012 05:04 AM |
Unable to open database file | JulieR | Calibre | 2 | 04-24-2009 04:40 AM |
Unable to open file that is 8MB | timyap | Sony Reader | 12 | 05-09-2008 09:51 AM |