Date: Tue, 16 May 2000 15:20:42 GMT From: mellon@pobox.com To: FreeBSD-gnats-submit@freebsd.org Subject: bin/18597: cmp(1) failure Message-ID: <200005161520.PAA06082@happy.checkpoint.com>
next in thread | raw e-mail | index | archive | help
>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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200005161520.PAA06082>