On 6/3/22 03:13, Piotr P. Stefaniak wrote:

2. How about a simpler option which basically says: warn only about
changes to any of the following: st_mtime, st_uid, st_gid, st_mode,
st_size. It's not clear that the extra complexity of a more-complicated
option is worth the aggravation.

This wouldn't be perfect for my use case; I want my shell script to
abort execution (set -e -o pipefail) iff tar observes a content change
in the file that is expected to never change.

Sorry, I'm not quite understanding.

First, if I understand things correctly, the patch you sent won't cause 'tar' to abort execution, only to issue a warning. Or are you saying you'll send tar's stderr to a pipe with no reader, so that the warning will cause 'tar' to exit? If so, that sounds less reliable than it could be.

Second, I know you're not suggesting the only perfectly-reliable way to know the content hasn't changed, which is to save a copy and compare the content to the saved copy. Instead, you're suggesting a heuristic A that involves looking only at the mtime and size. That differs the heuristic B that I suggested, in that B generates a warning if the file's uid, gid, or mode changes, whereas A does not. In your use case, why is it harmful for B to generate those extra warnings?

Reply via email to