From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6139 invoked from network); 7 Apr 2003 09:40:43 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 7 Apr 2003 09:40:43 -0000 Received: (qmail 12919 invoked by alias); 7 Apr 2003 09:40:10 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 6029 Received: (qmail 12906 invoked from network); 7 Apr 2003 09:40:10 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 7 Apr 2003 09:40:10 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [62.189.183.235] by sunsite.dk (MessageWall 1.0.8) with SMTP; 7 Apr 2003 9:40:9 -0000 Received: from exchange01.csr.com (unverified) by (Content Technologies SMTPRS 4.2.1) with ESMTP id for ; Mon, 7 Apr 2003 10:48:40 +0100 Received: from csr.com (tinky-winky.csr.com [192.168.144.127]) by exchange01.csr.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2650.21) id 2HDKD006; Mon, 7 Apr 2003 10:39:06 +0100 To: Zsh Users Subject: Re: null bytes in file names? In-reply-to: "Erik Trulsson"'s message of "Mon, 07 Apr 2003 10:48:15 +0200." <20030407084815.GA28250@falcon.midgard.homeip.net> Date: Mon, 07 Apr 2003 10:40:06 +0100 Message-ID: <19705.1049708406@csr.com> From: Peter Stephenson Erik Trulsson wrote: > On Mon, Apr 07, 2003 at 10:32:21AM +0200, Dominik Vogt wrote: > > As far as I know, UNIX file systems allow null bytes in file > > names. Out of curiosity I tried generating such a file. I edited > > a file fn in a hex editor and put a single null byte into it. > > Your knowledge is somewhat faulty. > There are exactly two characters that Unix does not allow in filenames. > Those are NUL (ASCII code 0) and / (ASCII code 47). > The former is used to indicate the end of a filename, while the latter > is used to separate directory paths. Just to be particular... > > Take I (with "touch"): > > > > $ touch $(< fn) > > touch: creating `': No such file or directory > > touch: creating `': No such file or directory ...zsh actually handles the NUL internally, but there's no way to pass it down as an argument to `touch'. That gets passed a string `NUL NUL'. However, since as you no doubt know all the command receives is a count of arguments and a series of null-terminated strings, touch simply sees the first NUL. The same would happen with an `open()' call from within zsh. That's where the rule Erik mentioned comes from. -- Peter Stephenson Software Engineer CSR Ltd., Science Park, Milton Road, Cambridge, CB4 0WH, UK Tel: +44 (0)1223 692070 ********************************************************************** The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. **********************************************************************