delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2015/11/07/09:38:34

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
X-Recipient: djgpp AT delorie DOT com
Date: Sat, 07 Nov 2015 16:38:12 +0200
From: "Eli Zaretskii (eliz AT gnu DOT org) [via djgpp AT delorie DOT com]" <djgpp AT delorie DOT com>
Subject: Re: Grep 2.22 null-byte check fails.
In-reply-to: <563E08EC.2000303@gmx.de>
X-012-Sender: halo1 AT inter DOT net DOT il
To: djgpp AT delorie DOT com
Message-id: <83egg1q3hn.fsf@gnu.org>
References: <563E08EC DOT 2000303 AT gmx DOT de>
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> Date: Sat, 07 Nov 2015 15:21:32 +0100
> From: "Juan Manuel Guerrero (juan DOT guerrero AT gmx DOT de) [via djgpp AT delorie DOT com]" <djgpp AT delorie DOT com>
> 
> I am porting grep 2.22 and the null-byte check fails.
> This check creates a file called "in" with the content: 00 0D 0A
> and a pattern file called "pat" with the content: 00 24 0D 0A
> and then runs the command:
>   LC_ALL=C
>   grep -a -f pat in
> 
> As result I get the output:
> 
> null-byte: failed test: -a '\0$' does not match '\0'

Isn't this an EOL issue?  The input file have the DOS CR-LF EOL, but
the null byte will AFAIR cause Grep to consider the file as binary,
and thus not strip the CR characters from the end of line.  Then \0$
won't match because the character after the null byte is \r, not \n.

What happens if you convert 'in' to Unix EOL format?

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019