Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 09 Jan 2021 21:48:34 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 252542] cmp -s + regular files + skipping is broken
Message-ID:  <bug-252542-227-fP0T3oxR0L@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-252542-227@https.bugs.freebsd.org/bugzilla/>
References:  <bug-252542-227@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D252542

Ed Maste <emaste@freebsd.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|New                         |In Progress
           Assignee|bugs@FreeBSD.org            |emaste@freebsd.org

--- Comment #1 from Ed Maste <emaste@freebsd.org> ---
In the man page,
     -z      For regular files compare file sizes first, and fail the
             comparison if they are not equal.
so I think this is expected behaviour with -z; do you agree?

For -s this is certainly a bug; I'm considering this as a fix:


diff --git a/usr.bin/cmp/cmp.c b/usr.bin/cmp/cmp.c
index c762f1346abf..47f9b671985c 100644
--- a/usr.bin/cmp/cmp.c
+++ b/usr.bin/cmp/cmp.c
@@ -92,7 +92,6 @@ main(int argc, char *argv[])
                        break;
                case 's':               /* silent run */
                        sflag =3D true;
-                       zflag =3D true;
                        break;
                case 'x':               /* hex output */
                        lflag =3D true;
@@ -149,6 +148,9 @@ main(int argc, char *argv[])
        skip1 =3D argc > 2 ? strtol(argv[2], NULL, 0) : 0;
        skip2 =3D argc =3D=3D 4 ? strtol(argv[3], NULL, 0) : 0;

+       if (sflag && skip1 =3D=3D 0 && skip2 =3D=3D 0)
+               zflag =3D true;
+
        if (fd1 =3D=3D -1) {
                if (fd2 =3D=3D -1) {
                        c_link(file1, skip1, file2, skip2);

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-252542-227-fP0T3oxR0L>