a command with pitfalls

Latest response

Hi there,

I just came across a buggy (not quite in some sense) command that I feel obligatory to address to you, hoping you will be interested in fixing it if it's deemed a necessity.

Here is how it went:

1) I grabbed some content into a file:
mtr www.google.com >> /tmp/test.txt

2) out of curiosity, I typed:
cat < /tmp/test.txt >> /tmp/test.txt

3) then, insanity kicked off:

in the blink, the file "/tmp/test.txt" went up to a 1GB big file. If it was terminated immediately, I believe for a while longer the whole hard disc could have been quickly stuffed up and caused nothing to work.

I wonder if that's intentionally left unattended or it's just not been discovered yet.

On Ubuntu, at least when typing " cat < FILENAME >> FILENAME", it will complain the input and output use the same file, no matter what its intent is, to prevent a suicide-like command.

Let me know how you will get on with that.

Cheers,
Victor Zhong

Responses