Caution -- tacky in-line comment.

On Thu, Nov 5, 2020 at 8:46 AM Charles Mills <[email protected]> wrote:

> What the heck were the UNIX designers thinking when they allowed the
> casual creation of a filename of -x?


They were thinking that UNIX is for professionals who know what they're
doing and didn't want to be "molly coddled" and protected from themselves.
That's for Windows users. And, really, this is more an artifact of the
Bourne shell, not the UNIX kernel. In fact, UNIX allows a file to have any
characters in it other than 0x00. Mainly because it is written in C. That's
freedom, which requires responsibility.

Well, actually, UNIX probably allowed it because it was developed, I think,
on a PDP-7 which was very memory constrained and so they didn't do a whole
lot of coding to validate "reasonableness".

You might enjoy this: https://web.mit.edu/~simsong/www/ugh.pdf The UNIX
Haters Handbook.



> There may be a legitimate reason why someone would want to create a file
> named -x but if so, then *they* should be made to jump through some small
> hoop and "escape" the name in some way. The innocent victim who stumbles
> into this situation should not be the one made to jump through hoops. Will
> UNIX allow the creation of a file named "rm *"? That could have some
> interesting side effects.
>

Simple to do that:

touch  'rm *'

More  "difficult"

touch rm\ \*


>
> How did I inadvertently create a file named -x? I had a pax command
>
> pax -wzvf /my/archive.pax *
>
> I had an error that I thought might be solved by -x os390. Looking at the
> above command I forgot that /my/archive.pax "went with" the -f and coded
>
> pax -wzvf -x os390 /my/archive.pax *
>
> That has the effect of creating an archive named -x. UNIX did not complain
> or warn about that at all. (It complained about some unnamed file not being
> found, presumably os390.) That is poor design IMHO.
>

Perhaps. But, then again, WAD. Or perhaps BAD. But the command did exactly
what it was documented to do. Might as well complain, as I have, about the
backwardness of COND= in JCL. I now only use // IF  and it's friends for
condition checking.



>
> Heck, if the shell is going to expand the * then it could generate a
> warning "hey, did you know that one of your files has a name that looks
> just like a switch?"
>

Hum, now that might be an interesting thing to be able to do! The BASH
shell has a "shopts" builtin command to set some shell options. The GNU
utilities, well most of them, have a -- options which says anything which
has a leading dash after the double dash is _not_ to be interpreted as an
option. But that is not the shell itself. I think it is really an artifact
of the GNU version of "getopt()"
https://www.gnu.org/software/libc/manual/html_node/Using-Getopt.html

IBM really goofed up by not using the GNU libraries, or at least their
design, in z/OS UNIX. I am thinking they used base AIX. Which is
hilarious because AIX has GNU ported to it and I am fairly sure every
programmer uses it.


>
> Charles
>
>

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to