unpacking from damaged archives does delete existing file

The behaviour described in the bug report is either by design, or would be far too complex/time-consuming to be changed

Moderators: white, Hacker, petermad, Stefan2

Post Reply
TW
Senior Member
Senior Member
Posts: 383
Joined: 2005-01-19, 13:35 UTC

unpacking from damaged archives does delete existing file

Post by *TW »

steps:

- download http://www.voidtools.com/Everything-1.4.1.793b.x86.zip
- unpack it to dir "test"
- download http://vicebuilds6.bplaced.net/rebuilt.Everything-1.4.1.788b.x86.zip
- unpack Everything.lng from second (damaged) archive to dir "test"

TC now wants to overwrite the file, but fails because the archive is broken. but the target file in "test" gets deleted.
licenced and happy TC user since 1994 (#11xx)
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post by *petermad »

Confirmed ! :roll: The target file gets deleted if I chose "Cancel" and it gets partly written if I chose "OK"
Last edited by petermad on 2016-11-05, 18:53 UTC, edited 2 times in total.
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6449
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Post by *Horst.Epp »

For me this is logical from a programmers view.
Why should TC fully read a source archive
before starting to write into the target ?
And how should it recover from the error ?
Windows 11 Home x64 Version 23H2 (OS Build 22631.3374)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.69
QAP 11.6.3.2 x64
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post by *petermad »

2Horst.Epp
Why should TC fully read a source archive
before starting to write into the target ?
I guess you are right, otherwise TC should always write to a temp file first and then replace the target, and that would be very time consuming - but it is not fun loosing data like that!
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

It is not only TC, but most archivers remove such partially extracted files. And of course before starting extraction existing file gets deleted (overwrite is delete and then put new one).
User avatar
Dalai
Power Member
Power Member
Posts: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Post by *Dalai »

It's only data loss if TC wouldn't ask whether to overwrite existing files. But TC does so, doesn't it? I admit that TC9 behaves differently than TC8 by deleting the partially extracted files.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
TW
Senior Member
Senior Member
Posts: 383
Joined: 2005-01-19, 13:35 UTC

Post by *TW »

well, winrar asks as well before overwriting, and still there is no data loss. winrar complains about CRC error and then halts.

also it is new to me that when overwriting a file the old one gets deleted before copying/moving the new file.

i agree, this is a rare case and it doesn't me worry personally. i just posted it because this really happened to me with above files, but it was not a real loss of course.
licenced and happy TC user since 1994 (#11xx)
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post by *petermad »

It's only data loss if TC wouldn't ask whether to overwrite existing files. But TC does so, doesn't it? I admit that TC9 behaves differently than TC8 by deleting the partially extracted files.
TC first to ask to overwrite the file, simply just because it exists, Then it comes up with this:
---------------------------
rebuilt.Everything-1.4.1.788b.x86.zip
---------------------------
Disk read error!
---------------------------
OK Annuller
---------------------------
If I press OK, TC deletes the existing file and writes the part of the file from the archive that is can read (in this case about half of the file).

If I press Annuller (Cancel), TC simply just deletes the existing file.

This behaviour is the same in TC9.0rc4 and TC8.52a.
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
Dalai
Power Member
Power Member
Posts: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Post by *Dalai »

I still don't see any data loss. TC deletes the existing files only after confirming the overwrite dialog, so you already told TC to overwrite existing files (saying that you're OK with losing the existing files). If the unpacking would have been successful, the files would have been replaced, right? In either case (unpack operation successful or not), the existing files are gone, either deleted or overwritten by the unpack operation.

But you're right that TC9 behaves the same as TC8; I was misled by my tests. Still, TC9 deletes the existing files as soon as you tell it to overwrite it, regardless of how you dismiss the (Disk read) error dialog afterwards - and TC8 did/does exactly the same, as well as WinRAR.

I don't know where you'd lose any data :?. Maybe someone can enlighten me.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

The same happens when you copy a file from a network share, overwriting a local file, and the network goes down. There isn't really much I can do - I could make a backup of the local file first, or download/copy to a different name, but these all have their downsides too:
1. A backup takes extra space which may not be there on e.g. a USB stick, or take a long time for e.g. a big movie.
2. Downloading to a different name would lose externded rights and/or extra streams of the local file.
Author of Total Commander
https://www.ghisler.com
bwh
Junior Member
Junior Member
Posts: 12
Joined: 2006-05-30, 08:27 UTC

Post by *bwh »

This seems similar to something that was fixed for rar back in the day unless I'm misunderstanding (http://ghisler.ch/board/viewtopic.php?t=24544)
mifritscher
Junior Member
Junior Member
Posts: 5
Joined: 2015-10-14, 08:26 UTC

Post by *mifritscher »

In some situations, a temp file can't be created (because of space constraints). An idea would be to have a option "test read the source before actual copying" or having a test read function in general.
Post Reply