summaryrefslogtreecommitdiffstats
path: root/meta-initramfs
diff options
context:
space:
mode:
authorHongxu Jia <hongxu.jia@windriver.com>2019-06-20 22:56:09 -0400
committerKhem Raj <raj.khem@gmail.com>2019-06-21 06:22:19 -0700
commit4d45ebe7ad77864bde2cbbadb3c7844aec106164 (patch)
treea2621b2fb5696788462d0fb262d4fcf3d091a5e7 /meta-initramfs
parentb3ae42d56e9a10b0866dfdc21a2aa6be8db8bf05 (diff)
downloadmeta-openembedded-4d45ebe7ad77864bde2cbbadb3c7844aec106164.tar.gz
dracut: fix generated initramfs boot failure under bash 5
If shebang is set to /bin/sh and /bin/sh is a symlink to /bin/bash, bash turn on posix mode. Since bash is upgraded to 5.0, it follows 'IEEE 1003.2 POSIX Shell Standard', to implement 'functions do not have local traps or options, and it is not possible to define local variables' For more detail, see variables.c:push_posix_temp_var in the following commit http://git.savannah.gnu.org/cgit/bash.git/commit/?id=d233b485e83c3a784b803fb894280773f16f2deb The IEEE 1003.2 POSIX Shell Standard: https://www.cs.ait.ac.th/~on/O/oreilly/unix/ksh/appa_02.htm Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-initramfs')
-rw-r--r--meta-initramfs/recipes-devtools/dracut/dracut/0001-set-viriable-_drv-not-local.patch69
-rw-r--r--meta-initramfs/recipes-devtools/dracut/dracut_git.bb1
2 files changed, 70 insertions, 0 deletions
diff --git a/meta-initramfs/recipes-devtools/dracut/dracut/0001-set-viriable-_drv-not-local.patch b/meta-initramfs/recipes-devtools/dracut/dracut/0001-set-viriable-_drv-not-local.patch
new file mode 100644
index 000000000..13d2cfa87
--- /dev/null
+++ b/meta-initramfs/recipes-devtools/dracut/dracut/0001-set-viriable-_drv-not-local.patch
@@ -0,0 +1,69 @@
1From 6e0da103effe64832eea52fad5c44a328f7141b7 Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Thu, 20 Jun 2019 17:31:11 +0800
4Subject: [PATCH] set viriable _drv not local
5
6If shebang is set to /bin/sh and /bin/sh is a symlink to /bin/bash,
7bash turn on posix mode.
8
9Since bash is upgraded to 5.0, it follows 'IEEE 1003.2 POSIX Shell
10Standard', to implement 'functions do not have local traps or options,
11and it is not possible to define local variables'
12
13For more detail, see variables.c:push_posix_temp_var in the following commit
14http://git.savannah.gnu.org/cgit/bash.git/commit/?id=d233b485e83c3a784b803fb894280773f16f2deb
15
16The IEEE 1003.2 POSIX Shell Standard:
17https://www.cs.ait.ac.th/~on/O/oreilly/unix/ksh/appa_02.htm
18
19While /bin/sh points to bash 5.0, it caused the following issue:
20
21$ cat <<ENDOF>case.sh
22fsck_drv_com(){
23 echo "issuing \$_drv"
24}
25
26fsck_able() {
27 _drv="_drv=e2fsck fsck_drv_com"
28}
29
30fsck_single() {
31 local _drv
32 fsck_able
33 eval "\$_drv"
34}
35fsck_single
36ENDOF
37$ chmod a+x case.sh
38
39Unexpected:
40$ ./cash.sh
41issuing _drv=e2fsck fsck_drv_com
42
43Set viriable _drv not local, get expected result:
44$ ./case.sh
45issuing e2fsck
46
47Upstream-Status: Submitted [https://github.com/dracutdevs/dracut/pull/587]
48
49Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
50---
51 modules.d/99fs-lib/fs-lib.sh | 2 +-
52 1 file changed, 1 insertion(+), 1 deletion(-)
53
54diff --git a/modules.d/99fs-lib/fs-lib.sh b/modules.d/99fs-lib/fs-lib.sh
55index d39ca1b..60877ee 100755
56--- a/modules.d/99fs-lib/fs-lib.sh
57+++ b/modules.d/99fs-lib/fs-lib.sh
58@@ -142,7 +142,7 @@ fsck_single() {
59 local _fs="${2:-auto}"
60 local _fsopts="$3"
61 local _fop="$4"
62- local _drv
63+ _drv=""
64
65 [ $# -lt 2 ] && return 255
66 # if UUID= marks more than one device, take only the first one
67--
682.7.4
69
diff --git a/meta-initramfs/recipes-devtools/dracut/dracut_git.bb b/meta-initramfs/recipes-devtools/dracut/dracut_git.bb
index 344dfecbb..13cf5f6de 100644
--- a/meta-initramfs/recipes-devtools/dracut/dracut_git.bb
+++ b/meta-initramfs/recipes-devtools/dracut/dracut_git.bb
@@ -13,6 +13,7 @@ SRCREV = "225e4b94cbdb702cf512490dcd2ad9ca5f5b22c1"
13SRC_URI = "git://git.kernel.org/pub/scm/boot/dracut/dracut.git;protocol=http \ 13SRC_URI = "git://git.kernel.org/pub/scm/boot/dracut/dracut.git;protocol=http \
14 file://0001-util.h-include-sys-reg.h-when-libc-glibc.patch \ 14 file://0001-util.h-include-sys-reg.h-when-libc-glibc.patch \
15 file://0001-dracut.sh-improve-udevdir.patch \ 15 file://0001-dracut.sh-improve-udevdir.patch \
16 file://0001-set-viriable-_drv-not-local.patch \
16 " 17 "
17 18
18DEPENDS += "kmod" 19DEPENDS += "kmod"