Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Jan 2021 17:04:20 +0000
From:      Jamie Landeg-Jones <jamie@catflap.org>
To:        freebsd-current@freebsd.org
Subject:   /usr/bin/diff - incorrectly says files are identical
Message-ID:  <202101121704.10CH4K91042526@donotpassgo.dyslexicfish.net>

next in thread | raw e-mail | index | archive | help
When diff hits certain access errors, function diffreg() shows the error message, and then returns to the calling function, which calls print_status() with the return value.

However, in these cases, the return value isn't changed from the initial default value of D_SAME.

Normally, print_status() with a value of D_SAME does nothing, so this works out ok, however, if the "-s" flag is set, a message is displayed showing identicality:

case D_SAME:
                if (sflag)
                        printf("Files %s%s and %s%s are identical\n",                                                                                                       path1, entry, path2, entry);
                break;

This then produces such results as:

% diff  -s /COPYRIGHT /var/run/rpcbind.sock
diff: /var/run/rpcbind.sock: Operation not supported
Files /COPYRIGHT and /var/run/rpcbind.sock are identical

% diff  -s /COPYRIGHT /etc/master.passwd
diff: /etc/master.passwd: Permission denied
Files /COPYRIGHT and /etc/master.passwd are identical

Further details, and fixing patch here: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=252614

Cheers, Jamie



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202101121704.10CH4K91042526>