Bug 9311 - shell case statement resets exit status too early
Summary: shell case statement resets exit status too early
Status: RESOLVED FIXED
Alias: None
Product: Busybox
Classification: Unclassified
Component: Standard Compliance (show other bugs)
Version: 1.24.x
Hardware: All Linux
: P5 minor
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-27 14:30 UTC by nicolas.cavallari
Modified: 2016-09-28 17:46 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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!