Ovewriting file from corrupted RAR-archive

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

Moderators: Hacker, petermad, Stefan2, white

bbutcher
Junior Member
Junior Member
Posts: 22
Joined: 2009-02-28, 18:48 UTC

Ovewriting file from corrupted RAR-archive

Post by *bbutcher »

1. Download Total Commander 7.50 beta 6.
2. Pack tcmd75b6.exe to tcmd75b6.rar (2 581 688 bytes).
3. Split tcmd75b6.rar with size of first piece = 2 Mb.
4. Rename tcmd75b6.001 to tcmd75b6.rar.

Now tcmd75b6.rar - is example of corrupted archive.


1. Enter in corrupted tcmd75b6.rar.
2. Try to overwrite existed tcmd75b6.exe on your computer by tcmd75b6.exe from corupted archive.
3. TC say: "Error in packed file tcmd75b6.rar [OK] [Cancel]"
4.1. If you pres "OK" - tcmd75b6.exe will deleted.
4.2. If you pres "Cancel" - tcmd75b6.exe will also deleted.
5. And now you lost your file tcmd75b6.exe.
User avatar
Samuel
Power Member
Power Member
Posts: 1930
Joined: 2003-08-29, 15:44 UTC
Location: Germany, Brandenburg an der Havel
Contact:

Post by *Samuel »

You may redownload it :)
User avatar
MVV
Power Member
Power Member
Posts: 8703
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Re: Ovewriting file from corrupted RAR-archive

Post by *MVV »

bbutcher wrote:5. And now you lost your file tcmd75b6.exe.
Of course, you lost your file. Because your archive doesn't contain information for unpacking this file. This stuff has place with ANY archive type. I don't see something strange in it.

When you choose OVERWRITE a file on your computer, ANY software will: 1. remove old file; 2. place new file. If operation 2 fails, NO ONE can undo operation 1 (only with recovery software).

Another question - why TC always deletes corrupted unpacked file. I understand, that this file can't be used because of corruption, but may be I want to do something with unpackable part of file.
User avatar
Boofo
Power Member
Power Member
Posts: 1431
Joined: 2003-02-11, 00:29 UTC
Location: Des Moines, IA (USA)
Contact:

Re: Ovewriting file from corrupted RAR-archive

Post by *Boofo »

MVV wrote:
bbutcher wrote:5. And now you lost your file tcmd75b6.exe.
Of course, you lost your file. Because your archive doesn't contain information for unpacking this file. This stuff has place with ANY archive type. I don't see something strange in it.
Exactly! Why would anyone attempt something like this, anyway?
chmod a+x /bin/laden -- Allows anyone the permission to execute /bin/laden

How do I un-overwrite all my data?

User of Total Commander
#60471 Single user license
bbutcher
Junior Member
Junior Member
Posts: 22
Joined: 2009-02-28, 18:48 UTC

Post by *bbutcher »

Samuel wrote:You may redownload it :)
If you mean TC750b6.exe, of course, I can redownload it :). But that file was only example.

Imagine such situation. You download archive of new version of any file, but archive with it is corrupted on server. You try to renew old version of your file on local computer by new version from archive, but you lost your file. And you cannot restore it, because you can only download corrupted archive from server.
Last edited by bbutcher on 2009-06-30, 07:31 UTC, edited 2 times in total.
bbutcher
Junior Member
Junior Member
Posts: 22
Joined: 2009-02-28, 18:48 UTC

Re: Ovewriting file from corrupted RAR-archive

Post by *bbutcher »

MVV wrote:Of course, you lost your file. Because your archive doesn't contain information for unpacking this file. This stuff has place with ANY archive type. I don't see something strange in it.
I don't want to delete file, I want to overwrite it by file from archive. Imho, in overwriting operations TC must check integrity of file in archive before deleting target file on local computer.
User avatar
fenix_productions
Power Member
Power Member
Posts: 1979
Joined: 2005-08-07, 13:23 UTC
Location: Poland
Contact:

Post by *fenix_productions »

2bbutcher
Your request is little problematic because described situation does not happen for archives only!

Try this:
1. copy big file from right panel to left one,
2. wait for finish,
3. copy it once again and agree to Overwrite,
4. while copying cancel whole process.

You'll see that even now file gets deleted. This also happens on move.

Your request means checking for every possible situation: not only for packing/unpacking or copying / moving! There are much more situations when it can happen. Please, do not forget any network (either FTP or even LAN) operations. Trying to prevent each one of them without loosing TC speed is impossible. TC can't protect you from all of them.

The only way to avoid such errors would be to copy / unpack files temporary somewhere and if everything seems to be OK, replace what you want but this solution would be slow as hell.

