Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!yale!cmcl2!lanl!cochiti.lanl.gov!jlg From: jlg@cochiti.lanl.gov (Jim Giles) Newsgroups: comp.os.misc Subject: Re: Globbing Message-ID: <18205@lanl.gov> Date: 18 Mar 91 17:00:10 GMT References: <17602@lanl.gov> Sender: news@lanl.gov Reply-To: jlg@cochiti.lanl.gov (Jim Giles) Organization: Los Alamos National Laboratory Lines: 78 From article , by peter@ficc.ferranti.com (Peter da Silva): > In article <17602@lanl.gov> jlg@cochiti.lanl.gov (Jim Giles) writes: >> Please read the original post again. The mnemonic purpose of quoting >> is to _prevent_ globbing. But, in _both_ these cases, I _WANT_ globbing. > > No, you want wildcarding in another context. That's not globbing. Call it whatever you want. The point is that quoting implies turning it OFF!!!! And I want it done!!! And I don't want the shell to incorrectly do it (which is the only way the shell works - incorrectly). >> [...] _your_ "solution" requires multiple quoting - _BLETCH!!_ > > As in "grep 'include.*\.h' *.c"? [...] BLETCH!!! > [...] But your solution requires knowing the > behaviour of the program you're passing the argument to the other context. If I don't know what a program expects as arguments, I have no business calling it at all. Of _course_ I have to know what the program is going to do with its arguments. > And when I'm calling it directly from another program (say, "mail") I > have to add a bunch of quoting I'm not putting in now... [...] Only in the _rare_ case when the arguments contain wildcard characters that you don't want expanded. This almost never happens, but when it does, it is preferable to have a consistent quoting convention for such instances. Your "solution" doesn't - it requires multiple quoting, perhaps to several levels if the argument is to be passed through several programs. > [...] and *that* is a > security risk... one I've exploited in older HDB uucp to demonstrate the > problem. It is only a security risk in systems where security is shoddy to begin with. Oh, that's right, we _are_ talking about UNIX. > [...] > Quote once and for all, with a consistent syntax. Exactly what I just said: DON'T quote multiply - quote once and for all!! Quoting should mean what people intuitively think it means: the quoted argument will be used literally. No matter how many levels deep it's passed and no matter where it goes, the end use of the string will use the exact literal contents of the string. And consistent syntax is achieved by programmer discipline, not monstrous shell design. > [...] > No, the tool does not always know what the arguments mean. Particularly when > the "user" is another program. Why should I have todepend on hundreds of > programmers writing hundreds of unique tools guessing what globbing is needed: > the USER should be the only entity specifying when globbing is going to be > done. Fine - then not even the shell should ever do it automatically. If _anything_ does it automatically, it ought to be the tool and NOT the shell. The shell should keep its grubby hands off the entire command line. In fact, I would prefer that the shell not even tokenize the command line. However, this bankrupt argument about consistency is often used by UNIX supporters to object to useful features that UNIX _doesn't_ have. The fact the UNIX contains _MORE_ than its share of features which are inconsistent is evidence that it is not _really_ considered to be an important issue. So, you're just clutching at any argument which will defend your religiously chosen system. The bottom line is that if consistency _is_ important, it is best achieved by discipline among systems programmers - something that UNIX has _never_ seen. J. Giles