Quantcast

[GNU Autoconf 2.59c] diff might generate output for identical files

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[GNU Autoconf 2.59c] diff might generate output for identical files

Ralf Menzel
Hi,

I would like to propose a patch that addresses a peculiarity of
Solaris 9 diff. Watch:

--- snip ---
bash> diff -u /dev/null /dev/null
No differences encountered
--- snip ---

That is, the diff of Solaris 9 understands the option `-u' to generate
unified context diffs, but it emits a message (on stdout) of the files
it compares are identical. Unfortunately, this is contrary to use of
diff in _AT_CHECK (and probably other places).

Here is the patch that I propose:
--- snip ---
Index: lib/autotest/general.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autotest/general.m4,v
retrieving revision 1.183
diff -u -p -r1.183 general.m4
--- lib/autotest/general.m4 7 Jun 2005 13:03:09 -0000 1.183
+++ lib/autotest/general.m4 8 Jun 2005 13:20:41 -0000
@@ -610,7 +610,10 @@ else
 fi
 
 # Use `diff -u' when possible.
-if diff -u "$at_devnull" "$at_devnull" >/dev/null 2>&1; then
+if diff -u "$at_devnull" "$at_devnull" >"$at_stdout" 2>"$at_stderr" &&
+  diff "$at_stdout" "$at_devnull" >/dev/null 2>&1 &&
+  diff "$at_stderr" "$at_devnull" >/dev/null 2>&1
+then
   at_diff='diff -u'
 else
   at_diff=diff
--- snip ---

Bye,
Ralf Menzel


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [GNU Autoconf 2.59c] diff might generate output for identical files

Paul Eggert
Ralf Menzel <[hidden email]> writes:

> Here is the patch that I propose:

Thanks.  I installed the following somewhat-simpler patch.

2005-06-08  Paul Eggert  <[hidden email]>

        * lib/autotest/general.m4 (AT_INIT): Don't accept Solaris 9's diff
        -u, since it outputs chatter if the input files are the same.
        Problem reported by Ralf Menzel.

--- general.m4.~1.183.~ 2005-06-07 23:48:32 -0700
+++ general.m4 2005-06-08 13:14:47 -0700
@@ -610,7 +610,8 @@ else
 fi
 
 # Use `diff -u' when possible.
-if diff -u "$at_devnull" "$at_devnull" >/dev/null 2>&1; then
+if at_diff=`diff -u "$at_devnull" "$at_devnull" 2>&1` && test -z "$at_diff"
+then
   at_diff='diff -u'
 else
   at_diff=diff


Loading...