This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Don't use tail +NNN
- From: Paolo Bonzini <paolo dot bonzini at lu dot unisi dot ch>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>, Alexandre Oliva <aoliva at redhat dot com>
- Date: Wed, 05 Oct 2005 09:05:59 +0200
- Subject: Re: [PATCH] Don't use tail +NNN
- References: <42CE38BC.2080507@lu.unisi.ch> <Pine.LNX.4.61.0507081224370.14395@digraph.polyomino.org.uk> <ork6gtqe33.fsf@livre.oliva.athome.lsd.ic.unicamp.br>
Alexandre Oliva wrote:
On Jul 8, 2005, "Joseph S. Myers" <joseph@codesourcery.com> wrote:
On Fri, 8 Jul 2005, Paolo Bonzini wrote:
The fink 0.8.0 distribution of textutils has the infamous problem of
deprecating "tail -NNN" and "tail +NNN", and make compare has started failing
for me since I installed Tiger. The attached patch avoids this, using "tail
-c +16" instead of "tail +16c".
I've since fixed this problem by sticking this in my home directory:
#! /bin/sh
tool=`basename $0`
case "$1" in
[-+][0-9]*) ;;
*) exec /sw/bin/$tool "$@"
esac
x="$1"
shift
case "$x" in
*c)
opt=-c
x=`echo "$x" | sed 's/c$//' `
;;
*)
opt=-n
;;
esac
case "$x" in
-*) exec /sw/bin/$tool $opt `expr 0 - $x` "$@" ;;
+*) exec /sw/bin/$tool $opt $x "$@" ;;
esac
That said, since we haven't ever got a report about problems with tail
+16c, we might use that if it works, try -c +16 otherwise (or the
other way round, since -c +16 is POSIX standard), and fallback to dd
as a last resort.
I'd rather not even fall back to dd. We'd already have cmp
--ignore-initial=16, cmp FILE1 FILE2 16 16, tail -c +16, tail +16c... I
guess that's more than enough.
Paolo