X-Loop: help-debbugs@HIDDEN
Subject: bug#29311: Byte comparison from cmp diffutils
Resent-From: "s3gmentationfault@HIDDEN" <s3gmentationfault@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-diffutils@HIDDEN
Resent-Date: Wed, 15 Nov 2017 23:07:01 +0000
Resent-Message-ID: <handler.29311.B.151078720024709 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 29311
X-GNU-PR-Package: diffutils
X-GNU-PR-Keywords:
To: 29311 <at> debbugs.gnu.org
X-Debbugs-Original-To: bug-diffutils@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.151078720024709
(code B ref -1); Wed, 15 Nov 2017 23:07:01 +0000
Received: (at submit) by debbugs.gnu.org; 15 Nov 2017 23:06:40 +0000
Received: from localhost ([127.0.0.1]:42270 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1eF6lT-0006QS-Ek
for submit <at> debbugs.gnu.org; Wed, 15 Nov 2017 18:06:39 -0500
Received: from eggs.gnu.org ([208.118.235.92]:37331)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <s3gmentationfault@HIDDEN>) id 1eF6Q9-0005sQ-0g
for submit <at> debbugs.gnu.org; Wed, 15 Nov 2017 17:44:37 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
(envelope-from <s3gmentationfault@HIDDEN>) id 1eF6Q2-0003hn-NE
for submit <at> debbugs.gnu.org; Wed, 15 Nov 2017 17:44:31 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level:
X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_40,FREEMAIL_FROM,
T_DKIM_INVALID autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:44065)
by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
(Exim 4.71) (envelope-from <s3gmentationfault@HIDDEN>)
id 1eF6Q2-0003hJ-KC
for submit <at> debbugs.gnu.org; Wed, 15 Nov 2017 17:44:30 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:56525)
by lists.gnu.org with esmtp (Exim 4.71)
(envelope-from <s3gmentationfault@HIDDEN>) id 1eF6Q1-0005vC-5q
for bug-diffutils@HIDDEN; Wed, 15 Nov 2017 17:44:30 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
(envelope-from <s3gmentationfault@HIDDEN>) id 1eF6Py-0003cx-2J
for bug-diffutils@HIDDEN; Wed, 15 Nov 2017 17:44:29 -0500
Received: from mail-wm0-x231.google.com ([2a00:1450:400c:c09::231]:41671)
by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
(Exim 4.71) (envelope-from <s3gmentationfault@HIDDEN>)
id 1eF6Px-0003bU-QD
for bug-diffutils@HIDDEN; Wed, 15 Nov 2017 17:44:25 -0500
Received: by mail-wm0-x231.google.com with SMTP id b189so6019386wmd.0
for <bug-diffutils@HIDDEN>; Wed, 15 Nov 2017 14:44:25 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
h=to:from:subject:message-id:date:user-agent:mime-version
:content-transfer-encoding:content-language;
bh=oRI31yaPHBDFD/3z0IKRC4FUm6htLnYntfvYB8CSrn4=;
b=NXCP63hOtTKp3e+mzAJaV1dd5yfVLZPjy3jzZAef0B3javomlX/OrEz4B5NB7XWChh
/Xi7xphwe5OOVLkALrJKq6kn6AsREv8NxwhhT+BhoTpUIbP+BUPEboxvw+AGmT8a+Ihg
bflJ5qnY9BTqreLhHR3BP8ykzmy0845aZl240yGhQISkjsezwUXB6CtyU77jAfSHuc0A
VvXe1cnMWEQtxg5UI7ZxD7G5eOTKaNWuagfj7/awAGXZMeknPJb7pfRDyXnSJaKpKUq3
uElpn3tx3n93KvtMNO7ibbX858+YTb0a6krRND8pkSsGOgC/ctl/v8E/MJPbXawyBCZK
X2Sg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:to:from:subject:message-id:date:user-agent
:mime-version:content-transfer-encoding:content-language;
bh=oRI31yaPHBDFD/3z0IKRC4FUm6htLnYntfvYB8CSrn4=;
b=tgQLOEccVWZxvl06Q9BNcrcDTvfg4MMhwVRROz5qF/t3eSkXgjtKprYYqTipR8Pq56
vXKShybmdUCdQWK0b5SYHGA3gMugWR+Xi3hEfovshD+QKyM1EJLHxZ2nlVcdVec3YkEE
+FmEBFKMZJfjEjtzn7WpfNVQvGC61YWjrZ9PGwQyeWuYfxgjSGgacvqxzbvE/8CWo5j8
yH/z8DMOWLp/ElT3ijnBNVPbBztmRmvyMDwFSO+V/Xvvf7ltGseDguJQmb4N5sdkEtVE
301yT/BVSgnigjK9IBb4af7eR57Fhh3Tbg52NKBCgryoRMH/4x39S9l1/reFpIMfRRvt
6BWA==
X-Gm-Message-State: AJaThX6e+fCKNDArRVR6VeAPlQfEa0ajBXQLaeDxzFS/59RZeOT5scM7
/ceEHpXdqtLeGPBWnYRc389/wQZx
X-Google-Smtp-Source: AGs4zMYlXRK+8EboQ20VQS48dCCxBemYt76aH8moca0xtxgGgcXBqRiEVyZ82kYxNbOVzNYIaSUXLg==
X-Received: by 10.28.151.14 with SMTP id z14mr18680wmd.5.1510785863733;
Wed, 15 Nov 2017 14:44:23 -0800 (PST)
Received: from [192.168.1.14] ([151.41.10.36])
by smtp.gmail.com with ESMTPSA id p23sm41204586wrb.76.2017.11.15.14.44.22
for <bug-diffutils@HIDDEN>
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Wed, 15 Nov 2017 14:44:23 -0800 (PST)
From: "s3gmentationfault@HIDDEN" <s3gmentationfault@HIDDEN>
Message-ID: <dea15b8c-ab12-becd-88b5-3c8d20d1d36b@HIDDEN>
Date: Wed, 15 Nov 2017 23:44:29 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
Thunderbird/52.4.0
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-15; format=flowed
Content-Transfer-Encoding: 8bit
Content-Language: en-US
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
recognized.
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-Mailman-Approved-At: Wed, 15 Nov 2017 18:06:36 -0500
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.0 (----)
Hi, i write this message because cmp command from diffutils give an
unexpected result if is used on binary files:
if we try to compare two different files (not symlink, not hardlink
etc..), cmp say that the differ from 42 byte.
~ > LC_ALL=C cmp /usr/bin/g++ /usr/bin/gcc
/usr/bin/g++ /usr/bin/gcc differ: char 42, line 1
During a discussion another member convinced me to try hexdump for do
that comparison than i have see that those file differ for many bytes
then 42, so i have try to write a program for do that, just for sure
(the program is silly i have also forget to return EXIT_SUCCESS, and as
default if it find a different byte the consider all other byte
different but is only for this demonstration)
src: https://arin.ga/swsNn1
~ > CFLAGS=-O3 make diffbyte_gcc && ./diffbyte_gcc
they diff by: 766087 byte
so something absolutely does not work:
some clarifications: I have see just now that using C as language it say
char, but in my language it say "byte" ("/bin/g++ /bin/gcc differenza:
byte 42, riga 1").
However that is indifferent since in manpage it use only "byte" term, so
i expect that it compare bytes, not only ascii text; The manpages at
description say: "Compare two files byte by byte".
For do other example, the wc command with -c option really counts the bytes:
~ > printf "\u2592"|wc -c
3
~ > printf "ciao\0x8" | wc -c
7
and (except for the sparse files) also du and wc report the same result
with binary files:
~ > du -b /bin/gcc
993584 /bin/gcc
~ > wc -c /bin/gcc
993584 /bin/gcc
From info i read:
The 'cmp' command compares two files, and if they differ, tells the
first byte and line number where they differ or reports that one file is
a prefix of the other.
Bytes and lines are numbered starting with 1. The arguments of 'cmp' are
as follows:
I do not know if it is meant that the comparison stops at the first line
or rather when one of the two buffers differs from the other but
manpages and program options say that it compare byte
so it should do
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: "s3gmentationfault@HIDDEN" <s3gmentationfault@HIDDEN> Subject: bug#29311: Acknowledgement (Byte comparison from cmp diffutils) Message-ID: <handler.29311.B.151078720024709.ack <at> debbugs.gnu.org> References: <dea15b8c-ab12-becd-88b5-3c8d20d1d36b@HIDDEN> X-Gnu-PR-Message: ack 29311 X-Gnu-PR-Package: diffutils Reply-To: 29311 <at> debbugs.gnu.org Date: Wed, 15 Nov 2017 23:07:02 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): bug-diffutils@HIDDEN If you wish to submit further information on this problem, please send it to 29311 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 29311: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D29311 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
X-Loop: help-debbugs@HIDDEN
Subject: bug#29311: Byte comparison from cmp diffutils
References: <dea15b8c-ab12-becd-88b5-3c8d20d1d36b@HIDDEN>
In-Reply-To: <dea15b8c-ab12-becd-88b5-3c8d20d1d36b@HIDDEN>
Resent-From: "s3gmentationfault@HIDDEN" <s3gmentationfault@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-diffutils@HIDDEN
Resent-Date: Thu, 16 Nov 2017 00:15:02 +0000
Resent-Message-ID: <handler.29311.B29311.15107912545653 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 29311
X-GNU-PR-Package: diffutils
X-GNU-PR-Keywords:
To: 29311 <at> debbugs.gnu.org
Received: via spool by 29311-submit <at> debbugs.gnu.org id=B29311.15107912545653
(code B ref 29311); Thu, 16 Nov 2017 00:15:02 +0000
Received: (at 29311) by debbugs.gnu.org; 16 Nov 2017 00:14:14 +0000
Received: from localhost ([127.0.0.1]:42317 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1eF7or-0001T7-Vk
for submit <at> debbugs.gnu.org; Wed, 15 Nov 2017 19:14:14 -0500
Received: from mail-wm0-f68.google.com ([74.125.82.68]:42898)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <s3gmentationfault@HIDDEN>) id 1eF73B-0006qK-1h
for 29311 <at> debbugs.gnu.org; Wed, 15 Nov 2017 18:24:57 -0500
Received: by mail-wm0-f68.google.com with SMTP id t139so6182900wmt.1
for <29311 <at> debbugs.gnu.org>; Wed, 15 Nov 2017 15:24:56 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
h=to:from:subject:message-id:date:user-agent:mime-version
:content-transfer-encoding:content-language;
bh=99pA5y6lcqWWHf3Eodxp2Rm7c/WUHnljnngh4ekhBFg=;
b=RTZGIrqakwTRJu5J+P+U2/aH8uiW+wfmmJoKY3fi4gOJZiFTK8sH8A4vefQLfqKYcX
CkziFP6RRrCtLX1l2iV76qccxTtnbLN4TEbcXDAImnr9yXmR0WGanECqaubjzw4Vzy+K
Ns70EgmH7Mz24Yoq3tLWKjBDiGAdPvJe8KrOYj2RJ+93o1YDYJ6+jdOXWfzoJcy/uRXQ
OyfgQrI4FHfRG5I1tqYhWdbp0GBsunD/UsTIt7rHXVmWGaJYexOq0KGgHNnbFwj4k0xK
3piqXldKWzGrVwR7Zk4q68SSLUUGj5g2lq3w3Sy405DcTw7x9OzXWfPS9OnBkZVYtIPl
c7Vw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:to:from:subject:message-id:date:user-agent
:mime-version:content-transfer-encoding:content-language;
bh=99pA5y6lcqWWHf3Eodxp2Rm7c/WUHnljnngh4ekhBFg=;
b=IJB55Dbw0NB1hq7u2bdJepSI2f/MvIZRXnJwrPsu6nBt2Lqr4IhSsKldRlrB3Fs1Nt
/2kRZa2QEtHAQ2VMlTHm0rzo99LRxRbKCLg1UUsWcjtVqEh/AEcur/aFeWM4UCHl1CPg
M3KDTEIJ0gIvOsX7NzGXY824IEg6hzDyks9+IbyvJvnXNKRY/p0JzaGgyp4Jb0XdsWDB
1sUVue1RUda/FdmGvpljt9rMvh872cwD0SNBMnUd5uaYjX1qSoPRwAJDonj7Lyjq+YO4
oRznem/wRSs6TnTD2OID0N0I1KSpKcTE3FlyWX7Pol09tIfbGoFErdAdvNam9fO1RZ6d
+3Vg==
X-Gm-Message-State: AJaThX5QY6Xp07lgmhkgr4E9lBXYJkqI1i3fJeNsbG+xEq6tM1FKtet8
mnf621KNeXYkPcZyYxZO/Ex33lYA
X-Google-Smtp-Source: AGs4zMa7RS6Ahtpl7Sao/Q93CyfTPe1Iau279RRSLgMiHJozz7y6cX/N6nIqZsVzBWfIlS8ikfWDjw==
X-Received: by 10.80.244.16 with SMTP id r16mr95537edm.26.1510788290839;
Wed, 15 Nov 2017 15:24:50 -0800 (PST)
Received: from [192.168.1.14] ([151.41.10.36])
by smtp.gmail.com with ESMTPSA id j8sm32177edh.55.2017.11.15.15.24.49
for <29311 <at> debbugs.gnu.org>
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Wed, 15 Nov 2017 15:24:50 -0800 (PST)
From: "s3gmentationfault@HIDDEN" <s3gmentationfault@HIDDEN>
Message-ID: <ab0d7896-b73c-e2d9-9675-2b38794e5615@HIDDEN>
Date: Thu, 16 Nov 2017 00:24:57 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
Thunderbird/52.4.0
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-15; format=flowed
Content-Transfer-Encoding: 8bit
Content-Language: en-US
X-Spam-Score: -0.0 (/)
X-Mailman-Approved-At: Wed, 15 Nov 2017 19:14:12 -0500
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)
Hi, i write this message regarding to my previous bug report, i have see
just now that posix section of manpages say:
"The cmp utility shall write no output files are the same. Under default
options, if they differ, it shall write tostandard output the byte and
line number at which the first difference occurred. Bytes and lines
shall be numbered beginning with 1."
so now it's all clare.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.