File-Compare, Editmode: Backup destroys NTFS File-Hardlinks

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

Moderators: white, Hacker, petermad, Stefan2

StatusQuo
Power Member
Power Member
Posts: 1524
Joined: 2007-01-17, 21:36 UTC
Location: Germany

File-Compare, Editmode: Backup destroys NTFS File-Hardlinks

Post by *StatusQuo »

In the Edit-Mode of the File-Compare-Function there is a backup-function which creates file-backup of altered files. This renames the old/existing file to *.bak, then creates a new file with the original/old file name.
This may be safe and recommended by Micros*ft - but it destroys existing NTFS Hardlinks:
If file.ext previously was hardlinked to some other files and you use the Editmode in File-Compare, then the linked file gets renamed, so after the action "file.ext.bak" will be the linked file, while "file.ext" has no hardlinks anymore.

MS Offi*e behaves the same way - but that doesn't necessarily have to be a good example... ;-)

If that is "by design" and remain this way:
- Is there already a way to turn off the creation of backup files, which leaves the existing hardlinks functional? (if not: please add)
- Maybe the way of creating the backup files can (optionally) be turned around
(copy the altered file to "*.*.bak" and then change the contents in the original file)?
Who the hell is General Failure, and why is he reading my disk?
-- TC starter menu: Fast yet descriptive command access!
User avatar
Flint
Power Member
Power Member
Posts: 3487
Joined: 2003-10-27, 09:25 UTC
Location: Antalya, Turkey
Contact:

Post by *Flint »

Yes, it has already been reported before:
http://ghisler.ch/board/viewtopic.php?t=12628
Unfortunately, no reply from Chris... :(
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 don't see how I could preserve them. :(
Author of Total Commander
https://www.ghisler.com
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post by *petermad »

Is there already a way to turn off the creation of backup files,....? (if not: please add)
Support - I would pefer not to have the backup either - If I want a backup, I can make it myself before I compare the files.
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
sqa_wizard
Power Member
Power Member
Posts: 3854
Joined: 2003-02-06, 11:41 UTC
Location: Germany

Post by *sqa_wizard »

I don't see how I could preserve them.
To preserve the hardlink you have do on a save event:

1. copy FILENAME.EXT to FILENAME.BAK
2. save FILENAME.EXT by overwriting original.

This lets the hardlinked object still be the original and gives you the possibility to copy the backup over it in case of fallback needs :)
#5767 Personal license
User avatar
Flint
Power Member
Power Member
Posts: 3487
Joined: 2003-10-27, 09:25 UTC
Location: Antalya, Turkey
Contact:

Post by *Flint »

ghisler(Author)
And in addition to the two posts above, the methods suggested could be implemented as options.
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) »

1. copy FILENAME.EXT to FILENAME.BAK
2. save FILENAME.EXT by overwriting original.
Wow, how efficient. I know of no other program which does this!

One idea would be to just copy the alternate NTFS streams to the new file. Would this be OK too?
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 »

ghisler(Author) wrote:Wow, how efficient.
You can make this behaviour optional. For example, I personally never edit/save files > 1 MB in the Compare by Content window, but NTFS streams, NTFS hard links, read-only/hidden/etc attributes and so on, and so forth - all these features are quite important for me. So, I would prefer to wait additional 0,1-0,2 seconds when saving the file and keep all the attributes mentioned.

On the contrary, someone may like to edit all files (including huge ones) when comparing with other similar files, but he uses FAT32, does not use read-only/hidden attributes - he would prefer that TC saves backups more efficiently.

An option would be the best solution in this case. IMHO, of course.
ghisler(Author) wrote:One idea would be to just copy the alternate NTFS streams to the new file. Would this be OK too?
NTFS hard links (not junctions) will not be managed correctly in this case, unfortunately...
Flint's Homepage: Full TC Russification Package, VirtualDisk, NTFS Links, NoClose Replacer, and other stuff!
 
Using TC 10.52 / Win10 x64
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6450
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Post by *Horst.Epp »

ghisler(Author) wrote:
1. copy FILENAME.EXT to FILENAME.BAK
2. save FILENAME.EXT by overwriting original.
Wow, how efficient. I know of no other program which does this!
Any good editor like PSpad does it to preserve ACLs and Ownership of the original file. Its importand for editing on unix shares.
User avatar
sqa_wizard
Power Member
Power Member
Posts: 3854
Joined: 2003-02-06, 11:41 UTC
Location: Germany

Post by *sqa_wizard »

ghisler(Author) wrote:Wow, how efficient.
Maybe one step more, but the only way I know how to preserve hardlinks.
Horst.Epp wrote:Any good editor like PSpad does it to preserve ACLs and Ownership of the original file.
You may ask the author of PSPad (support at pspad dot com) for a hint about the used procedure ...
#5767 Personal license
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 will check whether it's possible. There is one big problem with files mapped into memory (used for large files), but I think that it should be solvable.
Author of Total Commander
https://www.ghisler.com
StatusQuo
Power Member
Power Member
Posts: 1524
Joined: 2007-01-17, 21:36 UTC
Location: Germany

Post by *StatusQuo »

Fixed in TC7 rc2, hardlinks keep existing/working after saving changes in Filecompare / Editmode.


:arrow: What about the wish of making this backup-file-creation optional?

Backups may be advisable in some cases, but I'd really like to turn that off for normal everyday-use. I already have enough backups of important files or can make them myself before editing...
A checkbox in the GUI would probably be more than needed, an option in wincmd.ini would be enough for me.

Will you implement this? Please... :roll:
Who the hell is General Failure, and why is he reading my disk?
-- TC starter menu: Fast yet descriptive command access!
User avatar
Hacker
Moderator
Moderator
Posts: 13052
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

CompareSaveOriginal=1
1: When saving, the file is copied to filename.bak, then the data is written to filename. Advantage: additional streams, special attributes etc. are preserved.
0: When saving, the data is written to filename.tmp, then the file is renamed to filename.bak, and finally filename.tmp is renamed to filename. Advantage: The file has to be written only once, and remains intact in case of a write error.
HTH
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
StatusQuo
Power Member
Power Member
Posts: 1524
Joined: 2007-01-17, 21:36 UTC
Location: Germany

Post by *StatusQuo »

2Hacker:
Thanks for the hint, but that's not what I meant. This seems to only switch the way the backup files are created.
I would like to not have any backup at all (using precious disk space and not having any advantages for me) - in most cases.
Who the hell is General Failure, and why is he reading my disk?
-- TC starter menu: Fast yet descriptive command access!
User avatar
Hacker
Moderator
Moderator
Posts: 13052
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

Ah, OK, I see. Post a Feature request then, please. Moving the thread to TC7 fixed bugs.

Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
Post Reply