Funny characters in filenames

Joseph I. Pallas joe at cvl.UUCP
Thu Jul 28 13:59:48 AEST 1983


Why, pray tell, are you using system() to do what you're doing?  It
seems grossly unfair to blame the UNIX (tm) system for your misusage of
one of its facilities.  Clearly, if you'd already run into problems
with quoting filenames, you should have been using fork/execv.  If that's
not good enough, then execvp, which gives all the power that system()
does for finding your command, WITHOUT doing what you didn't want it to
do.  Furthermore, it's more efficient.  System() does exactly what the
manual says:  "pass a command to the shell."

On the other side, I've seen lots of problems with naive users making
files they can't seem to remove, because they start with spaces, or
contain (this was the most common) '^[[D' (the left arrow key on most
of our terminals).  I've heard about a no-funny-file-names mode that
some people have implemented, which wouldn't put space, control chars,
or meta chars (8th bit set) into file names.  I'm sure that the 'bad'
characters you mention could be included.  The idea goes against my
grain, but then, I'm not a neophyte.  My solution to our problem was
simply to turn on ctlecho in the tty driver in everyone's .login
(4.1bsd).  Usually, someone has to work hard to create filenames that
contain a semicolon, a slash, or a bracket.  When he does, he
generally has to ask for help to get rid of them.  That seems alright
to me.  Because he'd probably have to ask for help anyway for an
explanation of the funny error he would get in novice-mode.

One other thing...why does expanding your quoting mechanism to quote
all files instead of certain ones "take more system calls to do the
same work,"  when it seems to me that it should use the same number of
system calls in the shell, and be more efficient in your program (no
tests for special characters)?


Joseph Pallas
rlgvax!cvl!joe



More information about the Comp.unix.wizards mailing list