[PATCH 3 of 4] tests: Solaris cmp complains about empty files, even with -s

danek.duvall at oracle.com danek.duvall at oracle.com
Wed Mar 2 18:22:22 EST 2016


# HG changeset patch
# User Danek Duvall <danek.duvall at oracle.com>
# 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)


More information about the Mercurial-devel mailing list