From owner-freebsd-current Thu Nov 11 17:12:59 1999 Delivered-To: freebsd-current@freebsd.org Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by hub.freebsd.org (Postfix) with ESMTP id C28C514C0E for ; Thu, 11 Nov 1999 17:12:55 -0800 (PST) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.9.3/8.9.3) id TAA07081; Thu, 11 Nov 1999 19:12:47 -0600 (CST) (envelope-from dan) Date: Thu, 11 Nov 1999 19:12:47 -0600 From: Dan Nelson To: Paul Eggert Cc: tstromberg@rtci.com, freebsd-current@FreeBSD.ORG, bug-gnu-utils@gnu.org Subject: Re: Bad 'grep' behaviour in -CURRENT, faulty binary detection? Message-ID: <19991111191247.A6353@dan.emsphone.com> References: <382B2711.E13A1CC8@rtci.com> <199911120028.QAA06638@shade.twinsun.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: <199911120028.QAA06638@shade.twinsun.com>; from eggert@twinsun.com on Thu, Nov 11, 1999 at 04:28:53PM -0800 X-OS: FreeBSD 4.0-CURRENT Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In the last episode (Nov 11), Paul Eggert said: > Most likely this is because the output of your `set' command contains > binary data. In the past, this has been reported by people whose `set' > command would output something like this: > > IFS=' > ^@' > > where the `^@' in my message denotes a single NUL byte (control-@) in > the original. If this is what's happening to you, then this is quite > possibly a bug in your shell, since environment variables cannot > possibly contain NUL bytes in Unix. Aah, but 'set' prints the value of all shell variables, exported or not. You can store any value in a shell variable. In fact, I do things like this quite often (/bin/sh example here - zsh can do the same without forking to set a): a=$(cat file.gif) size=${#a} echo Content-Length: $size echo Content-Type: image/gif echo echo -n $a I agree that _environment_ variables can't have NULs in them. -- Dan Nelson dnelson@emsphone.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message