Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 beta 3/9/83; site mot.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!panda!talcott!harvard!seismo!ut-sally!oakhill!mot!fred From: fred@mot.UUCP (Fred Christiansen) Newsgroups: net.unix-wizards,net.bugs.usg Subject: Re: ls(1) on System V Message-ID: <138@mot.UUCP> Date: Thu, 11-Apr-85 13:07:45 EST Article-I.D.: mot.138 Posted: Thu Apr 11 13:07:45 1985 Date-Received: Sat, 13-Apr-85 05:43:57 EST References: <176@mplvax.UUCP>, <119@drivax.UUCP> Organization: Motorola Microsystems, Phoenix AZ Lines: 27 Xref: watmath net.unix-wizards:12797 net.bugs.usg:212 > > ls(1) has two options to produce multi-column output, > > -C for sorted down the columns > > -x for sorted across the rows > > > > if *any* file in a directory has a full-length (14-char) name, > > then these options fail, and a single-column output results. > > I thought I would try out 14 character names with ls(1) on System V/iAPX286 > and the result on the 286 was 2 column output, while the VAX produced 5 > column output. > The problem is that strlen(3) is called with > the name as an argument. When the name is 14 characters long, strlen > falls off the end of the name, and returns a large number. By dumb > luck the VAX has a null after the name. The VME/10s around here do not > have the version of ls with the -C and -x flags. > Alan Fargusson (drivax!alan) A look at the code suggests that "fall[ing] off the end of the name" is indeed what happens, except for the "serendipity" when a null happens to be following ... or is there more? I created several files in a row with 14-char names on a VME/10 running Sys V R2. "od -cx ." indicates they were consecutive with no nulls following. Yet, with either -C or -x options for ls(1), the output was five column. Hmm. -- << Generic disclaimer >> Fred Christiansen, Motorola Microsystems, Tempe {ihnp4,allegra}!sftig!mot!fred {ihnp4,seismo}!ut-sally!oakhill!mot!fred {ihnp4,amdahl}!drivax!mot!fred