dracut/0182-fix-include-parsing.patch
Thomas Renninger 406d64cbdb Accepting request 333153 from home:favogt:branches:Base:System
- Fix 0182-fix-include-parsing.patch
- Didn't parse arguments with spaces correctly

- Add patch 0183-fix_add_drivers_hang.patch:
   - Fix possible hang in dracut
     caused by add_drivers+=" " in dracut.conf

OBS-URL: https://build.opensuse.org/request/show/333153
OBS-URL: https://build.opensuse.org/package/show/Base:System/dracut?expand=0&rev=230
2015-09-23 12:25:24 +00:00

42 lines
1.3 KiB
Diff

From 11d6560d7bbd8a4c4610a39c0985e50d728920fb Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fvogt@suse.com>
Date: Mon, 21 Sep 2015 15:15:07 +0200
Subject: [PATCH] Fix parsing of "-i" and "--include"
- dracut replaced every instance of "-i" in the cmdline,
even if it was part of a kernel image name, e.g. "vmlinuz-i"
- Fixes boo#908452
Signed-off-by: Fabian Vogt <fvogt@suse.com>
---
dracut.sh | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
Index: dracut-043/dracut.sh
===================================================================
--- dracut-043.orig/dracut.sh
+++ dracut-043/dracut.sh
@@ -310,11 +310,17 @@ dropindirs_sort()
rearrange_params()
{
# Workaround -i, --include taking 2 arguments
- set -- "${@/--include/++include}"
-
- # This prevents any long argument ending with "-i"
- # -i, like --opt-i but I think we can just prevent that
- set -- "${@/%-i/++include}"
+ newat=()
+ for i in "$@"; do
+ if [[ $i =~ ^-i(.*) ]]; then
+ newat+=("++include" "${BASH_REMATCH[1]}") # Replace -i by ++include
+ elif [[ $i == "--include" ]]; then
+ newat+=("++include") # Replace --include by ++include
+ else
+ newat+=("$i")
+ fi
+ done
+ set -- "${newat[@]}" # Set new $@
TEMP=$(unset POSIXLY_CORRECT; getopt \
-o "a:m:o:d:I:k:c:L:fvqlHhMN" \