archlinux-repro icon indicating copy to clipboard operation
archlinux-repro copied to clipboard

shellcheck issues suppressed that shouldn't have been

Open coderobe opened this issue 6 years ago • 0 comments

https://github.com/archlinux/archlinux-repro/blob/a1dc7bd95f68764b08a37c309b69432129660317/repro.in#L57

https://github.com/archlinux/archlinux-repro/blob/a1dc7bd95f68764b08a37c309b69432129660317/repro.in#L64

https://github.com/archlinux/archlinux-repro/blob/a1dc7bd95f68764b08a37c309b69432129660317/repro.in#L71

https://github.com/archlinux/archlinux-repro/blob/a1dc7bd95f68764b08a37c309b69432129660317/repro.in#L78

These are valid semantic errors that can lead to printf doing the wrong thing when the variables used contain format strings. As it stands though, this behavior is expected for one of the variables used here.

I'd probably nest the printfs - one for the mesg formatting, and one for the rest. Just in case some future terminal with more in-band signaling ends up using % in their escape sequences ;)

Alternatively, consider something like "%s ... ${mesg}" "${BOLD}" ... and whatnot, where everything but mesg is separated into printf formatting


https://github.com/archlinux/archlinux-repro/blob/a1dc7bd95f68764b08a37c309b69432129660317/repro.in#L115-L118

This is also a valid issue. As it currently stands it looks like you may have intended for the quotes to end up in the args as literals, but right now they're all interpreted by your shell. The entire arg should be wrapped in quotes.


https://github.com/archlinux/archlinux-repro/blob/a1dc7bd95f68764b08a37c309b69432129660317/repro.in#L259-L260

Should be "${packages[@]}" instead of ${packages[*]}. What it's currently doing is basically "join all the arguments by the first character of IFS (space), split them by IFS and expand each of them as globs, and use those as args for the commandline you're building"


https://github.com/archlinux/archlinux-repro/blob/a1dc7bd95f68764b08a37c309b69432129660317/repro.in#L319-L328

$home is not a thing, you probably wanted $HOME

coderobe avatar Dec 09 '18 18:12 coderobe