delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2015/11/07/11:45:11

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
X-Received: by 10.50.17.106 with SMTP id n10mr12659598igd.6.1446913646673;
Sat, 07 Nov 2015 08:27:26 -0800 (PST)
X-Received: by 10.182.112.234 with SMTP id it10mr255164obb.13.1446913646649;
Sat, 07 Nov 2015 08:27:26 -0800 (PST)
Newsgroups: comp.os.msdos.djgpp
Date: Sat, 7 Nov 2015 08:27:26 -0800 (PST)
In-Reply-To: <83egg1q3hn.fsf@gnu.org>
Complaints-To: groups-abuse AT google DOT com
Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=109.192.116.56;
posting-account=OsAajgoAAADdKJnkJkmhzqP0jo6I_P_0
NNTP-Posting-Host: 109.192.116.56
References: <563E08EC DOT 2000303 AT gmx DOT de> <83egg1q3hn DOT fsf AT gnu DOT org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <bada2e25-6ffc-400f-a97a-543b938a6591@googlegroups.com>
Subject: Re: Grep 2.22 null-byte check fails.
From: "Juan Manuel Guerrero (juan DOT guerrero AT gmx DOT de) [via djgpp AT delorie DOT com]" <djgpp AT delorie DOT com>
Injection-Date: Sat, 07 Nov 2015 16:27:26 +0000
Bytes: 2397
Lines: 25
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
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

Am Samstag, 7. November 2015 15:38:35 UTC+1 schrieb Eli Zaretskii (eliz AT gnu DOT org) [via djgpp 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?

You are right, if I change the in file into UNIX format then the check passes.  But then I fear I have not really understood what the function of null-byte shall be on DOS/WINDOWS or any other OS with EOL different from UNIX format.

Thank you for the help,
Juan M. Guerrero

- Raw text -


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