From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <6671d1d4f2f936baafa24cd257ae90ce@collyer.net> To: 9fans@cse.psu.edu Subject: Re: [9fans] ls, rc question -- proposed change to rc/glob.c From: Geoff Collyer In-Reply-To: <50440c6f4b6946137968d772dcf08a2a@hamnavoe.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="upas-tuqyhiusfqcfxaoagitfjjkbjy" Date: Fri, 19 Mar 2004 00:47:32 -0800 Topicbox-Message-UUID: 381dd928-eacd-11e9-9e20-41e7f4b1d025 This is a multi-part message in MIME format. --upas-tuqyhiusfqcfxaoagitfjjkbjy Content-Disposition: inline Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit But in the case of a union directory with duplicate names, potentially representing distinct files, there are multiple names, not all of them distinct, in the directory. Since rc(1) doesn't say ``one for each distinct [or unique] path name matched'', one could argue that neither code nor manual needs change. If it's really a problem, fn nodup {ls -d $*|uniq} pr `{nodup *} | lp --upas-tuqyhiusfqcfxaoagitfjjkbjy Content-Type: message/rfc822 Content-Disposition: inline Received: from collyer.net ([10.9.0.12]) by collyer.net; Fri Mar 19 00:32:47 PST 2004 Received: from mail.cse.psu.edu ([130.203.4.6]) by collyer.net; Fri Mar 19 00:32:47 PST 2004 Received: by mail.cse.psu.edu (CSE Mail Server, from userid 60001) id 2855419C50; Fri, 19 Mar 2004 03:32:23 -0500 (EST) Received: from psuvax1.cse.psu.edu (psuvax1.cse.psu.edu [130.203.4.6]) by mail.cse.psu.edu (CSE Mail Server) with ESMTP id 9E24819C4B; Fri, 19 Mar 2004 03:32:20 -0500 (EST) X-Original-To: 9fans@cse.psu.edu Delivered-To: 9fans@cse.psu.edu Received: by mail.cse.psu.edu (CSE Mail Server, from userid 60001) id 6749419C4B; Fri, 19 Mar 2004 03:31:38 -0500 (EST) Received: from hamnavoe.gotadsl.co.uk (hamnavoe.gotadsl.co.uk [213.208.117.150]) by mail.cse.psu.edu (CSE Mail Server) with ESMTP id 0DB8C19AD6 for <9fans@cse.psu.edu>; Fri, 19 Mar 2004 03:31:37 -0500 (EST) Message-ID: <50440c6f4b6946137968d772dcf08a2a@hamnavoe.com> To: 9fans@cse.psu.edu Subject: Re: [9fans] ls, rc question -- proposed change to rc/glob.c From: Richard Miller In-Reply-To: <59B1952A-797D-11D8-8706-000A95B984D8@mightycheese.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Sender: 9fans-admin@cse.psu.edu Errors-To: 9fans-admin@cse.psu.edu X-BeenThere: 9fans@cse.psu.edu X-Mailman-Version: 2.0.11 Precedence: bulk Reply-To: 9fans@cse.psu.edu List-Id: Fans of the OS Plan 9 from Bell Labs <9fans.cse.psu.edu> List-Archive: Date: Fri, 19 Mar 2004 08:31:25 0000 X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on psuvax1.cse.psu.edu X-Spam-Status: No, hits=0.0 required=5.0 tests=none autolearn=no version=2.63 X-Spam-Level: > i don't like changing the shell to mask kernel behavior. it leads > to surprises. consider unix shells that `fix' cd in a way that it > differs from the chdir system call. But filename pattern matching in the shell is already different from just reading a directory in the kernel. By saying 'ls /tmp/*.c' instead of 'ls /tmp' you are asking for a selection of names. The question is how many times to select a name which matches more than one file. As David has pointed out, the rc manual at present unambiguously says "A pattern is replaced by a list of arguments, one for each path name matched" -- not "one for each file matched". So if rc isn't changed, the manual does need to be corrected. But I would vote for changing rc. Although I am (after some years of experience) sufficiently used to unions that I don't find the behaviour surprising, I do find it irritating: for example, when doing 'grep XXX *.c' in a union directory produces duplicate output for files which occur in more than one underlying directory. -- Richard --upas-tuqyhiusfqcfxaoagitfjjkbjy--