Skip to main content
deleted 1 characters in body
Source Link
Peteris
  • 310
  • 1
  • 6

When seeing cat hugeregularfile.txt > /dev/null, the shell is not allowed to believe that the action is useless — cat is not part of the shell and could do anything at all in theory, and also in practice.

For example, the user may have renamed the executable rm to cat'cat, and suddenly the line performs externally observable behavior, i.e., removing the file.

The user may have compiled a version of cat that goes into an infinite loop, thus the shell cannot assume that it is 'known to terminate' as you suggest.

Someone may have installed a version of 'cat'cat that works as intended, but with an extra side effect of installing a rootkit if it's ever run with adequate privileges — again, the shell should duly execute it.

When seeing cat hugeregularfile.txt > /dev/null, the shell is not allowed to believe that the action is useless — cat is not part of the shell and could do anything at all in theory, and also in practice.

For example, the user may have renamed the executable rm to cat', and suddenly the line performs externally observable behavior, i.e., removing the file.

The user may have compiled a version of cat that goes into an infinite loop, thus the shell cannot assume that it is 'known to terminate' as you suggest.

Someone may have installed a version of 'cat' that works as intended, but with an extra side effect of installing a rootkit if it's ever run with adequate privileges — again, the shell should duly execute it.

When seeing cat hugeregularfile.txt > /dev/null, the shell is not allowed to believe that the action is useless — cat is not part of the shell and could do anything at all in theory, and also in practice.

For example, the user may have renamed the executable rm to cat, and suddenly the line performs externally observable behavior, i.e., removing the file.

The user may have compiled a version of cat that goes into an infinite loop, thus the shell cannot assume that it is 'known to terminate' as you suggest.

Someone may have installed a version of cat that works as intended, but with an extra side effect of installing a rootkit if it's ever run with adequate privileges — again, the shell should duly execute it.

added 13 characters in body
Source Link
Anthon
  • 81.4k
  • 42
  • 174
  • 228

When seeing "cat hugeregularfile.txt > /dev/null"cat hugeregularfile.txt > /dev/null, the shell is not allowed to believe that the action is useless - 'cat'cat is not part of the shell and could do anything at all in theory, and also in practice.

For example, the user may have renamed the executable 'rm'rm to 'cat'cat', and suddenly the line performs externablyexternally observable behavior, i.e., removing the file.

The user may have compiled a version of 'cat'cat that goes into an infinite loop, thus the shell cannot assume that it is 'known to terminate' as you suggest.

Someone may have installed a version of 'cat' that works as intended, but with an extra side effect of installing a rootkit if it's ever run with adequate privileges - again, the shell should duly execute it.

When seeing "cat hugeregularfile.txt > /dev/null", the shell is not allowed to believe that the action is useless - 'cat' is not part of the shell and could do anything at all in theory, and also in practice.

For example, the user may have renamed the executable 'rm' to 'cat', and suddenly the line performs externably observable behavior, i.e., removing the file.

The user may have compiled a version of 'cat' that goes into an infinite loop, thus the shell cannot assume that it is 'known to terminate' as you suggest.

Someone may have installed a version of 'cat' that works as intended, but with an extra side effect of installing a rootkit if it's ever run with adequate privileges - again, the shell should duly execute it.

When seeing cat hugeregularfile.txt > /dev/null, the shell is not allowed to believe that the action is useless cat is not part of the shell and could do anything at all in theory, and also in practice.

For example, the user may have renamed the executable rm to cat', and suddenly the line performs externally observable behavior, i.e., removing the file.

The user may have compiled a version of cat that goes into an infinite loop, thus the shell cannot assume that it is 'known to terminate' as you suggest.

Someone may have installed a version of 'cat' that works as intended, but with an extra side effect of installing a rootkit if it's ever run with adequate privileges again, the shell should duly execute it.

Source Link
Peteris
  • 310
  • 1
  • 6

When seeing "cat hugeregularfile.txt > /dev/null", the shell is not allowed to believe that the action is useless - 'cat' is not part of the shell and could do anything at all in theory, and also in practice.

For example, the user may have renamed the executable 'rm' to 'cat', and suddenly the line performs externably observable behavior, i.e., removing the file.

The user may have compiled a version of 'cat' that goes into an infinite loop, thus the shell cannot assume that it is 'known to terminate' as you suggest.

Someone may have installed a version of 'cat' that works as intended, but with an extra side effect of installing a rootkit if it's ever run with adequate privileges - again, the shell should duly execute it.