diff options
author | Benjamin Drung <benjamin.drung@cloud.ionos.com> | 2018-12-10 16:49:33 +0100 |
---|---|---|
committer | Benjamin Drung <benjamin.drung@cloud.ionos.com> | 2018-12-10 16:49:33 +0100 |
commit | 806c757439a1627e2ca97ca8f5e1eff81abeb52a (patch) | |
tree | fb27725fc6561e6cacd975ada7c8bae9e259e088 | |
parent | f8dc441ab13c84d0efbdfe66ff7fff412832e77f (diff) |
scripts/functions: Fix syntax error: unexpected "(" on panic
When the IFS is set (e.g. to ",") the reading of /proc/consoles might
not correctly split the line into `console` and `rest`. Running
```
IFS=","
panic "error message"
```
will show:
```
Spawning shell within the initramfs as requested
sh: syntax error: unexpected "("
```
Therefore explicitly unset IFS in the panic function.
Signed-off-by: Benjamin Drung <benjamin.drung@cloud.ionos.com>
-rw-r--r-- | scripts/functions | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/scripts/functions b/scripts/functions index 7c6f8aa..aeccb85 100644 --- a/scripts/functions +++ b/scripts/functions @@ -33,7 +33,7 @@ log_end_msg() panic() { - local console rest + local console rest IFS if command -v chvt >/dev/null 2>&1; then chvt 1 @@ -53,6 +53,7 @@ panic() # Try to use setsid, which will enable job control in the shell # and paging in more if command -v setsid >/dev/null 2>&1; then + unset IFS read console rest </proc/consoles if [ "${console}" = "tty0" ]; then # Need to choose a specific VT |