This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

patch: contrib/compare_tests


I was lazy today and decided to use compare_tests.  Guess what, it doesn't
work on recent coreutils/sort (i.e. the one on FC5).

>From the texinfo doc:

     On older systems, `sort' supports an obsolete origin-zero syntax
  `+POS1 [-POS2]' for specifying sort keys.  This obsolete behavior can
  be enabled or disabled with the `_POSIX2_VERSION' environment variable
  (*note Standards conformance::), but portable scripts should avoid
  commands whose behavior depends on this variable.  For example, use
  `sort ./+2' or `sort -k 3' rather than the ambiguous `sort +2'.

The patch below fixes the problem.  I only have older and newer Linux
boxes to test.  Perhaps someone should try it on BSDish and variants.

OK?

	* compare_tests: Use -k to specify sort keys.

Index: compare_tests
===================================================================
--- compare_tests	(revision 113248)
+++ compare_tests	(working copy)
@@ -31,8 +31,8 @@ now=$tmp2
 exit_status=0
 trap "rm -f $tmp1 $tmp2 $now_s $before_s" 0 1 2 3 5 9 13 15
 
-sort -t ':' +1 "$now" > "$now_s"
-sort -t ':' +1 "$before" > "$before_s"
+sort -t ':' -k 2 "$now" > "$now_s"
+sort -t ':' -k 2 "$before" > "$before_s"
 
 grep '^FAIL:' "$now_s" | sed 's/^[^:]*:[ 	]//' >$tmp1
 grep '^PASS' "$before_s" | sed 's/^[^:]*:[ 	]//' | comm -12 $tmp1 - >$tmp2


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]