[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: es bug



>>>>> "David" == David McNab <mcnab@nas.nasa.gov> writes:

David> Not on my machine.  Maybe your es(1) is expanding the "*" to
David> all the file names in the directory, treating the expansion as
David> a list, and appending the "/".  If you type echo h* in that
David> directory do you get "ha hb hx hy" as output?

[ deletia regarding my thoughts on "foo/" ]

David> You can think of it that way, but you are not being precise.
David> You are confusing a psuedo-convention with "reality".  If you
David> opendir() the directory and read it there will be no trailing
David> "/" characters.  If you type "echo *" or "/bin/ls" there will
David> be no trailing "/", or "@" for symbolic links, or "=" for UNIX
David> domain sockets.

Let's forget all about "ls".  I don't think it really comes into play
here in any way.  Let's also forget about rmdir.

There are two things I don't undertsand:

1. Why "foo/" is not the same as "foo/.".  After all, "" is the same
   as ".".  But I don't expect to get any real answer to this, and I
   don't think it falls into es' domain anyway.

2. Why the expansion of "*/" is not a bug any way you look at it.
   There are two cases: on my machine, "*/" expands into what is
   clearly garbage (aside: the example you give does do the right
   thing -- it expands to "h*").  Case 2: on your machine, "*/"
   presumably expands to "*/".  Isn't this inconsistency bothersome?
   Doesn't this mean there is a bug in es?  Presumably a goal of es is
   to provide a portable scripting environments.  Given this
   difference, script writers have to take into account that strings
   ending in "/" cannot be globbed.

My vote to get rid of the bug is to make "*/" do what I'm used to.
Many people, apparently, think this is a bad idea.  I'm not sure
exactly why -- it seems like if we're defining the behavior, we might
as well define it to be something useful.

Perhaps this is actually a bug in SunOS, as has been suggested.  I'm
willing to believe that.  But given that the SunOS bug is not likely
to go away, I think es should deal with it.  I'm not familiar with the
es source, but I find it hard to believe that it doesn't already work
around problems on various architectures.

Tom
---
tromey@busco.lanl.gov             Member, League for Programming Freedom
Sadism and farce are always inexplicably linked.
	-- Alexander Theroux