Open chadnetzer opened 6 years ago
When playing with the patches that make the user specify '-T' and '-P' to enable linking only if time and owner/permissions match, the default behavior now seems too surprising to be a safe default, IMO. It essentially makes the old "content-only" option default to True. As discussed in PR #3, this means that from a user's perspective, files can end up changing both ownership and permissions after running the hardlinkpy program.
A hypothetical surprise default behavior would be copying another user's file, adding eXecute permissions to it, and then having the hardlinkpy program change permissions on the original file so that it now has the execute bits set. This seems too dangerous and unexpected to be the default setting.
I think for this reason, that --content-only should remain as the non-default option. It should require the user to opt-in to using this behavior. It might even be prudent to warn users when linking files that are not owned by the same user (and warn in the help message that this is possible). In the extreme, we could disallow this behavior for non-root users, or at least allow finer grained control (ie. ignore permissions but not ownership differences, etc.)
Allowing timestamps to be ignored by default seems more innocuous. However I wonder if it's worth the change in argument compatibility, especially given the above caution about permissions. Maybe leaving the default conservative options as-is, is for the best.
I concur on safe conservative default options.
Change options to be more consistent with the filenames-equal option, preferring to hardlink files with identical content, unless the user chooses to also require matching modification time or ownership/mode properties.
This issue is taken from @wolfospealain PR #3, with the intent of breaking it's changes into more manageable chunks.