<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Aug 12, 2015 at 9:56 AM, Khem Raj <span dir="ltr"><<a href="mailto:raj.khem@gmail.com" target="_blank">raj.khem@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Wed, Aug 12, 2015 at 2:49 AM, <<a href="mailto:Mikko.Rapeli@bmw.de">Mikko.Rapeli@bmw.de</a>> wrote:<br>
> This reminded me of the problems I've seen with various oe-core shell scripts:<br>
> they are missing systematic error handling.<br>
><br>
> IMO using bash and 'set -euxo pipefail' are a good approach to catch errors<br>
> early in shell scripts. Manually checking for $? is error prone and things<br>
> like pipes can hide them. Using undefined variables is another thing<br>
> which should fail early before things go horribly wrong. And in build automation<br>
> I'd rather see output of -x since things can fail in mysterious ways.<br>
> And then there's quoting....<br>
><br>
> One useful guide is to use shellcheck as static analysis tool for shell scripts.<br>
><br>
> I guess internally <span class="il">bitbake</span> uses at least set -e.<br>
><br>
> Comments?<br>
<br>
</span>all these are good suggestions, I would recommend to open bugs for all<br>
of these some of them might need<br>
to cite the scripts which need fixing.</blockquote></div><br>Agreed, it's important to check the behavior of shell scripts is kosher and standards-compliant. shellcheck is extremely useful, I recommend it as well, but combined with the vim syntastic plugin, so every time you save the file all the errors and warnings are identified :) Makes it harder to ignore or forget about.<br>-- <br><div class="gmail_signature">Christopher Larson<br>clarson at kergoth dot com<br>Founder - BitBake, OpenEmbedded, OpenZaurus<br>Maintainer - Tslib<br>Senior Software Engineer, Mentor Graphics</div>
</div></div>