Using 'local' in a safe way.
authorTails developers <amnesia@boum.org>
Fri, 7 Dec 2012 21:31:36 +0000 (22:31 +0100)
committerDaniel Baumann <daniel@debian.org>
Fri, 7 Dec 2012 21:38:23 +0000 (22:38 +0100)
commit3c177ab4cbf2abc0b88c2d1bf04a7ac05b2822b6
tree5c7ba6e7dc5c038b3c9c43c4c12eb16c79b7a277
parent2026ce02b2cb18461b4f553106a2306b929a205f
Using 'local' in a safe way.

First of all, 'local' is non-POSIX, but it is a really good safeguard
against hard-to-find bugs. However, doing a local + initializing combo
like `local X=$Y` in dash is error prone. If `Y=1 2` will get an error
since dash will expand $Y so we get `local X=1 2`, but it will treat
the "2" as another variable to be made local, which isn't what we
want. Hence, let's declare variables local and initialize them in
separate commands, which is safe.
scripts/boot/9990-misc-helpers.sh
scripts/boot/9990-mount-http.sh
scripts/boot/9990-mount-iscsi.sh
scripts/boot/9990-overlay.sh