Fixed: Backup files have modified timestamps

Bug reports concerning HxD.
Post Reply
User avatar
prino
Posts: 14
Joined: 19 Sep 2008 13:43

Fixed: Backup files have modified timestamps

Post by prino »

Just found this program, if only commercial software was of the same quality.

That said, I do do have an issue with it...

When I select the option to create a backup file, I would expect this to be created by a rename of the original file on disk, but HxD actually performs a copy. In itself this would be OK, but only if it would apply the timestamps of the old file to the newly created .BAK file. Sadly this is not the case, which means that the date of the original file is lost. :(

Can you please change this?

Thanks,

Robert
Maël
Site Admin
Posts: 1455
Joined: 12 Mar 2005 14:15

Re: Backup files have modified timestamps

Post by Maël »

Sure. I'll look into this. Thanks for reporting.
Maël
Site Admin
Posts: 1455
Joined: 12 Mar 2005 14:15

Re: Backup files have modified timestamps

Post by Maël »

I'm currently implementing this and wonder about a detail:

Should all the file times be transfered from the original file to the BAK-file, i.e.: last access time, last write/modification time and creation time?

If you copy a file manually creation time will reflect the time at which the backup file was created and not the original file.
But when you rename the BAK-file you might want it to be as close to the original as possible, so it might be good to have the creation time of the oirginal file as the creation time of the BAK-file.

What are your thoughts on this?
User avatar
prino
Posts: 14
Joined: 19 Sep 2008 13:43

Re: Backup files have modified timestamps

Post by prino »

The easiest way would be to just rename the original file. It would preserve all the original timestamps and a subsequent deletion of the modified file followed by a rename of the .BAK file to the original name would completely restore the original situation.

Also, by using a new creation time, you will create files that are modified before they were created :? , which might lead to problems with other software...

My eur 0.02
Maël
Site Admin
Posts: 1455
Joined: 12 Mar 2005 14:15

Re: Backup files have modified timestamps

Post by Maël »

There are several technical reasons why I can't rename the file. But I'm copying it such that all the meta-data is kept (alternate data streams, security settings, ...) and set the file timestamps of the backup file to the timestamps of the original file.

EDIT: the behavior described above is for the upcoming bug-fix, not the current release.
User avatar
prino
Posts: 14
Joined: 19 Sep 2008 13:43

Re: Backup files have modified timestamps

Post by prino »

Maël wrote:There are several technical reasons why I can't rename the file. But I'm copying it such that all the meta-data is kept (alternate data streams, security settings, ...) and set the file timestamps of the backup file to the timestamps of the original file.
As someone who is not at all in the know about Windows internals, I'm very puzzled by the above, can you please elaborate, I did try Google but couldn't find anything relevant.

Robert
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
https://prino.neocities.org/zOS/zOS-Tools.html - Some programming here :mrgreen:
Maël
Site Admin
Posts: 1455
Joined: 12 Mar 2005 14:15

Re: Backup files have modified timestamps

Post by Maël »

prino wrote:
Maël wrote:There are several technical reasons why I can't rename the file. But I'm copying it such that all the meta-data is kept (alternate data streams, security settings, ...) and set the file timestamps of the backup file to the timestamps of the original file.
As someone who is not at all in the know about Windows internals, I'm very puzzled by the above, can you please elaborate, I did try Google but couldn't find anything relevant.
As soon as you modify a file in HxD, it is locked, such that no other program can change it. This allows to only keep a kind of diff of the file, and therefore handle arbitrarily large files.
Because the file is locked it cannot be renamed; only changed. Since it is HxD that holds the lock it can write to it, but no other program. Still renaming isn't possible when any app (including the one that owns the lock and tries to rename the file) has locked the file.

To copy all the relevant information (and meta-data) I use the CopyFileEx-API and then set the timestamps.
Maël
Site Admin
Posts: 1455
Joined: 12 Mar 2005 14:15

Re: Backup files have modified timestamps

Post by Maël »

Fixed in latest version, see download page.
Post Reply