Subject: bug#19794: Feature Request - CMP

From: Pádraig Brady <[email-masked]>
Date: Fri, 06 Feb 2015 17:12:09 +0000

On 06/02/15 17:07, Eric Blake wrote:
> On 02/06/2015 09:45 AM, Eric Blake wrote:
>> On 02/06/2015 09:23 AM, Pádraig Brady wrote:
>>> On 06/02/15 15:57, Tyler Beaver wrote:
>>>> I know this tool is probably note used as much anymore, but perhaps it would be worth adding a flag for overriding the verbose output number system for the values, or at any rate specifying that this output is in octal, and not decimal or hexadecimal.
>>>
>>> Currently: offsets are decimal, differing bytes are octal:
>>>
>>>   $ cmp -l <(echo 12345678abc) <(echo 12345678bbb)
>>>                     9 141 142
>>>                    11 143 142
> 
> Another observation: Note that when mixed with --ignore-initial, we
> behave as if offsets start from the point where we skipped to, rather
> than the beginning of the file.  Since -i is not required by POSIX, does
> this always make the most sense?
> 
> $ cmp -l     <(printf bbc) <(printf abd)
>                   1 142 141
>                   3 143 144
> $ cmp -l -i1 <(printf bbc) <(printf abd)
>                   2 143 144
> 
> and what happens when we use the two-offset form?
> 
> $ cmp -l -i2:1 <(printf abcd) <(printf bce)
>                   2 144 145
> $ cmp -l -i1:2 <(printf bce) <(printf abcd)
>                   2 145 144
> 
> 
>> That said, it might be worth patching 'cmp --help' to make it obvious
>> that differing bytes are in octal values.
> 
> That is, instead of
> 
>   -l, --verbose              output byte numbers and differing byte values
> 
> maybe we could use:
> 
>   -l, --verbose              for each difference, output the decimal
>                              offset and the differing octal values
> 
> Expanding that to two lines can be offset by compressing elsewhere:
> 
>   -i, --ignore-initial=SKIP         skip first SKIP bytes of both inputs
>   -i, --ignore-initial=SKIP1:SKIP2  skip first SKIP1 bytes of FILE1 and
>                                       first SKIP2 bytes of FILE2
> 
> feels long; how about:
> 
>   -i, --ignore-initial=SKIP[:SKIP2]  bypass SKIP bytes of FILE1, and
>                                      SKIP2 (default SKIP) bytes of FILE2

Good suggestions,
which I've CC'd the the appropriate list ;)

cheers,
Pádraig.