Subject: bin/11542: ksh/sh -e bug in for loops
To: None <gnats-bugs@gnats.netbsd.org>
From: None <danw@helixcode.com>
List: netbsd-bugs
Date: 11/21/2000 12:18:14
>Number:         11542
>Category:       bin
>Synopsis:       ksh/sh -e bug in for loops
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Nov 21 12:18:00 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     Dan Winship
>Release:        current
>Organization:
>Environment:
	
System: NetBSD twelve-monkeys.helixcode.com 1.4X NetBSD 1.4X (MONKEY) #1: Thu Jun 1 10:59:26 EDT 2000 root@twelve-monkeys.helixcode.com:/usr/src/sys/arch/i386/compile/MONKEY i386


>Description:
	A shell running with "-e" will exit if a command in an && list
	inside a for loop fails. (It behaves correctly inside a while
	loop, or outside of a loop.)
>How-To-Repeat:
% cat foo.sh
set -e

for x in 1; do
    false && true
done
echo "reached end"

% sh foo.sh
% ksh foo.sh
% bash foo.sh
reached end
% 

>Fix:
	I looked at the code (sh/eval.c), got some ideas about
	possible fixes, then looked at the CVS log and decided to run
	away.
>Release-Note:
>Audit-Trail:
>Unformatted: