[Bug 3547] shell read is maybe too safe

Rich Felker dalias at aerifal.cx
Tue May 10 13:11:44 UTC 2011

On Mon, May 09, 2011 at 03:28:15PM +0200, Harald Becker wrote:
> After check: Newer versions of bash doesn't seem to have a fd limit.
> Allows values up to 1023 ... don't know if there is another type of
> internal fd protection instead. Did anybody ever use such high fd
> numbers on shell command lines or in scripts?

As a motivation for not arbitrarily prohibiting use of certain fds,
one technique I've used when debugging deep internal libc stuff is
putting dprintf(888, ...) or similar in the functions for which I need
to log/trace behavior. This usually does nothing except clobbering
errno and wasting some time, but allows me to get the output when I
need it by writing 888>log or 888>&2. Of course the technique would
break if the shell happened not to support the fd I had chosen, and
hunting down the cause for why I was not getting output would be
hellish. I'm sure I'd have been mad if this happened and I found out
after hours of debugging that a lazy shell implementation was at
fault. :-)


More information about the busybox mailing list