From owner-freebsd-bugs Tue May 16 5:20:16 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 1BDE137B96C for ; Tue, 16 May 2000 05:20:06 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id FAA12516; Tue, 16 May 2000 05:20:05 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from happy.checkpoint.com (happy.checkpoint.com [199.203.156.41]) by hub.freebsd.org (Postfix) with ESMTP id 678D137B77B for ; Tue, 16 May 2000 05:19:51 -0700 (PDT) (envelope-from mellon@happy.checkpoint.com) Received: (from mellon@localhost) by happy.checkpoint.com (8.9.3/8.9.3) id PAA06082; Tue, 16 May 2000 15:20:42 GMT (envelope-from mellon) Message-Id: <200005161520.PAA06082@happy.checkpoint.com> Date: Tue, 16 May 2000 15:20:42 GMT From: mellon@pobox.com Reply-To: mellon@pobox.com To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: bin/18597: cmp(1) failure Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 18597 >Category: bin >Synopsis: cmp(1) failure >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue May 16 05:20:05 PDT 2000 >Closed-Date: >Last-Modified: >Originator: Anatoly Vorobey >Release: FreeBSD 5.0-CURRENT i386 >Organization: >Environment: 5.0-CURRENT >Description: cmp -s will produce incorrect results when skips are given. This one appears to have been with us since ancient times. >How-To-Repeat: bash-2.03$ cat >f1 abc bash-2.03$ cat >f2 bc bash-2.03$ cmp f1 f2 1 0 bash-2.03$ echo $? 0 bash-2.03$ cmp -s f1 f2 1 0 bash-2.03$ echo $? 1 >Fix: Note that eofmsg() checks sflag, so moving the test is okay. I have verified that cmp(1) on Solaris behaves identically in the test above. Note 1 -> DIFF_EXIT . Index: regular.c =================================================================== RCS file: /freebsd/cvs/src/usr.bin/cmp/regular.c,v retrieving revision 1.9 diff -u -r1.9 regular.c --- regular.c 2000/05/15 08:43:25 1.9 +++ regular.c 2000/05/16 15:12:42 @@ -65,15 +65,15 @@ off_t pagemask, off1, off2; size_t pagesize; - if (sflag && len1 != len2) - exit(1); - if (skip1 > len1) eofmsg(file1); len1 -= skip1; if (skip2 > len2) eofmsg(file2); len2 -= skip2; + + if(sflag && len1 != len2) + exit(DIFF_EXIT); pagesize = getpagesize(); pagemask = (off_t)pagesize - 1; >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message