bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnulib-tool: avoid unintended error output


From: Bruno Haible
Subject: gnulib-tool: avoid unintended error output
Date: Sat, 24 Mar 2012 16:42:32 +0100
User-agent: KMail/4.7.4 (Linux/3.1.0-1.2-desktop; KDE/4.7.4; x86_64; ; )

Hi,

Running gnulib-tool in the libunistring package, I see these messages:

  Updating file lib/uniwidth/cjk.h (backup in lib/uniwidth/cjk.h~)
  Updating file lib/wcwidth.c (backup in lib/wcwidth.c~)
  cmp: EOF on ./tests/macros.h
  Updating file tests/macros.h (backup in tests/macros.h~)
  Updating file tests/test-frexp.c (backup in tests/test-frexp.c~)
  Updating file tests/test-frexpl.c (backup in tests/test-frexpl.c~)
  Updating file tests/test-math.c (backup in tests/test-math.c~)
  Updating lib/Makefile.gnulib (backup in lib/Makefile.gnulib~)
  Updating gnulib-m4/gnulib-comp.m4 (backup in gnulib-m4/gnulib-comp.m4~)
  Updating tests/Makefile.gnulib (backup in tests/Makefile.gnulib~)
  Updating ./tests/.gitignore (backup in ./tests/.gitignore~)

The "cmp: EOF on ./tests/macros.h" message is unintended. It is caused by
the fact that
  1) New code was added at the end of tests/macros.h recently,
  2) cmp normally produces only output to stdout. But when one file is
     shorter than the other file but the common parts are identical, then
     cmp produces an "EOF on ..." message to stderr.

Obviously we don't want to redirect stderr to /dev/null if we can avoid it.
This patch should therefore fix the spurious output.


2012-03-24  Bruno Haible  <address@hidden>

        gnulib-tool: Avoid unintended error output from 'cmp'.
        * gnulib-tool (func_add_file, func_update_file, func_import): Use
        "cmp -s", not "cmp > /dev/null".

--- gnulib-tool.orig    Sat Mar 24 16:35:27 2012
+++ gnulib-tool Sat Mar 24 16:32:50 2012
@@ -3151,7 +3151,7 @@
          || { test -n "$lsymbolic" \
               && test "$lookedup_file" = "$local_gnulib_dir/$f"; }; } \
        && test -z "$lookedup_tmp" \
-       && cmp "$lookedup_file" "$tmpfile" > /dev/null; then
+       && cmp -s "$lookedup_file" "$tmpfile"; then
       func_ln_if_changed "$lookedup_file" "$destdir/$g"
     else
       mv -f "$tmpfile" "$destdir/${g}" || func_fatal_error "failed"
@@ -3180,7 +3180,7 @@
 # - already_present  nonempty if the file should already exist, empty otherwise
 func_update_file ()
 {
-  if cmp "$destdir/$g" "$tmpfile" > /dev/null; then
+  if cmp -s "$destdir/$g" "$tmpfile"; then
     : # The file has not changed.
   else
     # Replace the file.
@@ -3195,7 +3195,7 @@
            || { test -n "$lsymbolic" \
                 && test "$lookedup_file" = "$local_gnulib_dir/$f"; }; } \
          && test -z "$lookedup_tmp" \
-         && cmp "$lookedup_file" "$tmpfile" > /dev/null; then
+         && cmp -s "$lookedup_file" "$tmpfile"; then
         func_ln_if_changed "$lookedup_file" "$destdir/$g"
       else
         mv -f "$tmpfile" "$destdir/${g}" || func_fatal_error "failed"
@@ -4909,7 +4909,7 @@
   modules="$main_modules"
   func_emit_lib_Makefile_am > "$tmpfile"
   if test -f "$destdir"/$sourcebase/$makefile_am; then
-    if cmp "$destdir"/$sourcebase/$makefile_am "$tmpfile" > /dev/null; then
+    if cmp -s "$destdir"/$sourcebase/$makefile_am "$tmpfile"; then
       rm -f "$tmpfile"
     else
       if $doit; then
@@ -4940,7 +4940,7 @@
       func_lookup_file build-aux/po/$file
       cat "$lookedup_file" > "$tmpfile"
       if test -f "$destdir"/$pobase/$file; then
-        if cmp "$destdir"/$pobase/$file "$tmpfile" > /dev/null; then
+        if cmp -s "$destdir"/$pobase/$file "$tmpfile"; then
           rm -f "$tmpfile"
         else
           if $doit; then
@@ -4967,7 +4967,7 @@
     func_dest_tmpfilename $pobase/Makevars
     func_emit_po_Makevars > "$tmpfile"
     if test -f "$destdir"/$pobase/Makevars; then
-      if cmp "$destdir"/$pobase/Makevars "$tmpfile" > /dev/null; then
+      if cmp -s "$destdir"/$pobase/Makevars "$tmpfile"; then
         rm -f "$tmpfile"
       else
         if $doit; then
@@ -4993,7 +4993,7 @@
     func_dest_tmpfilename $pobase/POTFILES.in
     func_emit_po_POTFILES_in > "$tmpfile"
     if test -f "$destdir"/$pobase/POTFILES.in; then
-      if cmp "$destdir"/$pobase/POTFILES.in "$tmpfile" > /dev/null; then
+      if cmp -s "$destdir"/$pobase/POTFILES.in "$tmpfile"; then
         rm -f "$tmpfile"
       else
         if $doit; then
@@ -5042,7 +5042,7 @@
           }
       ) > "$tmpfile"
       if test -f "$destdir"/$pobase/LINGUAS; then
-        if cmp "$destdir"/$pobase/LINGUAS "$tmpfile" > /dev/null; then
+        if cmp -s "$destdir"/$pobase/LINGUAS "$tmpfile"; then
           rm -f "$tmpfile"
         else
           echo "Updating $pobase/LINGUAS (backup in $pobase/LINGUAS~)"
@@ -5131,7 +5131,7 @@
     fi
   ) > "$tmpfile"
   if test -f "$destdir"/$m4base/gnulib-cache.m4; then
-    if cmp "$destdir"/$m4base/gnulib-cache.m4 "$tmpfile" > /dev/null; then
+    if cmp -s "$destdir"/$m4base/gnulib-cache.m4 "$tmpfile"; then
       rm -f "$tmpfile"
     else
       if $doit; then
@@ -5270,7 +5270,7 @@
     echo "])"
   ) > "$tmpfile"
   if test -f "$destdir"/$m4base/gnulib-comp.m4; then
-    if cmp "$destdir"/$m4base/gnulib-comp.m4 "$tmpfile" > /dev/null; then
+    if cmp -s "$destdir"/$m4base/gnulib-comp.m4 "$tmpfile"; then
       rm -f "$tmpfile"
     else
       if $doit; then
@@ -5305,7 +5305,7 @@
     modules="$testsrelated_modules"
     func_emit_tests_Makefile_am "${macro_prefix}tests_WITNESS" > "$tmpfile"
     if test -f "$destdir"/$testsbase/$makefile_am; then
-      if cmp "$destdir"/$testsbase/$makefile_am "$tmpfile" > /dev/null; then
+      if cmp -s "$destdir"/$testsbase/$makefile_am "$tmpfile"; then
         rm -f "$tmpfile"
       else
         if $doit; then




reply via email to

[Prev in Thread] Current Thread [Next in Thread]