https://bugzilla.wikimedia.org/show_bug.cgi?id=50347
Web browser: ---
Bug ID: 50347
Summary: mw-update-l10n failure does not abort scap
Product: Wikimedia
Version: wmf-deployment
Hardware: All
OS: All
Status: NEW
Severity: major
Priority: Unprioritized
Component: General/Unknown
Assignee: [email protected]
Reporter: [email protected]
Classification: Unclassified
Mobile Platform: ---
mw-update-l10n wraps the l10n cache update in parentheses, causing it to run in
a sub-shell.
The first problem is that 'set -e' doesn't work predictably in sub-shells. Its
precise behavior is documented here:
<http://fvue.nl/wiki/Bash:_Error_handling#Caveat_1:_.60Exit_on_error.27_ignoring_subshell_exit_status>.
The second problem is that the exit status of the sub-shell is ||'d with a call
to 'echo' to emit an error message. Because echo typically returns success, the
exit status of mw-update-l10n is always success, and so l10n failures do not
reach scap.
A good solution is for the parent shell to explicitly check the exit status of
any important command it invokes.
This pattern works well:
some_command || {
st="$?"
echo "some_command failed"
exit $st
}
It can be neatly encapsulated in a bash function, as shown in
<http://mywiki.wooledge.org/BashFAQ/101>.
--
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l