bug-tar
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Revisiting "file changed as we read it", with a proposed patch


From: Paul Eggert
Subject: Re: Revisiting "file changed as we read it", with a proposed patch
Date: Fri, 3 Jun 2022 14:19:09 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0

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

[Prev in Thread] Current Thread [Next in Thread]