GNU bug report logs - #32249
[BUGFIX] cmp -b mangles result

Previous Next

Package: diffutils;

Reported by: mancha <mancha1 <at> zoho.com>

Date: Mon, 23 Jul 2018 15:42:02 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: mancha <mancha1 <at> zoho.com>
To: bug-diffutils <at> gnu.org
Subject: [BUGFIX] cmp -b mangles result
Date: Mon, 23 Jul 2018 06:48:26 +0000
[Message part 1 (text/plain, inline)]
Hi. count_newlines is passed the wrong buffer length (off-by-one) so it
overwrites first differing byte in first file's buffer. Attached patch
fixes.

Actual:

$ cmp -b <(echo bad) <(echo bug)
[snip] differ: byte 2, line 1 is  12 ^J 165 u


Expected:

$ cmp -b <(echo bad) <(echo bug)
[snip] differ: byte 2, line 1 is 141 a 165 u

Cheers!

--mancha
[cmp-newlines.patch (text/plain, attachment)]
[Message part 3 (application/pgp-signature, inline)]

This bug report was last modified 6 years and 360 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.