From owner-freebsd-questions@freebsd.org Fri Nov 1 13:17:04 2019 Return-Path: Delivered-To: freebsd-questions@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7CBB016519F for ; Fri, 1 Nov 2019 13:17:04 +0000 (UTC) (envelope-from feenberg@nber.org) Received: from mail2.nber.org (mail2.nber.org [198.71.6.79]) by mx1.freebsd.org (Postfix) with ESMTP id 474N5B6Z7Qz4Dq7 for ; Fri, 1 Nov 2019 13:17:02 +0000 (UTC) (envelope-from feenberg@nber.org) Received: from mail2.nber.org (mail2.nber.org [198.71.6.79]) by mail2.nber.org (8.15.2/8.15.2) with ESMTPS id xA1DH01P075673 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 1 Nov 2019 09:17:00 -0400 (EDT) (envelope-from feenberg@nber.org) Date: Fri, 1 Nov 2019 09:17:00 -0400 (EDT) From: Daniel Feenberg To: Kurt Hackenberg cc: freebsd-questions@freebsd.org Subject: Re: grep for ascii nul In-Reply-To: <558fd145-ad3e-90dc-5930-c01ca0c27d3c@panix.com> Message-ID: References: <20191101024817.GA60134@admin.sibptus.ru> <558fd145-ad3e-90dc-5930-c01ca0c27d3c@panix.com> User-Agent: Alpine 2.21.9999 (BSF 287 2018-06-16) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-KLMS-Rule-ID: 1 X-KLMS-Message-Action: clean X-KLMS-AntiSpam-Status: not scanned, disabled by settings X-KLMS-AntiSpam-Interceptor-Info: not scanned X-KLMS-AntiPhishing: Clean, 2019/07/09 11:58:30 X-KLMS-AntiVirus: Kaspersky Security 8.0 for Linux Mail Server, version 8.0.1.721, bases: 2019/11/01 06:54:00 #10529665 X-KLMS-AntiVirus-Status: Clean, skipped X-Rspamd-Queue-Id: 474N5B6Z7Qz4Dq7 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of feenberg@nber.org designates 198.71.6.79 as permitted sender) smtp.mailfrom=feenberg@nber.org X-Spamd-Result: default: False [-2.45 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.94)[-0.938,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[nber.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_MED(-0.20)[79.6.71.198.list.dnswl.org : 127.0.4.2]; RCPT_COUNT_TWO(0.00)[2]; RCVD_COUNT_ONE(0.00)[1]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:26287, ipnet:198.71.6.0/23, country:US]; RCVD_TLS_ALL(0.00)[]; IP_SCORE(-0.01)[country: US(-0.05)] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Nov 2019 13:17:04 -0000 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" >