9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Lucio De Re <lucio@proxima.alt.za>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] Ugly hack
Date: Sun, 16 Feb 2003 17:00:19 +0200	[thread overview]
Message-ID: <20030216170019.Q9084@cackle.proxima.alt.za> (raw)
In-Reply-To: <5058bc09efabbfadfc80effc0d3ba1f1@plan9.bell-labs.com>; from Russ Cox on Sun, Feb 16, 2003 at 09:19:38AM -0500

On Sun, Feb 16, 2003 at 09:19:38AM -0500, Russ Cox wrote:
>
> This is not the right place for such a hack.
> You are attempting to fix a bug in the kernel
> by patching the shell.  Down that path lies
> madness.  See http://plan9.bell-labs.com/sys/doc/lexnames.ps.
>
Well, the shell does not make use of any special kernel features
to expand globbed arguments, it recursively descends the directory
tree.  I'm addressing that aspect and I'm quite pleased with the
results.

If the kernel were to provide an equivalent function, I'd certainly
be keen to see it incorporated in the shell and any other similar
command and would try to motivate for it to be as powerful and/or
practical as possible.

I did read Rob's paper a while back, but I don't recall it addressing
filename expansion.  I could be mis-remembering, of course.

In defense of my point of view, I must add the following: adding
the "dironly" filter to the shell code (in the Readdir() function
of plan9.c - I have an interesting challenge in duplicating this
in unix.c, ironically) not only makes rc's behaviour consistent
with my Unix-based expectations but also reduces the resources
required for expanding big and/or deep directories quite considerably.

I think it was echo /*/*/*/*/*/*/*/* that blew up with the release
shell and completed (apparently successfully, although one may
question the sanity of such an operation) with the modified shell.

It goes without saying that echo /*/*/*/*/*/*/*/*/ is not even
vaguely useful under the original shell, even if there was as much
virtual memory available as required.

Now, I'm happy to confess that I don't know where the inconsistency
Geoff discovered originates, he may well be right that it stems
from poor kernel behaviour, but I'm not convinced.  The modified
shell seems to work correctly in both instances of:

term% srv myrtle myrtle /n/kremvax
post...
term% cd /n/kremvax/usr/share/sendmail
term% echo */.
LICENSE/. README/. cf/. domain/. feature/. hack/. m4/. mailer/. ostype/. sh/. siteconfig/.
term% /sys/src/cmd/rc/8.out -c 'echo */.'
cf/. domain/. feature/. hack/. m4/. mailer/. ostype/. sh/. siteconfig/.
term% /sys/src/cmd/rc/8.out -c 'echo */..'
cf/.. domain/.. feature/.. hack/.. m4/.. mailer/.. ostype/.. sh/.. siteconfig/..
term% echo */..
cf/.. domain/.. feature/.. hack/.. m4/.. mailer/.. ostype/.. sh/.. siteconfig/..
term%

The above mirrors the Unix (NetBSD) shell behaviour (I use pdksh,
incidentally) which, interestingly, the Plan 9 version does not:

term% ape/psh
bind: /386/bin/pub: '/386/bin/pub' does not exist
$ pwd
/n/kremvax/usr/share/sendmail
$ echo */
cf/ domain/ feature/ hack/ m4/ mailer/ ostype/ sh/ siteconfig/
$ echo */.
LICENSE/. README/. cf/. domain/. feature/. hack/. m4/. mailer/. ostype/. sh/. siteconfig/.
$ echo */..
cf/.. domain/.. feature/.. hack/.. m4/.. mailer/.. ostype/.. sh/.. siteconfig/..
$

So, I see that I may be chasing the wrong wild goose, but I'm only
tangentially masking what may be a kernel error.  The changes to
rc just happened to be misguided, initially, and accidentally caused
the additional problem to be fixed once I corrected my poor
understanding.  I would certainly be curious to get to the bottom
of Geoff's anomaly.

++L


  reply	other threads:[~2003-02-16 15:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-15 15:46 Lucio De Re
2003-02-15 16:18 ` Sam
2003-02-15 16:21   ` Dan Cross
2003-02-15 16:29   ` Lucio De Re
2003-02-15 23:56 ` Geoff Collyer
2003-02-16  9:20   ` Lucio De Re
2003-02-16  9:25     ` Lucio De Re
2003-02-16 12:18       ` Lucio De Re
2003-02-16 12:45         ` Lucio De Re
2003-02-16 14:19 ` Russ Cox
2003-02-16 15:00   ` Lucio De Re [this message]
2003-02-16 15:31     ` David Butler
2003-02-16 15:40     ` Russ Cox
2003-02-17  5:27       ` Lucio De Re
2003-02-17  9:53 ` John Kodis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030216170019.Q9084@cackle.proxima.alt.za \
    --to=lucio@proxima.alt.za \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).