Package: busybox / 1:1.22.0-19

ash-in-bash-compat-mode-always-export-SHLVL.diff Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
commit 5680e984516fa1fb3c16862fb747206da0edfbed
Author: Denys Vlasenko <vda.linux@googlemail.com>
Date:   Tue Jan 7 16:12:48 2014 +0100

    ash: in bash compat mode, always export $SHLVL
    
    function                                             old     new   delta
    ash_main                                            1437    1442      +5
    
    Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>

diff --git a/shell/ash.c b/shell/ash.c
index 71ef9a6..04ba447 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -13014,7 +13014,7 @@ init(void)
 		setvar2("PPID", utoa(getppid()));
 #if ENABLE_ASH_BASH_COMPAT
 		p = lookupvar("SHLVL");
-		setvar2("SHLVL", utoa(p ? atoi(p) + 1 : 1));
+		setvar("SHLVL", utoa((p ? atoi(p) : 0) + 1), VEXPORT);
 #endif
 		p = lookupvar("PWD");
 		if (p) {