From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10447 invoked from network); 7 Apr 2003 08:48:50 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 7 Apr 2003 08:48:50 -0000 Received: (qmail 18808 invoked by alias); 7 Apr 2003 08:48:17 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 6028 Received: (qmail 18801 invoked from network); 7 Apr 2003 08:48:17 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 7 Apr 2003 08:48:17 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [213.67.148.76] by sunsite.dk (MessageWall 1.0.8) with SMTP; 7 Apr 2003 8:48:16 -0000 Received: (qmail 28299 invoked by uid 1001); 7 Apr 2003 08:48:15 -0000 Date: Mon, 7 Apr 2003 10:48:15 +0200 From: Erik Trulsson To: Zsh Users Subject: Re: null bytes in file names? Message-ID: <20030407084815.GA28250@falcon.midgard.homeip.net> Mail-Followup-To: Zsh Users References: <20030407083221.GD557@gmx.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030407083221.GD557@gmx.de> User-Agent: Mutt/1.5.4i 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. So, you cant't have null bytes in a filename under Unix. > > Take I (with "touch"): > > $ touch $(< fn) > touch: creating `': No such file or directory > touch: creating `': No such file or directory > $ touch $(< fn) > touch: creating `': No such file or directory > $ touch s$(< fn)t > $ touch u"$(< fn)"v > $ ls > fn s t u > > "u" might actually be named "u^@v" but displayed incorrectly by ls, > so let's try to access a file named "u". > > $ ls u > u > > Nope, the name got cut off. > > $ rm s t y > > Take II (shell builtins only): > > $ echo foo > $(< fn) > zsh: no such file or directory: > $ echo foo > "$(< fn)" > zsh: no such file or directory: ^@ > $ echo foo > w$(< fn)x > $ echo foo > y$(< fn)z > $ ls > fn w x y z > $ ls w y > w y > > So, no luck. I wonder where the problem comes from: > > - zsh? (4.0.4) > - libc? > - kernel? (linux-2.4.20) > > Bye > > Dominik ^_^ ^_^ -- Erik Trulsson ertr1013@student.uu.se