package/bash: use --bindir instead of exec_prefix=
PATCH 1/3 package/bash: use --bindir instead of exec_prefix=
We want bash to be installed as /bin/bash. For ages, Buildroot has been doing this by overriding exec_prefix at install time. First of all, it would be preferred to do this at configure time. But also, overriding exec_prefix not only changes where "bash" goes, but also where the pkgconfig file goes. Due to this, bash.pc goes into /lib/pkgconfig/, and doesn't get removed by target-finalize.
Since all we want is to have 'bash' as /bin/bash, simply pass --bindir=/bin at configure time. This allows to use the default target installation logic for autotools-package. We keep a post-install target hook to remove /bin/bashbug.
--- package/bash/bash.mk | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
package/bash/bash.mk +8 -4
@@ -7,11 +7,16 @@ BASH_VERSION = 5.1 BASH_SITE = $(BR2_GNU_MIRROR)/bash BASH_DEPENDENCIES = ncurses readline host-bison -BASH_CONF_OPTS = --with-installed-readline --without-bash-malloc BASH_LICENSE = GPL-3.0+ BASH_LICENSE_FILES = COPYING BASH_CPE_ID_VENDOR = gnu +# We want the bash binary in /bin +BASH_CONF_OPTS = \ + --bindir=/bin \ + --with-installed-readline \ + --without-bash-malloc + BASH_CONF_ENV += \ ac_cv_rl_prefix="$(STAGING_DIR)" \ ac_cv_rl_version="$(READLINE_VERSION)" \
@@ -38,11 +43,10 @@ BASH_CONF_ENV += bash_cv_getenv_redef=yes endif endif -define BASH_INSTALL_TARGET_CMDS - $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \ - DESTDIR=$(TARGET_DIR) exec_prefix=/ install +define BASH_REMOVE_UNUSED_FILES rm -f $(TARGET_DIR)/bin/bashbug endef +BASH_POST_INSTALL_TARGET_HOOKS += BASH_REMOVE_UNUSED_FILES # Add /bin/bash to /etc/shells otherwise some login tools like dropbear # can reject the user connection. See man shells.
Signature · 1 line
2.30.2
PATCH 2/3 package/bash: add option to keep or remove loadable examples
bash has a concept of "loadables", which are "plugins" that can be loaded at runtime by bash to add new builtin. For example:
whoami is /usr/bin/whoami
root
whoami is a shell builtin
root
bash comes with a set of example loadables, installed in /usr/lib/bash/. They take 312 KB on ARM32, and are by default not used, and provide builtins that are for the most part already available as external commands in Busybox/coreutils:
Makefile.inc finfo mkfifo realpath sync accept head mktemp rm tee basename id mypid rmdir truefalse csv ln pathchk seq tty cut loadables.h print setpgid uname dirname logname printenv sleep unlink fdflags mkdir push strftime whoami
So instead of having them unconditionally installed, add an option to enable/disable their installation (their build apparently cannot be disabled via a configure option).
Normally, we try to keep backward compatibility by preserving the existing behavior. In this case, this would have meant making this option "default y". But this also breaks our principle of "being minimal by default", and in this case, it feels preferable to be "minimal by default" than preserving existing behavior.
--- package/bash/Config.in | 14 ++++++++++++++ package/bash/bash.mk | 13 +++++++++++++ 2 files changed, 27 insertions(+)
package/bash/Config.in +14 -0
@@ -9,3 +9,17 @@ config BR2_PACKAGE_BASH The standard GNU Bourne again shell. http://tiswww.case.edu/php/chet/bash/bashtop.html + +if BR2_PACKAGE_BASH + +config BR2_PACKAGE_BASH_LOADABLE_EXAMPLES + bool "loadable examples" + depends on !BR2_STATIC_LIBS + help + This option will enable the installation of the "loadable" + examples, which are dynamically loadable extension providing + additional built-ins commands to bash. There are typically + not needed as they are provided as regular, external + commands. + +endif
package/bash/bash.mk +13 -0
@@ -48,6 +48,19 @@ define BASH_REMOVE_UNUSED_FILES endef BASH_POST_INSTALL_TARGET_HOOKS += BASH_REMOVE_UNUSED_FILES +ifeq ($(BR2_PACKAGE_BASH_LOADABLE_EXAMPLES),y) +define BASH_REMOVE_LOADABLE_UNUSED_FILES + rm -f $(TARGET_DIR)/usr/lib/bash/Makefile.inc + rm -f $(TARGET_DIR)/usr/lib/bash/loadables.h +endef +BASH_POST_INSTALL_TARGET_HOOKS += BASH_REMOVE_LOADABLE_UNUSED_FILES +else +define BASH_REMOVE_LOADABLE_EXAMPLES + rm -rf $(TARGET_DIR)/usr/lib/bash +endef +BASH_POST_INSTALL_TARGET_HOOKS += BASH_REMOVE_LOADABLE_EXAMPLES +endif + # Add /bin/bash to /etc/shells otherwise some login tools like dropbear # can reject the user connection. See man shells. define BASH_ADD_MKSH_TO_SHELLS
Signature · 1 line
2.30.2
Yann E. MORIN
AppliedPATCH 2/3 package/bash: add option to keep or remove loadable examples
Thomas, All,
On 2021-04-23 22:23 +0200, Thomas Petazzoni spake thusly:
Quoted 7 lines
bash has a concept of "loadables", which are "plugins" that can be loaded at runtime by bash to add new builtin. For example:
whoami is
/usr/bin/whoami
root
whoami is a shell builtin
root
I was not sure what you meant with those examples, so I've rewritten that part with a capture of a session enabling and disabling whoami as a shell builtin.
Quoted 17 lines
bash comes with a set of example loadables, installed in
/usr/lib/bash/. They take 312 KB on ARM32, and are by default not used, and provide builtins that are for the most part already available as external commands in Busybox/coreutils:Makefile.inc finfo mkfifo realpath sync accept head mktemp rm tee basename id mypid rmdir truefalse csv ln pathchk seq tty cut loadables.h print setpgid uname dirname logname printenv sleep unlink fdflags mkdir push strftime whoamiSo instead of having them unconditionally installed, add an option to enable/disable their installation (their build apparently cannot be disabled via a configure option).
Quoted 8 lines
Normally, we try to keep backward compatibility by preserving the existing behavior. In this case, this would have meant making this option "default y". But this also breaks our principle of "being minimal by default", and in this case, it feels preferable to be "minimal by default" than preserving existing behavior.
Signed-off-by Thomas Petazzoni <[email protected]>Cc Nicolas Cavallari <[email protected]>
Applied to master, thanks.
Regards,
Yann E. MORIN.
Quoted 58 lines
--- package/bash/Config.in | 14 ++++++++++++++ package/bash/bash.mk | 13 +++++++++++++ 2 files changed, 27 insertions(+)package/bash/Config.in +14
-0@@ -9,3 +9,17 @@ config BR2_PACKAGE_BASH The standard GNU Bourne again shell. http://tiswww.case.edu/php/chet/bash/bashtop.html + +if BR2_PACKAGE_BASH + +config BR2_PACKAGE_BASH_LOADABLE_EXAMPLES + bool "loadable examples" + depends on !BR2_STATIC_LIBS + help + This option will enable the installation of the "loadable" + examples, which are dynamically loadable extension providing + additional built-ins commands to bash. There are typically + not needed as they are provided as regular, external + commands. + +endifpackage/bash/bash.mk +13
-0@@ -48,6 +48,19 @@ define BASH_REMOVE_UNUSED_FILES endef BASH_POST_INSTALL_TARGET_HOOKS += BASH_REMOVE_UNUSED_FILES +ifeq ($(BR2_PACKAGE_BASH_LOADABLE_EXAMPLES),y) +define BASH_REMOVE_LOADABLE_UNUSED_FILES + rm -f $(TARGET_DIR)/usr/lib/bash/Makefile.inc + rm -f $(TARGET_DIR)/usr/lib/bash/loadables.h +endef +BASH_POST_INSTALL_TARGET_HOOKS += BASH_REMOVE_LOADABLE_UNUSED_FILES +else +define BASH_REMOVE_LOADABLE_EXAMPLES + rm -rf $(TARGET_DIR)/usr/lib/bash +endef +BASH_POST_INSTALL_TARGET_HOOKS += BASH_REMOVE_LOADABLE_EXAMPLES +endif + # Add /bin/bash to /etc/shells otherwise some login tools like dropbear # can reject the user connection. See man shells. define BASH_ADD_MKSH_TO_SHELLSSignature · 6 lines
2.30.2 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 2/3 package/bash: add option to keep or remove loadable examples
Hello,
Quoted 8 lines · On Sat, 24 Apr 2021 09:47:31 +0200 "Yann E. MORIN" <[email protected]>…
Quoted 4 lines
whoami is
/usr/bin/whoami
root
whoami is a shell builtin
rootI was not sure what you meant with those examples, so I've rewritten that part with a capture of a session enabling and disabling whoami as a shell builtin.
Gah, the commands went away, as they were prefix with my "#" shell prompt :-/
This whole thing should have been:
# type whoami whoami is /usr/bin/whoami # whoami root # enable -f /usr/lib/bash/whoami whoami # type whoami whoami is a shell builtin # whoami root
Except that all lines starting with a # got eaten by Git :-/
Sorry about that, and thanks for applying the patches.
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 3/3 package/bash: drop SHOBJ_STATUS from BASH_CONF_ENV
In reply to Thomas PetazzoniSHOBJ_STATUS=unsupported was added in commit 4a2af11cba83ef176672609dd7321712fa7f6a28 to work around a limitation of the configure script that forgot to set this variable in static-linking configurations.
It turns out that this issue has been fixed upstream as of bash 5.0:
(see hunk @@ -1151,6 +1179,9 @@)
--- package/bash/bash.mk | 1 - 1 file changed, 1 deletion(-)
package/bash/bash.mk +0 -1
@@ -29,7 +29,6 @@ BASH_CONF_ENV += \ # The static build needs some trickery ifeq ($(BR2_STATIC_LIBS),y) BASH_CONF_OPTS += --enable-static-link -BASH_CONF_ENV += SHOBJ_STATUS=unsupported # 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.30.2
Yann E. MORIN
AppliedPATCH 3/3 package/bash: drop SHOBJ_STATUS from BASH_CONF_ENV
Thomas, All,
On 2021-04-23 22:23 +0200, Thomas Petazzoni spake thusly:
Quoted 5 lines
SHOBJ_STATUS=unsupported was added in commit
4a2af11cba83ef176672609dd7321712fa7f6a28to work around a limitation of the configure script that forgot to set this variable in static-linking configurations.
Quoted 8 lines
It turns out that this issue has been fixed upstream as of bash 5.0:
(see hunk @@ -1151,6 +1179,9 @@)
Signed-off-by Thomas Petazzoni <[email protected]>Cc Baruch Siach <[email protected]>
Applied to master, thanks.
Regards,
Yann E. MORIN.
Quoted 23 lines
--- package/bash/bash.mk | 1 - 1 file changed, 1 deletion(-)package/bash/bash.mk +0
-1@@ -29,7 +29,6 @@ BASH_CONF_ENV += \ # The static build needs some trickery ifeq ($(BR2_STATIC_LIBS),y) BASH_CONF_OPTS += --enable-static-link -BASH_CONF_ENV += SHOBJ_STATUS=unsupported # 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 · 6 lines
2.30.2 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 3/3 package/bash: drop SHOBJ_STATUS from BASH_CONF_ENV
In reply to Thomas PetazzoniQuoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Thomas" == Thomas Petazzoni <[email protected]> writes:
SHOBJ_STATUS=unsupported was added in commit
4a2af11cba83ef176672609dd7321712fa7f6a28to work around a limitation of the configure script that forgot to set this variable in static-linking configurations.
Quoted 8 lines
It turns out that this issue has been fixed upstream as of bash 5.0:
(see hunk @@ -1151,6 +1179,9 @@)
Signed-off-by Thomas Petazzoni <[email protected]>Cc Baruch Siach <[email protected]>
Committed to 2021.02.x, thanks.
Signature · 1 line
Bye, Peter Korsgaard
Yann E. MORIN
AppliedPATCH 1/3 package/bash: use --bindir instead of exec_prefix=
In reply to Thomas PetazzoniThomas, All,
On 2021-04-23 22:23 +0200, Thomas Petazzoni spake thusly:
Quoted 7 lines
We want bash to be installed as
/bin/bash. For ages, Buildroot has been doing this by overridingexec_prefixat install time. First of all, it would be preferred to do this at configure time. But also, overridingexec_prefixnot only changes where "bash" goes, but also where the pkgconfig file goes. Due to this, bash.pc goes into/lib/pkgconfig/, and doesn't get removed by target-finalize.
Quoted 7 lines
Since all we want is to have 'bash' as
/bin/bash, simply pass --bindir=/bin at configure time. This allows to use the default target installation logic for autotools-package. We keep a post-install target hook to remove/bin/bashbug.Signed-off-by Thomas Petazzoni <[email protected]>Cc Nicolas Cavallari <[email protected]>
Applied to master, thanks.
Regards,
Yann E. MORIN.
Quoted 47 lines
--- package/bash/bash.mk | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)package/bash/bash.mk +8
-4@@ -7,11 +7,16 @@ BASH_VERSION = 5.1 BASH_SITE = $(BR2_GNU_MIRROR)/bash BASH_DEPENDENCIES = ncurses readline host-bison -BASH_CONF_OPTS = --with-installed-readline --without-bash-malloc BASH_LICENSE = GPL-3.0+ BASH_LICENSE_FILES = COPYING BASH_CPE_ID_VENDOR = gnu +# We want the bash binary in /bin +BASH_CONF_OPTS = \ + --bindir=/bin \ + --with-installed-readline \ + --without-bash-malloc + BASH_CONF_ENV += \ ac_cv_rl_prefix="$(STAGING_DIR)" \ ac_cv_rl_version="$(READLINE_VERSION)" \@@ -38,11 +43,10 @@ BASH_CONF_ENV += bash_cv_getenv_redef=yes endif endif -define BASH_INSTALL_TARGET_CMDS - $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \ - DESTDIR=$(TARGET_DIR) exec_prefix=/ install +define BASH_REMOVE_UNUSED_FILES rm -f $(TARGET_DIR)/bin/bashbug endef +BASH_POST_INSTALL_TARGET_HOOKS += BASH_REMOVE_UNUSED_FILES # Add /bin/bash to /etc/shells otherwise some login tools like dropbear # can reject the user connection. See man shells.Signature · 6 lines
2.30.2 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 1/3 package/bash: use --bindir instead of exec_prefix=
In reply to Thomas PetazzoniQuoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Thomas" == Thomas Petazzoni <[email protected]> writes:
We want bash to be installed as
/bin/bash. For ages, Buildroot has been doing this by overridingexec_prefixat install time. First of all, it would be preferred to do this at configure time. But also, overridingexec_prefixnot only changes where "bash" goes, but also where the pkgconfig file goes. Due to this, bash.pc goes into/lib/pkgconfig/, and doesn't get removed by target-finalize.
Quoted 7 lines
Since all we want is to have 'bash' as
/bin/bash, simply pass --bindir=/bin at configure time. This allows to use the default target installation logic for autotools-package. We keep a post-install target hook to remove/bin/bashbug.Signed-off-by Thomas Petazzoni <[email protected]>Cc Nicolas Cavallari <[email protected]>
Committed to 2021.02.x, thanks.
Signature · 1 line
Bye, Peter Korsgaard