Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Nov 2019 09:17:00 -0400 (EDT)
From:      Daniel Feenberg <feenberg@nber.org>
To:        Kurt Hackenberg <kh@panix.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: grep for ascii nul
Message-ID:  <alpine.BSF.2.21.9999.1911010912090.73442@mail2.nber.org>
In-Reply-To: <558fd145-ad3e-90dc-5930-c01ca0c27d3c@panix.com>
References:  <20191101024817.GA60134@admin.sibptus.ru> <558fd145-ad3e-90dc-5930-c01ca0c27d3c@panix.com>

next in thread | previous in thread | raw e-mail | index | archive | help


On Fri, 1 Nov 2019, Kurt Hackenberg wrote:

> On 2019-10-31 22:48, Victor Sudakov wrote:
>
>> How can I print the names of files containing ascii nul (\x0)? The
>> FreeBSD "grep -l" does not seem to be able to do it.
>
> Yeah, no. Probably grep takes that NUL as the end of the C string that is 
> that command-line argument.
>
> You could use the attached program, which I wrote some time ago for this 
> purpose.

Huh?

I don't think the FreeBSD (or any Unix-like system) will create a file 
name with an embedded null byte. If you tried, the name would end at the 
null byte anyway. Perhaps the original poster has some corruption in his 
filesystem that manifests itself in a way that suggests a null byte? Or 
the file name could be in an archive of some sort? More information is 
required if help is to be given.

The rule that a filename can not contain a null byte is more like the law 
of gravity than a standard that a programmer might casually ignore.

Daniel Feenberg

> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.BSF.2.21.9999.1911010912090.73442>