Running 'cat' on a directory produces no output.

Project:JNode Core
Component:Code
Category:bug report
Priority:minor
Assigned:Fabien D
Status:closed
Description

I would have expected an error message.

#1

Status:active» closed

#2

It's fixed : for a directory an error message. Moreover, I have added some additional error messages for the user in some other cases (an empty file for example).

#3

I agree with most of the bug fixes in the last checkin for CatCommand. However, I think it is wrong for 'cat' to treat an empty file as a special case. Worse still, the "error" message is actually written to the command's stdout rather than its stderr. Bad.

  1. The change means that I can no longer input an empty file using using 'cat'; e.g. 'cat > my-file' followed by ^D now writes the silly message to 'my-file'!
  2. I cannot imaging a case where the new behavior will be useful when 'cat' is embedded in a script or a pipeline. In most cases, it will be a nuisance.
  3. This new behavior is different to the way POSIX 'cat' behaves. So what? Well, I'm trying to get us to a state where we have a POSIX compatible shell for POSIX compatible scripting.

This kind of "user-friendly" warning about an empty file would be better implemented in a JNode analog for 'more' or 'less'.

Please get rid of the empty file test and error message ASAP.

#4

ok, I have remove the test & message for empty file

#5

Thanks

#6