[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-diffutils] bug#22816: bug#22816: cmp --verbose EOF message could be
[bug-diffutils] bug#22816: bug#22816: cmp --verbose EOF message could be more verbose
Thu, 4 May 2017 18:14:17 -0700
On Thu, May 4, 2017 at 5:24 PM, Paul Eggert <address@hidden> wrote:
> On 05/04/2017 10:28 AM, Jim Meyering wrote:
>> Making cmp perform that task does not seem worthwhile, because one
>> would have to choose between always counting newlines (like wc -l
>> does), and thus incurring this added cost all the time, or accepting a
>> partial (and racy) solution of rereading the regular file upon EOF.
> There's a third way, that satisfies Dan Jacobson's request in the usual
> case, without incurring added cost. Proposed patch attached, with a simple
> test for 'cmp' (which is a good thing to have in any event).
Oh! Glad you did that. I (now) see that cmp already did compute line numbers.
Thanks a lot for adding the tests, too.
My only question is whether to print zero-indexed line and byte
numbers. I think most people will interpret "after byte 5, line 1" as
the 5th byte on the first line, but with that patch, it means the 6th
byte on the second line.
I.e., what should this print?
cmp <(printf '1\nfoo') <(printf '1\nfoolery\n')