From 04ba4610455d53e6a578b65c833c2d11320e1d80 Mon Sep 17 00:00:00 2001 From: Rusty Bird Date: Thu, 30 Apr 2015 03:25:14 +0000 Subject: [PATCH] Fix ask_for_password bug breaking bash without plymouth If crypt-lib.sh is sourced from any #!/bin/sh script, a POSIX shell quirk is in effect that causes variable assignments to "special builtins" (such as "shift") to leak to their context. So the buggy code works even despite the missing semicolons. But if it is sourced by "bash acting under its own name", i.e. from any #!/bin/bash script, the quirk is disabled, tty_cmd/tty_prompt are undefined, and ask_for_password doesn't do anything if plymouth is not present. --- modules.d/90crypt/crypt-lib.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules.d/90crypt/crypt-lib.sh b/modules.d/90crypt/crypt-lib.sh index 3f12ea0f..4e980109 100755 --- a/modules.d/90crypt/crypt-lib.sh +++ b/modules.d/90crypt/crypt-lib.sh @@ -42,10 +42,10 @@ ask_for_password() { while [ $# -gt 0 ]; do case "$1" in - --cmd) ply_cmd="$2"; tty_cmd="$2" shift;; + --cmd) ply_cmd="$2"; tty_cmd="$2"; shift;; --ply-cmd) ply_cmd="$2"; shift;; --tty-cmd) tty_cmd="$2"; shift;; - --prompt) ply_prompt="$2"; tty_prompt="$2" shift;; + --prompt) ply_prompt="$2"; tty_prompt="$2"; shift;; --ply-prompt) ply_prompt="$2"; shift;; --tty-prompt) tty_prompt="$2"; shift;; --tries) ply_tries="$2"; tty_tries="$2"; shift;;