Jilles Tjoelker <jil...@stack.nl> wrote:
> On Wed, Oct 27, 2010 at 03:33:41PM -0600, Eric Blake wrote:
>> Dash does not behave well when under artificial fd pressure due to
>> ulimit -n.  It insists on copying a to-be-closed fd to another fd
>> greater than 10, then complains when the dup fails, rather than just
>> flat-out closing the fd in the first place.  Compare this with ksh93
> 
>> $ ksh -c 'ulimit -n 10; : <&-'; echo $?
>> 0
>> $ dash -c 'ulimit -n 11; : <&-'; echo $?
>> 0
>> $ dash -c 'ulimit -n 10; : <&-'; echo $?
>> dash: 0: Invalid argument
>> 2
> 
>> See this thread on the bug-tar list for more details:
>> http://thread.gmane.org/gmane.comp.gnu.tar.bugs/4010/focus=4020
> 
> Summary: use 'exec' to close the file descriptors before setting ulimit
> -n ridiculously low instead of relying on redirections to work in such a
> restricted environment.

Thanks for the excellent analysis Jilles! I agree with you on
all counts :)
-- 
Email: Herbert Xu <herb...@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to