[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: patch: touch --verbose
From: |
Bernhard Voelker |
Subject: |
Re: patch: touch --verbose |
Date: |
Sun, 11 Apr 2021 23:33:18 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 |
On 4/9/21 10:56 PM, Michael Cook wrote:
> The counter-argument could be that the other tools cp, mv, rm, ln, chmod,
> chgrp, ... have the -v option, and so it's an anomaly that touch does not.
> And we should strive to avoid anomalies as best we can?
Statistics: 17 tools of the GNU coreutils have the --verbose option,
while >90 of them do not. Admittedly, that category includes informational
tools like ls(1) for which that option does not make sense.
Still, that's a number.
>> Also xargs --verbose or (set -x; touch *) are sufficient
>
> Those solutions show what we'd *like* to happen, what we're going to try to
> make happen, but they're much more optimistic than the proposed patch at
> indicating what actually happened.
A program should not have a changed processing just because --verbose it set,
period. IIRC there's even a GNU coding style rule for this.
Anyway, I'm wondering why it's so important for the caller to know whether the
file has been created or only the timestamps have been adjusted.
Maybe just saying "touched 'file'" regardless of further details would be
sufficient? But then I'd still slightly prefer 'echo touch ...' or
'set -x && touch ...' over adding code.
Have a nice day,
Berny