Bug 9311

Summary: shell case statement resets exit status too early
Product: Busybox Reporter: nicolas.cavallari
Component: Standard ComplianceAssignee: unassigned
Status: RESOLVED FIXED    
Severity: minor CC: busybox-cvs
Priority: P5    
Version: 1.24.x   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: Target:
Build:

Description nicolas.cavallari 2016-09-27 14:30:45 UTC
This code:

false || case a in a) echo $?;; esac

outputs 0 when run by busybox ash.  Bash outputs 1 as expected.

dash has received a fix for this recently.  Maybe the same solution (having eval function return their exit status) would solve the problem:

https://git.kernel.org/cgit/utils/dash/dash.git/commit/?id=da534b740e628512e8e0e62729d6a2ef521e5096
Comment 1 Denys Vlasenko 2016-09-28 17:46:51 UTC
Fixed in git, thanks!