On 28/10/15 06:40, Bernhard Voelker wrote:
> On 10/27/2015 06:21 PM, Pádraig Brady wrote:
>> On 26/10/15 07:11, Bernhard Voelker wrote:
>>> BTW: I was quite surprised to see that the other utilities -
>>> sha{224,256,384,512}sum - don't have a single negative test.
>>> I mean, there should be at least one case for each of these
>>> utilities to check whether an invalid checksum leads to an
>>> error message and an exit status != 0.
>>
>> Maybe, though it would only be testing the same logic
>> as they share the same source as sha1sum?
> 
> I know, but who knows if it will always be like that?  And what
> about exclusive code paths?  And finally, we're linking against
> other libraries like glibc and openssl which could introduce
> strange effects, or which do simply not work as expected on
> some funny platforms/builds.
> 
> I think a couple of tests would not harm:
> * verify pre-known checksum for empty input,
> * verify pre-known checksum for non-empty input,
> * verify that --check fails for badly formatted checksum line,
> * verify that --check works for a good checksum,
> * verify that --check fails for a bad checksum.
> 
> I'm a bit busy this week, so - unless someone else comes up with
> a patch - I'll try to propose a patch next week.

+1

It would be good to refactor at the same time equiv to:

for chk in md5 sha1 sha224 ...; do
  ${chk}sum ...
done

cheers,
Pádraig




Reply via email to