Port to hosts whose 'sort' and 'tail' implementations treat operands with leading...
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 6 Jul 2006 23:24:51 +0000 (23:24 +0000)
committerMike Stump <mrs@gcc.gnu.org>
Thu, 6 Jul 2006 23:24:51 +0000 (23:24 +0000)
Port to hosts whose 'sort' and 'tail' implementations
treat operands with leading '+' as file names, as POSIX
has required since 2001.  However, make sure the code still
works on pre-POSIX hosts.
* ltmain.sh: Don't assume "sort +2" is equivalent to
"sort -k 3", since POSIX 1003.1-2001 no longer requires this.

contrib:
* compare_tests: Don't assume "sort +2" is equivalent to
"sort -k 3", since POSIX 1003.1-2001 no longer requires this.
gcc:
* Makefile.in (slowcompare): Port to POSIX 1003.1-2001,
which says you should use "tail -c +N" rather than "tail +Nc".
Fix a bug: the old code incorrectly skipped 15 bytes, not 16.

From-SVN: r115234

ChangeLog
contrib/ChangeLog
contrib/compare_tests
gcc/ChangeLog
gcc/Makefile.in
ltmain.sh

index 4f6f192b72b479cc377e20d86cde3c29ea3de24b..3d9a3ee3800dc694516345dc1e1e23be0c4f8192 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2006-07-06  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Port to hosts whose 'sort' and 'tail' implementations
+       treat operands with leading '+' as file names, as POSIX
+       has required since 2001.  However, make sure the code still
+       works on pre-POSIX hosts.
+       * ltmain.sh: Don't assume "sort +2" is equivalent to
+       "sort -k 3", since POSIX 1003.1-2001 no longer requires this.
+
 2006-07-05  Ulrich Weigand  <uweigand@de.ibm.com>
 
        * MAINTAINERS (Various Maintainers): Add myself as reload maintainer.
index 120213ac20fa1b7954680c1ea1ee7841d3681eee..35d29b96f126d8bf3e6a264af21a62627c7808c5 100644 (file)
@@ -1,3 +1,12 @@
+2006-07-06  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Port to hosts whose 'sort' and 'tail' implementations
+       treat operands with leading '+' as file names, as POSIX
+       has required since 2001.  However, make sure the code still
+       works on pre-POSIX hosts.
+       * compare_tests: Don't assume "sort +2" is equivalent to
+       "sort -k 3", since POSIX 1003.1-2001 no longer requires this.
+
 2006-06-05  James Lemke  <jwlemke@wasabisystems.com>
 
        * dg-cmp-results.sh: New script for comparing DejaGNU logs.
index bcf678c52eac2fa4b187b70e00e31c76f1e00ef2..bed97429d6677ad03ea4ba90c49269c72ef7b75d 100755 (executable)
@@ -31,8 +31,14 @@ 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"
+if sort -k 2 </dev/null >/dev/null 2>&1; then
+  skip1='-k 2'
+else
+  skip1='+1'
+fi
+
+sort -t ':' $skip1 "$now" > "$now_s"
+sort -t ':' $skip1 "$before" > "$before_s"
 
 grep '^FAIL:' "$now_s" | sed 's/^[^:]*:[       ]//' >$tmp1
 grep '^PASS' "$before_s" | sed 's/^[^:]*:[     ]//' | comm -12 $tmp1 - >$tmp2
index e5eb94cd1f01c8f136b7d17be0a0e985cf67c489..94f768f6a204b4f25ece98077f8fa68b7e1497f5 100644 (file)
@@ -1,3 +1,13 @@
+2006-07-06  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Port to hosts whose 'sort' and 'tail' implementations
+       treat operands with leading '+' as file names, as POSIX
+       has required since 2001.  However, make sure the code still
+       works on pre-POSIX hosts.
+       * Makefile.in (slowcompare): Port to POSIX 1003.1-2001,
+       which says you should use "tail -c +N" rather than "tail +Nc".
+       Fix a bug: the old code incorrectly skipped 15 bytes, not 16.
+
 2006-07-06  Zdenek Dvorak <dvorakz@suse.cz>
 
        * tree-ssa-loop-niter.c (scev_probably_wraps_p): Fix typo in argument name.
index 9f29c7bfe4dc947e51690aea854b66529d87a0e5..3287de9a60549ca4ad9c3b1dce0fe753ad420015 100644 (file)
@@ -4384,8 +4384,13 @@ fastcompare fastcompare3 fastcompare4 fastcompare-lean fastcompare3-lean fastcom
            for file in $$dir/*$(objext); do \
              case "$@" in \
                slowcompare* ) \
-                 tail +16c ./$$file > tmp-foo1; \
-                 tail +16c stage$$stage/$$file > tmp-foo2; \
+                 if tail -c +1 </dev/null >/dev/null 2>&1; then \
+                   skip16='-c +17'; \
+                 else \
+                   skip16='+17c'; \
+                 fi; \
+                 tail $$skip16 ./$$file > tmp-foo1; \
+                 tail $$skip16 stage$$stage/$$file > tmp-foo2; \
                  cmp tmp-foo1 tmp-foo2 > /dev/null 2>&1; \
                  cmpret=$$?; \
                  ;; \
index 219823fc45db08bcbb44cda74651d3f1e8a2c0b6..a3c55f9a7513048bf549ec98b8a6a1d18e44c733 100644 (file)
--- a/ltmain.sh
+++ b/ltmain.sh
@@ -3839,7 +3839,13 @@ extern \"C\" {
            fi
 
            # Try sorting and uniquifying the output.
-           if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
+           if grep -v "^: " < "$nlist" |
+               if sort -k 3 </dev/null >/dev/null 2>&1; then
+                 sort -k 3
+               else
+                 sort +2
+               fi |
+               uniq > "$nlist"S; then
              :
            else
              grep -v "^: " < "$nlist" > "$nlist"S