On the other hand, described behaviour does not differ from any other application: if you want to save a file and something bad happens during the process, you'll gain either corrupted file or nothing at all. This is not TC only bug but the way how it works in general.

The only part of this thread I can agree is to have the possibility to save unpacked files even if they are damaged (WinRAR can do that).
"When we created the poke, we thought it would be cool to have a feature without any specific purpose." Facebook...

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

Post by *MVV »

bbutcher wrote:I don't want to delete file, I want to overwrite it by file from archive. Imho, in overwriting operations TC must check integrity of file in archive before deleting target file on local computer.
Deleting is the first step of overwriting. If you wanna check integrity, you should do this (Alt+Shift+F9). Or you should use button 'More Options' in overwrite dialog and check there an option 'Auto-rename target files' - then your original file will be renamed instead of deleting.
fenix_productions wrote:The only way to avoid such errors would be to copy / unpack files temporary somewhere and if everything seems to be OK, replace what you want but this solution would be slow as hell.
It is slow not always - rename/move operation within logical disk is quick, so if we place new file on the disk where old file is placed (or in the same dir), remove old file and move new file, it won't be too slow.
User avatar
fenix_productions
Power Member
Power Member
Posts: 1979
Joined: 2005-08-07, 13:23 UTC
Location: Poland
Contact:

Post by *fenix_productions »

MVV wrote:It is slow not always - rename/move operation within logical disk is quick, so if we place new file on the disk where old file is placed (or in the same dir), remove old file and move new file, it won't be too slow.
So we've got one operation from many but this is still not unpacking as first post stated.

Even if we agree that files can be unpacked elsewhere and moved to desired location if everythig seems to be OK, we can't exclude deleting part. Files needs to be deleted before replacement and this is the step when something can broke. Even if I exaggerate, we still need twice as much space as with current way.
"When we created the poke, we thought it would be cool to have a feature without any specific purpose." Facebook...

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

Post by *MVV »

fenix_productions wrote:So we've got one operation from many but this is still not unpacking as first post stated.

Even if we agree that files can be unpacked elsewhere and moved to desired location if everythig seems to be OK, we can't exclude deleting part. Files needs to be deleted before replacement and this is the step when something can broke. Even if I exaggerate, we still need twice as much space as with current way.
Ok, let do rename of original file at first (instead of deleting), and unpacking or something else at second. :) But this needs only in rare cases. And TC can do it - this is the main point. :)
User avatar
fenix_productions
Power Member
Power Member
Posts: 1979
Joined: 2005-08-07, 13:23 UTC
Location: Poland
Contact:

Post by *fenix_productions »

2MVV
It seems like fixing the fixing ;)

So let's assume that I am against it due to lack of the free space of my HDD :)
"When we created the poke, we thought it would be cool to have a feature without any specific purpose." Facebook...

#128099
bbutcher
Junior Member
Junior Member
Posts: 22
Joined: 2009-02-28, 18:48 UTC

Post by *bbutcher »

I think Total Commander must protect target-files during overwriting operations (via checking integrity or making temporal backups).

Source-files can be damaged (corrupted archives, scratched CDs, bad-blocks on HDD etc.) and deleting of target-file during such interrapted-overwriting is very dangerous behaviour.
bbutcher
Junior Member
Junior Member
Posts: 22
Joined: 2009-02-28, 18:48 UTC

Re: Ovewriting file from corrupted RAR-archive

Post by *bbutcher »

MVV wrote:When you choose OVERWRITE a file on your computer, ANY software will: 1. remove old file; 2. place new file. If operation 2 fails, NO ONE can undo operation 1.
Why not 3 steps?
1. Copy source file to "filename.ext.tmp", or to TEMP-folder, or to RAM etc.
2. Delete target-file
3. Restore source file.

I consider, if user want erase files, he will delete its. But in case overwriting files, he wants to RENEW these files. Why he must risk one's files?
User avatar
MVV
Power Member
Power Member
Posts: 8703
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Re: Ovewriting file from corrupted RAR-archive

Post by *MVV »

bbutcher wrote: I consider, if user want erase files, he will delete its. But in case overwriting files, he wants to RENEW these files. Why he must risk one's files?
I repeat one of my previous posts in this topic:
MVV wrote:Or you should use button 'More Options' in overwrite dialog and check there an option 'Auto-rename target files' - then your original file will be renamed instead of deleting.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 49100
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

I will check whether Total Commander itself deletes the file, or the packer (WinRAR). In the first case, I will change it so the file isn't deleted. In the second case, I cannot do anything...
Author of Total Commander
https://www.ghisler.com
Post Reply