ZIP corruption on Esc during repacking on USB stick

Bug reports will be moved here when the described bug has been fixed

Moderators: white, Hacker, petermad, Stefan2

User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

ZIP corruption on Esc during repacking on USB stick

Post by *MVV »

Reproduce:
1. Create some test ZIP and copy it to USB stick.
2. Add some file to it (not too small).
3. Press Esc during Rename/Move operation.
4. TC shows a message with no choice:

Code: Select all

---------------------------
F:\TEMP\CMDE624.zip
---------------------------
User abort!
---------------------------
OK   
---------------------------
5. Archive on a USB stick is now in corrupted state.

TC8b22x32


As I see, TC packs data to temp archive and then replaces original archive with updated one. But during regular copy operation I am able to cancel interruption and continue copying. But during repacking I have no chance to continue copying so I lost my archive completely (yes, I noticed that I can take it from temp folder, but it is not user-friendly operation).
Last edited by MVV on 2012-03-03, 08:25 UTC, edited 1 time in total.
Biozynotiker
Member
Member
Posts: 164
Joined: 2011-03-22, 09:57 UTC
Location: Germany

Post by *Biozynotiker »

I can confirm that ESC immediately stops the process,
but I cannot confirm that TC leaves a corrupt Zip archive.

TC always create a temporary "<filename>.zi#" during adding files on my tests,
so that the original archive stays untouched until the adding process is finished.

BTW: The temporary file was created in my tests on the target drive, not in the temp folder as you described
(so the copy process is in this case is a renaming process and is a way faster and its harder to interrupt)

All Tests done on beta 22 x86/x64.
#92832
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Have you tested it on a USB stick?

In my tests ZIP repacking takes less than a second but then copying takes some seconds, so it is enough time to press Esc during copying.
Biozynotiker
Member
Member
Posts: 164
Joined: 2011-03-22, 09:57 UTC
Location: Germany

Post by *Biozynotiker »

I can now confirm the corruption on USB Stick.
I used a 64GB USB Stick before and this was maybe detected as HDD.
Now, with a 2GB stick, i can confirm it.

A confirmation dialog to abort the copy process should be added.
#92832
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Thanks, nice to hear that you've reproduced it.

In case of a regular copy I get following message on Escape:

Code: Select all

---------------------------
Total Commander
---------------------------
User abort!
---------------------------
OK   Cancel   
---------------------------
I can cancel aborting by clicking Cancel.

So, TC should show Cancel button in that dialog too. And maybe even a warning that archive will be corrupted (because it is not just a regular copy but repack process that modifies an existing archive).
User avatar
Flint
Power Member
Power Member
Posts: 3487
Joined: 2003-10-27, 09:25 UTC
Location: Antalya, Turkey
Contact:

Post by *Flint »

I confirm the problem, but I'm not sure what there is to do about it. I do agree that OK/Cancel dialog should be displayed instead of just OK, but in any case if you decide to abort a copy phase of the operation, the archive is already corrupted (being overwrited at the moment), so you can either remove the copied part of the file (as aborting of usual copy operation does) or keep the copied data. I'm not sure what's better. On the one hand, keeping some data is better than removing them completely. On the other hand, If TC keeps the part of the archive, the user might not notice that it changed and actually became corrupted.

Probably, in such situation TC should not only warn about corruption, but also tell the user where his/her original data are located (since this might happen to be the last available copy of some important data). I noticed that the temporary ZIP file is still present in the TEMP dir (under the CMD****.ZIP name), but very few users would guess this. Unfortunately, it would require a new translation, and it seems to be too late for it (line 1230 is close but doesn't quite fit the case).
Flint's Homepage: Full TC Russification Package, VirtualDisk, NTFS Links, NoClose Replacer, and other stuff!
 
Using TC 10.52 / Win10 x64
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

I cannot reproduce the problem, there is no Rename/Move step here. TC creates the temporary zip on the USB stick itself, then deletes the old zip and renames the new one. I get an out of memory error if there isn't the space for both the old and new zip.
Author of Total Commander
https://www.ghisler.com
User avatar
Flint
Power Member
Power Member
Posts: 3487
Joined: 2003-10-27, 09:25 UTC
Location: Antalya, Turkey
Contact:

Post by *Flint »

RemovableInTemp should be set to 1 to reproduce this problem.
Flint's Homepage: Full TC Russification Package, VirtualDisk, NTFS Links, NoClose Replacer, and other stuff!
 
Using TC 10.52 / Win10 x64
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

It is strange but I can reproduce it with default RemovableInTemp value. And even with clean INI. I have 8-GB Transcend USB flash.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

I see - so what do you suggest as a workaround? I can't prevent the data corruption when the user aborts the copying back of the temp file - the old zip has to be deleted to get the free space for the new...
Author of Total Commander
https://www.ghisler.com
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Christian, please add Cancel button to that dialog:) to allow to cancel aborting (that time it was accidental Escape pressing so Cancel button would be useful).
User avatar
Flint
Power Member
Power Member
Posts: 3487
Joined: 2003-10-27, 09:25 UTC
Location: Antalya, Turkey
Contact:

Post by *Flint »

MVV wrote:It is strange but I can reproduce it with default RemovableInTemp value. And even with clean INI. I have 8-GB Transcend USB flash.
Hm… If it's set to zero, the moving stage is too fast to catch it. At least, I cannot reproduce the problem with RemovableInTemp=0 (and, consequently, with this key missing, since its default value is 0).
Flint's Homepage: Full TC Russification Package, VirtualDisk, NTFS Links, NoClose Replacer, and other stuff!
 
Using TC 10.52 / Win10 x64
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Try larger archive. :)
User avatar
Flint
Power Member
Power Member
Posts: 3487
Joined: 2003-10-27, 09:25 UTC
Location: Antalya, Turkey
Contact:

Post by *Flint »

MVV wrote:Try larger archive.
Delete and rename operations depend very little on the file size. In addition, my flash stick is very fast and formatted as exFAT which also increases speed of file operations dramatically, so I cannot test it anyway. Maybe, on slow drives this delay would be noticable, but in any case I cannot see how an archive might become corrupted in this situation. You cannot stop TC operation in the middle of deleting or renaming, these both operations are controlled by OS, and from the TC's point of view they are atomic.
Flint's Homepage: Full TC Russification Package, VirtualDisk, NTFS Links, NoClose Replacer, and other stuff!
 
Using TC 10.52 / Win10 x64
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Flint, as I described above, I add a file into ZIP on a USB stick. TC creates modified archive in a temp folder and then copies it instead of original one. If you press Esc during that copying, archive will be left in damaged state.

I don't perform such operations frequently (in fact, I'm using 7Z and CAB archives usually) but TC should allow to continue process after false Escape if it shows some message.
Post Reply