rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
* Re:  bug in globber?
@ 1993-05-23  4:31 Paul Haahr
  0 siblings, 0 replies; 3+ messages in thread
From: Paul Haahr @ 1993-05-23  4:31 UTC (permalink / raw)
  To: egsirer; +Cc: rc

Gun writes
> I think (and Byron can correct me if I'm wrong) this is because rc globs
> all the elements of a path if there is globbing anywhere within it. That
> is, given "foo/../foo*" rc will first match "foo" against everything in ".",
> ".." against everything in foo (for which it needs read permission) and
> "foo*" against stuff in "foo/..". 

and he's right.  it's actually a trivial change to make; we changed it
when we ported rc's globber to es.  i believe that Byron had put it on
his list of changes for 1.5, and it's probably a change that should be
made for both correctness and performance reasons.

paul


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re:  bug in globber?
@ 1993-05-22 23:46 Emin Gun Sirer
  0 siblings, 0 replies; 3+ messages in thread
From: Emin Gun Sirer @ 1993-05-22 23:46 UTC (permalink / raw)
  To: alan; +Cc: rc

>rc doesn't seem to be able to glob through a directory without having
>read permission; sh can.

I think (and Byron can correct me if I'm wrong) this is because rc globs
all the elements of a path if there is globbing anywhere within it. That
is, given "foo/../foo*" rc will first match "foo" against everything in ".",
".." against everything in foo (for which it needs read permission) and
"foo*" against stuff in "foo/..". 

This was done to keep the implementation simple and rc's globber works
correctly, which is a lot more than what one could say about some other
shells.

If this is not changed, perhaps it should be documented. I believe the
comment regarding globbing disappeared some time between 1.2 and 1.4.
If someone spends the time to fix this AND NOT BREAK anything else, so
much the better.

Judging by the comments in 1.4beta (which I am running), there seems to
be code to check for metacharacters in each path element and glob only
occasionally; however, trace still shows that every directory on the path
is read.

Gun.

P.S. Someone forgot to add the controversy about hash not introducing a
comment if it is not preceded by white space (e.g. lpr -#2), my personal
pet peeve, to the wish list.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug in globber?
@ 1993-05-22 17:13 Alan Watson
  0 siblings, 0 replies; 3+ messages in thread
From: Alan Watson @ 1993-05-22 17:13 UTC (permalink / raw)
  To: rc

rc doesn't seem to be able to glob through a directory without having
read permission; sh can.

; mkdir foo
; echo foo/../foo*
foo/../foo
; chmod u-r foo
; echo foo/../foo*
foo/../foo*
; sh
$ echo foo/../foo*
foo/../foo
$ sh5
$ echo foo/../foo*
foo/../foo
$

This is under Ultrix 4.3, so /bin/sh is a creaky old v7 sh and /bin/sh5
is the SVR2 sh.  And, no, the shs aren't running setuid root!

Alan.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1993-05-23  4:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1993-05-23  4:31 bug in globber? Paul Haahr
  -- strict thread matches above, loose matches on Subject: below --
1993-05-22 23:46 Emin Gun Sirer
1993-05-22 17:13 Alan Watson

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).