From owner-freebsd-bugs Fri Dec 13 18:50: 5 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 52BCC37B401 for ; Fri, 13 Dec 2002 18:50:02 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8C6A543EC2 for ; Fri, 13 Dec 2002 18:50:01 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id gBE2o1x3087402 for ; Fri, 13 Dec 2002 18:50:01 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id gBE2o1gT087401; Fri, 13 Dec 2002 18:50:01 -0800 (PST) Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5622137B401 for ; Fri, 13 Dec 2002 18:47:32 -0800 (PST) Received: from www.idlepower.net (h24-79-84-133.vc.shawcable.net [24.79.84.133]) by mx1.FreeBSD.org (Postfix) with SMTP id 589D043ED1 for ; Fri, 13 Dec 2002 18:47:31 -0800 (PST) (envelope-from cperciva@www.idlepower.net) Received: (qmail 53829 invoked by uid 0); 14 Dec 2002 02:47:18 -0000 Received: (for user cperciva) Message-Id: <20021214024717.53827.qmail@www.idlepower.net> Date: 14 Dec 2002 02:47:17 -0000 From: Colin Percival Reply-To: Colin Percival To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: bin/46249: [PATCH] /usr/bin/cmp -x ignored on special files Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 46249 >Category: bin >Synopsis: [PATCH] /usr/bin/cmp -x ignored on special files >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Dec 13 18:50:00 PST 2002 >Closed-Date: >Last-Modified: >Originator: Colin Percival >Release: FreeBSD 5.0-CURRENT >Organization: >Environment: System: All versions of FreeBSD since 4.1-RELEASE >Description: phk added the -x option in May 2000, but only for regular files; for special files it is treated like -l >How-To-Repeat: #echo "hello" | (echo "hbllo" | cmp -x /dev/fd/0 /dev/fd/3) 3<&0 2 142 145 #echo "hello" > temp1; echo "hbllo" > temp2; cmp -x temp2 temp1 00000001 62 65 #echo "hello" > temp1; echo "hbllo" > temp2; cmp -l temp2 temp1 2 142 145 >Fix: Add code to special.c to match the code in regular.c The following patches apply to -CURRENT and -STABLE respectively. --- HEAD.diff begins here --- Index: special.c =================================================================== RCS file: /usr/cvsroot/src/usr.bin/cmp/special.c,v retrieving revision 1.9 diff -u -r1.9 special.c --- special.c 28 Jul 2002 15:13:17 -0000 1.9 +++ special.c 14 Dec 2002 02:26:57 -0000 @@ -77,7 +77,11 @@ if (ch1 == EOF || ch2 == EOF) break; if (ch1 != ch2) { - if (lflag) { + if (xflag) { + dfound = 1; + (void)printf("%08llx %02x %02x\n", + (long long)byte - 1, ch1, ch2); + } else if (lflag) { dfound = 1; (void)printf("%6lld %3o %3o\n", (long long)byte, ch1, ch2); --- HEAD.diff ends here --- --- RELENG4.diff begins here --- Index: special.c =================================================================== RCS file: /usr/cvsroot/src/usr.bin/cmp/special.c,v retrieving revision 1.4.2.1 diff -u -r1.4.2.1 special.c --- special.c 21 Nov 2001 10:47:54 -0000 1.4.2.1 +++ special.c 14 Dec 2002 02:22:53 -0000 @@ -77,7 +77,10 @@ if (ch1 == EOF || ch2 == EOF) break; if (ch1 != ch2) { - if (lflag) { + if (xflag) { + dfound = 1; + (void)printf("%08qx %02x %02x\n", byte-1, ch1, ch2); + } else if (lflag) { dfound = 1; (void)printf("%6qd %3o %3o\n", byte, ch1, ch2); } else { --- RELENG4.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message