Skip to contentSkip to conversation

bash: disable bash malloc by default

PATCH New Daniel Sabogal 3 participants 3 messages May 23, 2017 – Jun 1, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bash: disable bash malloc by default

Bash's malloc relies on sbrk which is implemented as a fail-only stub in musl. Presently, it is disabled when configured for static libs. Instead, default to using libc malloc.

Fixes:

# bash
bash: xmalloc: locale.c:81: cannot allocate 18 bytes (0 bytes allocated)
---
 package/bash/bash.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
package/bash/bash.mk +2 -2
index 639f01204..32c87a659 100644
@@ -9,7 +9,7 @@ BASH_SITE = $(BR2_GNU_MIRROR)/bash
 # Build after since bash is better than busybox shells
 BASH_DEPENDENCIES = ncurses readline host-bison \
 	$(if $(BR2_PACKAGE_BUSYBOX),busybox)
-BASH_CONF_OPTS = --with-installed-readline
+BASH_CONF_OPTS = --with-installed-readline --without-bash-malloc
 BASH_LICENSE = GPL-3.0+
 BASH_LICENSE_FILES = COPYING
 
@@ -24,7 +24,7 @@ BASH_CONF_ENV += \
 
 # The static build needs some trickery
 ifeq ($(BR2_STATIC_LIBS),y)
-BASH_CONF_OPTS += --enable-static-link --without-bash-malloc
+BASH_CONF_OPTS += --enable-static-link
 # bash wants to redefine the getenv() function. To check whether this is
 # possible, AC_TRY_RUN is used which is not possible in
 # cross-compilation.
Signature · 1 line
2.13.0
#1 lore raw

PATCH 1/1 bash: disable bash malloc by default

Hello,

Quoted 5 lines · Daniel Sabogal

Bash's malloc relies on sbrk which is implemented as a fail-only stub in musl. Presently, it is disabled when configured for static libs. Instead, default to using libc malloc.

Quoted 8 lines

Fixes:

# bash
bash: xmalloc: locale.c:81: cannot allocate 18 bytes (0 bytes allocated)
---
 package/bash/bash.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Applied to master, thanks. Peter: I believe this can be applied on 2017.02.x as well.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#2 lore raw

PATCH 1/1 bash: disable bash malloc by default

Quoted 13 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Hello,

Quoted 9 lines · Daniel Sabogal

Bash's malloc relies on sbrk which is implemented as a fail-only stub in musl. Presently, it is disabled when configured for static libs. Instead, default to using libc malloc.

Fixes:

# bash
bash: xmalloc: locale.c:81: cannot allocate 18 bytes (0 bytes allocated)
Quoted 7 lines
Quoted 4 lines

---
package/bash/bash.mk | 4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)

Applied to master, thanks. Peter: I believe this can be applied on 2017.02.x as well.

Indeed - Committed to 2017.02.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard