From d88c6b27847cfb6d2e02b9178df93eba8f67a461 Mon Sep 17 00:00:00 2001 From: jilles Date: Sun, 14 Mar 2010 14:24:35 +0000 Subject: sh: Do not abort on a redirection error on a compound command. Redirection errors on subshells already did not abort the shell because the redirection is executed in the subshell. Other shells seem to agree that these redirection errors should not abort the shell. Also ensure that the redirections will be cleaned up properly in cases like command eval '{ shift x; } 2>/dev/null' Example: { echo bad; } /dev/null; } >/dev/null; echo hi)" = hi' + +exit $((failures > 0)) diff --git a/tools/regression/bin/sh/errors/redirection-error6.0 b/tools/regression/bin/sh/errors/redirection-error6.0 new file mode 100644 index 0000000..17d1109 --- /dev/null +++ b/tools/regression/bin/sh/errors/redirection-error6.0 @@ -0,0 +1,12 @@ +# $FreeBSD$ +# A redirection error on a compound command should not abort the shell. +exec 2>/dev/null +{ echo bad; }