From a0d6f350fee9d91382295e89d7cc50dc2a2cfadc Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Wed, 23 Jan 2008 20:24:47 -0700 Subject: [PATCH] * doc/autoconf.texi (Limitations of Usual Tools) : Document BSD behavior on binary input. Signed-off-by: Eric Blake --- ChangeLog | 4 ++++ doc/autoconf.texi | 14 ++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/ChangeLog b/ChangeLog index b8e7fb0d..a3f52fe1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2008-01-28 Eric Blake + Document grep peculiarity. + * doc/autoconf.texi (Limitations of Usual Tools) : Document + BSD behavior on binary input. + Minor testsuite improvements. * lib/autotest/general.m4 (AT_INIT) : Use fewer forks when sanitizing PATH. Always output machine information, diff --git a/doc/autoconf.texi b/doc/autoconf.texi index 59e6f97e..f6421d7a 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -14957,6 +14957,20 @@ Similarly, the following escape sequences should also be avoided: @samp{\<}, @samp{\>}, @samp{\+}, @samp{\?}, @samp{\`}, @samp{\'}, @samp{\B}, @samp{\b}, @samp{\S}, @samp{\s}, @samp{\W}, and @samp{\w}. +Posix does not specify the behavior of @command{grep} on binary files. +An example where this matters is using @acronym{BSD} @command{grep} to +search text that includes embedded @acronym{ANSI} escape sequences for +colored output to terminals (@samp{\033[m} is the sequence to restore +normal output); the behavior depends on whether input is seekable: + +@example +$ @kbd{printf 'esc\033[mape\n' > sample} +$ @kbd{grep . sample} +Binary file sample matches +$ @kbd{cat file | grep .} +escape +@end example + @item @command{join} @c ----------------- -- 2.47.2