From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 22 19:43:07 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8494216A4CE for ; Tue, 22 Jun 2004 19:43:07 +0000 (GMT) Received: from mail6.speakeasy.net (mail6.speakeasy.net [216.254.0.206]) by mx1.FreeBSD.org (Postfix) with ESMTP id 660DB43D58 for ; Tue, 22 Jun 2004 19:43:07 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: (qmail 14476 invoked from network); 22 Jun 2004 19:43:07 -0000 Received: from dsl027-160-063.atl1.dsl.speakeasy.net (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) encrypted SMTP for ; 22 Jun 2004 19:42:59 -0000 Received: from 10.50.41.233 (gw1.twc.weather.com [216.133.140.1]) by server.baldwin.cx (8.12.11/8.12.11) with ESMTP id i5MJguYG019196; Tue, 22 Jun 2004 15:42:56 -0400 (EDT) (envelope-from jhb@FreeBSD.org) From: John Baldwin To: freebsd-hackers@FreeBSD.org Date: Tue, 22 Jun 2004 15:43:57 -0400 User-Agent: KMail/1.6 References: <20040621054406.GA927@VARK.homeunix.com> <20040621133003.GA96338@ussenterprise.ufp.org> In-Reply-To: MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200406221543.57056.jhb@FreeBSD.org> X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on server.baldwin.cx Subject: Re: /bin/ls sorting bug? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Jun 2004 19:43:07 -0000 On Monday 21 June 2004 08:48 pm, Greg Black wrote: > On 2004-06-21, Leo Bicknell wrote: > > While I think the particular sort order (current behavior vrs non > > nano patch vrs nano patch) is largely unimportant, I think consistency > > is very important. It's quite common to do things like using diff > > on the output of commands like ls (indeed, I think several of the > > built in periodic scripts to this), and for that having a _reproduceable_ > > order is important. > > The output of ls has never been good for reproduceable output > for identical data. It frequently leads to gigantic "diffs" in > periodic reports which makes them useless, as far as I can > tell. Take the following case: > > $ mkdir foo > $ touch foo/a > [1] $ ls -l foo > total 0 > -rw-r--r-- 1 gjb gjb 0 Jun 22 10:25 a > $ touch foo/b > [2] $ ls -l foo > total 0 > -rw-r--r-- 1 gjb gjb 0 Jun 22 10:25 a > -rw-r--r-- 1 gjb gjb 0 Jun 22 10:26 b > $ sudo chown nobody foo/a > [3] $ ls -l foo > total 0 > -rw-r--r-- 1 nobody gjb 0 Jun 22 10:25 a > -rw-r--r-- 1 gjb gjb 0 Jun 22 10:26 b > > If we diff the output of ls[1] and ls[2], we'll get a useful > answer that shows us that "b" was added. > > But if we diff ls[2] and ls[3], it will appear as though every > entry has changed, although only "b" has. When this happens in > big directories, the consequences are astonishingly bad. diff -b -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org