Steven W. Orr wrote:
I think there's a fundamental misunderstanding between the difference of
an error code returned by a system call and the exit status of a
process. They're two completely different things.
----
It's not a fundamental misunderstanding. It's a fundamental belief
in using data bandwidth and not wasting it. If 0=ok, as it does in bash and
with errno, and, it is the case (still is), that errno's fit in 1 byte,
there's no reason not to return the exact failure mode from a util...
That's not to say that many or most do -- some even return a status
of '0' on fatal errors (xfs_mkfile -- on running out of room returns a status
0).
Just for fun, look at the man page for grep. It is advertised to return
a 0, 1 or 2. The actual values of errno that might happen in the middle
are a separate problem.
----
Like I said, it's a fundamental waste of bits.
But -- if it encountered an error, should it issue a SEGV and coredump
message,
or should it terminate the wayward script/function and return to the prompt?
Hey you can do whatever, but if the linux kernel crashed on every resource
strain, most people would consider that bad.