]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
dracut [PATCH] Parameter expansion occurs before command evaluation.
authorJohn Reiser <jreiser@bitwagon.com>
Fri, 23 Sep 2011 15:02:23 +0000 (08:02 -0700)
committerHarald Hoyer <harald@redhat.com>
Fri, 30 Sep 2011 07:40:49 +0000 (09:40 +0200)
Bash shell expands all ${parameter} before evaluating a command.
For multiple declarations and assignments within the same 'local' command,
then new variables or new values that appear towards the left
do not affect parameter expansion towards the right.

--
John Reiser, jreiser@BitWagon.com

>From 507ad6f66fc66f868a9e5fdd3806e012c4022baa Mon Sep 17 00:00:00 2001
From: John Reiser <jreiser@BitWagon.com>
Date: Fri, 23 Sep 2011 07:37:43 -0700
Subject: [PATCH] Parameter expansion occurs before command evaluation.

${parameter} on the right is expanded before evaluating "local var=value"
on the left.

dracut-functions

index 550880975630a32296b28c9bb784d1f53e96efe7..c4f7f615814ba6420ba5396b3cbabc52b8e7cb3b 100755 (executable)
@@ -272,7 +272,7 @@ check_vol_slaves() {
 inst_dir() {
     [[ -e ${initdir}"$1" ]] && return 0  # already there
 
-    local _dir="$1" _part=${_dir%/*} _file
+    local _dir="$1" _part="${1%/*}" _file
     while [[ "$_part" != "${_part%/*}" ]] && ! [[ -e "${initdir}${_part}" ]]; do
         _dir="$_part $_dir"
         _part=${_part%/*}