blue-build / modules

BlueBuild standard modules used for building your Atomic Images
Apache License 2.0
23 stars 25 forks source link

fix: Fix flag ordering in `set` calls in scripts #99

Closed nesv closed 6 months ago

nesv commented 6 months ago

The README for scripts has an incorrect use of the set. Where it says to use:

set -oue pipefail

it should be:

set -euo pipefail

since pipefail is an option consumed by set -o.

More information: https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html

I went ahead and did a repo-wide sed(1) call to change all instances of set -oue pipefail to set -euo pipefail.

xynydev commented 6 months ago

Hmm, it's been like this for a long time, and it was someone other than me (I'm not a native speaker of bash) that brought this in. I'll merge anyways. Startingpoint has the same issue, at least in the modules/README.md

nesv commented 6 months ago

@xynydev I appreciate you taking the time to look at this!

The misplaced -o pipefail is something I see pretty routinely in scripts. It's not the end of the world, but it does result in dashed expectations when a pipe fails, and the error message doesn't make sense.

Oddly enough, tools like github.com/koalaman/shellcheck don't seem to catch this.