From patchwork Wed Mar 2 23:22:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [3, of, 4] tests: Solaris cmp complains about empty files, even with -s From: Danek Duvall X-Patchwork-Id: 13577 Message-Id: <4a15c707703d3adaadb5.1456960942@smelly.us.oracle.com> To: mercurial-devel@mercurial-scm.org Date: Wed, 02 Mar 2016 15:22:22 -0800 # HG changeset patch # User Danek Duvall # Date 1456959509 28800 # Wed Mar 02 14:58:29 2016 -0800 # Node ID 4a15c707703d3adaadb595c96dc07638e6a746e8 # Parent 06f40ce66d200ab9869e2d70bfa127582c6ea26d tests: Solaris cmp complains about empty files, even with -s When you compare an empty file, such as /dev/null, with a non-empty file, Solaris cmp complains on stderr with "cmp: EOF on /dev/null", even if the -s argument is present. GNU cmp makes the complaint, but silences it with -s. We can change the pdiff utility to simply redirect stderr to /dev/null so that we don't have to worry about this difference in the test files. diff --git a/tests/pdiff b/tests/pdiff --- a/tests/pdiff +++ b/tests/pdiff @@ -25,7 +25,7 @@ filediff(){ file2=/dev/null fi - if cmp -s "$file1" "$file2"; then + if cmp -s "$file1" "$file2" 2> /dev/null; then # Return immediately, because comparison isn't needed. This # also avoids redundant message of diff like "No differences # encountered" (on Solaris)