From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Tolpin Message-Id: <200403190852.i2J8qNee097860@adat.davidashen.net> To: 9fans@cse.psu.edu Subject: Re: [9fans] ls, rc question -- proposed change to rc/glob.c In-Reply-To: <4ACCD005-797F-11D8-8706-000A95B984D8@mightycheese.com> Date: Fri, 19 Mar 2004 12:52:23 +0400 Topicbox-Message-UUID: 38360b60-eacd-11e9-9e20-41e7f4b1d025 > > 1. There is no kernel behavior in glob. It is just a pass over > > a list, with results sorted after the pass. > > that's sophistry. the data is generated by a read system call. > you're proposing making the shell differ from every other > program that reads directories. that seems like a bad idea. This is wrong. The data is generated by glob/globsort. The 'read' (in case of Plan9) system call is buried deep into system-dependent implementations for Unix, Plan9 and win32. Each using native calls of the underlying operating system. The semantics of globbing is (correctly) defined in a system-independent manner, stating that each globbing result is delivered once. > > this is not a bug, it's a feature. i'd rather fix the manual than > add special code to applications. Suppose I want to edit glob.c in rc.c. I am copying rc.c to $home/src/rc/. and then delete definition of globsort from the file. (This is what I actually do when I edit system sources). cpu% mkdir $home/src/rc cpu% cp /sys/src/cmd/rc/glob.c $home/src/rc/. cpu% bind -bc $home/src/rc /sys/src/cmd/rc cpu% cd /sys/src/cmd/rc cpu% mk cpu% sam glob.c # delete definition of globsort cpu% grep '^globsort' *.c glob.c:globsort(word *left, word *right) cpu% grep -n '^globsort' glob.c cpu% This is a bug.