Cat a directory

Mark admin at asarian-host.net
Thu Sep 25 08:26:41 PDT 2003


----- Original Message ----- 
From: "Jerry McAllister" <jerrymc at clunix.cl.msu.edu>
To: "Mark" <admin at asarian-host.net>
Cc: <freebsd-questions at freebsd.org>
Sent: Thursday, September 25, 2003 4:21 PM
Subject: Re: Re:Re: Cat a directory

But nonetheless very illustrative of how the OS takes into consideration an
unexpected, and probably unintended, behavior; namely, unlinking a
directory, whereas the user expects it to operate on regular files. Hence,
by default, it does NOT unlink directories, and only does so when you
specifically add the -d (-r) override. And that, to me, makes perfect sense.
Moreover, I feel the same logic should apply to "cat".

> If you want a special flag to make cat treat directories specially,
> then go ahead and write it and submit it. BUT DO NOT CHANGE THE
> DEFAULT BEHAVIOR OF CAT OR YOUR MODIFICATION WILL BE REJECTED BECAUSE IT
> WOULD BREAK THOUSANDS OF SCRIPTS AND BE FOOLISH AND UNNECESSARY!!!!!!!!

Uh-uh; and no default behavior has ever been changed over the years, eh? :)
And what is with these "thousands of scripts" that would suddenly break
horribly? So far, I have only heard one good scenario: a specific instance
where one would wish to obtain a hex-dump on the actual contents of the
directory file; and I even doubt such a use would find its way to a script
(as it would probably be a one-time use for debugging/finding lost files or
something). In 99.9 percent you will find that "cat" is used on regular
files. That figure is actually probably closer to 99.99999 percent; but I'll
be mild. When you spell it out like that, what should be "default behavior"
becomes clear.

> Now, either contribute something or be done with it.

I contributed a few clear, well-argumented reasons in favor of my position
that "cat" should change its default behavior. You, otoh, have only
demonstrated that you are a bully, and that you can yell real loud. Well,
that don't impress me much.

- Mark



More information about the freebsd-questions mailing list