Skip site navigation (1)Skip section navigation (2)
Date:      19 Sep 2003 08:27:00 +0300
From:      "Karlsson Mikael HKI/SOSV" <mikael.karlsson@hel.fi>
To:        freebsd-questions@freebsd.org
Subject:   Re:Re: Cat a directory
Message-ID:  <JA8AAAAAAgH8RAABYQADV7qgzdhU@master.hel.fi>
In-Reply-To: <20030918143306.GF51544@dan.emsphone.com>
References:  <JA8AAAAAAgFWOQABYQADV7qgzdhU@master.hel.fi> <20030918143306.GF51544@dan.emsphone.com>

next in thread | previous in thread | raw e-mail | index | archive | help
OK! I admit that it isn't THE BIGGEST problem for me BUT it is A problem.=
 What
I ment in my last mail was that it is the biggest problem concerning cat.=
 Since
someone always seems to cat a binary file without having the knowledge of=
 what
it causes.

I personally think that some of these tests should be added to the real
distributable version of cat that comes with FreeBSD cause I can't be the=
 only
one that this bugs. I mean what could a little more code hurt to the program
since cat isn't supposed to read binary files.

I could add the code myself to cat's source file and compile it so my users
won't be able to cat binary files and stuff like that but what happens to=
 the
thousands of other people that is bugged by the same problem, are they supposed
to do the same re-coding that I did=3F Or couldn't this simply be added to=
 the
distribution source file so others won't be bugged.

Other *NIX systems seem to have done this to their cat program so why can't
FreeBSD=3F and why is this already done to=20less and not cat=3F

Dan Nelson wrote (18.9.2003  17:33):
>In the last episode (Sep 18), Karlsson Mikael HKI/SOSV said:
>> What I just wanted to ask was if it's absolutely necessary for cat to
>> be able to work on directories. Or if it would be possible to simply
>> add a check to cat that tests if the "file" being opened is a
>> directory and then exits with an error message if that is the case.
>
>The source is in /usr/src/bin/cat; add some code to stat the file and
>fail if it's a directory.
>
>> The biggest problem for me as a "Unix" help-person at a company is to
>> always explain to newbies and less experienced users not to cat
>> directories as it usually scrambles or locks the whole terminal and
>> as they then turn to me to undo their=20mistakes. These small simple
>> things give our users bad thoughts about FreeBSD and often drives
>> them to use other OSs!
>
>I find that hard to believe.  Do you also want to block catting of
>executables, gzipped files, jpeg files, database files,=20and audio
>files=3F  No OS does that by default.  Maybe you should teach them how to
>reset their terminals when they cat binary data; ^Jreset^J should work,
>assuming your TERM variable is set right.
>
>--
> Dan Nelson
> dnelson@allantgroup.com




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?JA8AAAAAAgH8RAABYQADV7qgzdhU>