All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] package/glibc: drop dependency of utilities on bash
@ 2019-12-03  0:14 unixmania at gmail.com
  2019-12-05 22:17 ` Thomas Petazzoni
  0 siblings, 1 reply; 6+ messages in thread
From: unixmania at gmail.com @ 2019-12-03  0:14 UTC (permalink / raw)
  To: buildroot

From: Carlos Santos <unixmania@gmail.com>

The dependency was added because ldd uses bash-specific syntax to
localize messages. Add a post-patch hook, instead, to replace the
occurrences of $"foo" by "foo", simply, so the code becomes POSIX
sh compliant if bash is not selected.

Also set the configuration environment accordingly to replace the
/bin/bash hashbang by /bin/sh.

Signed-off-by: Carlos Santos <unixmania@gmail.com>
---
 package/glibc/Config.in |  4 ----
 package/glibc/glibc.mk  | 11 ++++++++++-
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/package/glibc/Config.in b/package/glibc/Config.in
index b8c2573d96..7b2f246947 100644
--- a/package/glibc/Config.in
+++ b/package/glibc/Config.in
@@ -11,10 +11,6 @@ endif
 
 config BR2_PACKAGE_GLIBC_UTILS
 	bool "Install glibc utilities"
-	depends on BR2_PACKAGE_BASH
 	help
 	  Enabling this option will compile and install the getconf,
 	  ldconfig, ldd and locale glibc utilities for the target.
-
-comment "glibc utilities need bash"
-	depends on !BR2_PACKAGE_BASH
diff --git a/package/glibc/glibc.mk b/package/glibc/glibc.mk
index 8eafa55ae1..1b38f8aedb 100644
--- a/package/glibc/glibc.mk
+++ b/package/glibc/glibc.mk
@@ -74,10 +74,19 @@ endef
 endif
 
 GLIBC_CONF_ENV = \
-	ac_cv_path_BASH_SHELL=/bin/bash \
+	ac_cv_path_BASH_SHELL=/bin/$(if $(BR2_PACKAGE_BASH),bash,sh) \
 	libc_cv_forced_unwind=yes \
 	libc_cv_ssp=no
 
+# POSIX shell does not support localization, so remove the corresponding
+# syntax from ldd if bash is not selected.
+ifeq ($(BR2_PACKAGE_BASH),)
+define GLIBC_LDD_NO_BASH
+	$(SED) 's/$$"/"/g' $(@D)/elf/ldd.bash.in
+endef
+GLIBC_POST_PATCH_HOOKS += GLIBC_LDD_NO_BASH
+endif
+
 # Override the default library locations of /lib64/<abi> and
 # /usr/lib64/<abi>/ for RISC-V.
 ifeq ($(BR2_riscv),y)
-- 
2.18.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH] package/glibc: drop dependency of utilities on bash
  2019-12-03  0:14 [Buildroot] [PATCH] package/glibc: drop dependency of utilities on bash unixmania at gmail.com
@ 2019-12-05 22:17 ` Thomas Petazzoni
  2019-12-09  1:38   ` Carlos Santos
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Petazzoni @ 2019-12-05 22:17 UTC (permalink / raw)
  To: buildroot

On Mon,  2 Dec 2019 21:14:05 -0300
unixmania at gmail.com wrote:

> From: Carlos Santos <unixmania@gmail.com>
> 
> The dependency was added because ldd uses bash-specific syntax to
> localize messages. Add a post-patch hook, instead, to replace the
> occurrences of $"foo" by "foo", simply, so the code becomes POSIX
> sh compliant if bash is not selected.
> 
> Also set the configuration environment accordingly to replace the
> /bin/bash hashbang by /bin/sh.
> 
> Signed-off-by: Carlos Santos <unixmania@gmail.com>

I've applied, however I think it would be nice to have this mechanism
supported upstream. It can probably be easily added using a check in
configure.ac, and the proper autoconf replacement variable when
generating elf/ldd.bash.

Could you have a look into this ?

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH] package/glibc: drop dependency of utilities on bash
  2019-12-05 22:17 ` Thomas Petazzoni
@ 2019-12-09  1:38   ` Carlos Santos
  2019-12-09  7:53     ` Thomas Petazzoni
  0 siblings, 1 reply; 6+ messages in thread
From: Carlos Santos @ 2019-12-09  1:38 UTC (permalink / raw)
  To: buildroot

On Thu, Dec 5, 2019 at 7:17 PM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> On Mon,  2 Dec 2019 21:14:05 -0300
> unixmania at gmail.com wrote:
>
> > From: Carlos Santos <unixmania@gmail.com>
> >
> > The dependency was added because ldd uses bash-specific syntax to
> > localize messages. Add a post-patch hook, instead, to replace the
> > occurrences of $"foo" by "foo", simply, so the code becomes POSIX
> > sh compliant if bash is not selected.
> >
> > Also set the configuration environment accordingly to replace the
> > /bin/bash hashbang by /bin/sh.
> >
> > Signed-off-by: Carlos Santos <unixmania@gmail.com>
>
> I've applied, however I think it would be nice to have this mechanism
> supported upstream. It can probably be easily added using a check in
> configure.ac, and the proper autoconf replacement variable when
> generating elf/ldd.bash.
>
> Could you have a look into this ?
>
> Thanks!

I'm working on a patch series to glibc but it requires ATORECONF,
which fails because GLIBC_SUBDIR is set to "build" and there
configure.ac is not there. I circumvented the problem by using

define GLIBC_AUTORECONF
        cd $(@D) && $(AUTORECONF) || true
endef

GLIBC_PRE_CONFIGURE_HOOKS = GLIBC_AUTORECONF

The "|| true" there is a kludge to ignore this error:

Use of uninitialized value $args[0] in split at
/work/qemu_x86_64_glibc_eudev/host/bin/autoreconf line 493, <GEN2>
line 4.
autoheader: warning: missing template: BIND_NOW
autoheader: Use AC_DEFINE([BIND_NOW], [], [Description])
autoheader: warning: missing template: DO_STATIC_NSS
autoheader: warning: missing template: ENABLE_STACKGUARD_RANDOMIZE
autoheader: warning: missing template: ENABLE_STATIC_PIE
autoheader: warning: missing template: EXPORT_UNWIND_FIND_FDE
autoheader: warning: missing template: HAVE_ASM_SET_DIRECTIVE
autoheader: warning: missing template: HAVE_BUILTIN_MEMSET
autoheader: warning: missing template: HAVE_BUILTIN_TRAP
autoheader: warning: missing template: HAVE_CC_INHIBIT_LOOP_TO_LIBCALL
autoheader: warning: missing template: HAVE_CC_NO_STACK_PROTECTOR
autoheader: warning: missing template: HAVE_CC_WITH_LIBUNWIND
autoheader: warning: missing template: HAVE_EHDR_START
autoheader: warning: missing template: HAVE_GCC_IFUNC
autoheader: warning: missing template: HAVE_IFUNC
autoheader: warning: missing template: HAVE_PT_CHOWN
autoheader: warning: missing template: HAVE_SDATA_SECTION
autoheader: warning: missing template: HAVE_SECTION_QUOTES
autoheader: warning: missing template: HAVE_TUNABLES
autoheader: warning: missing template: HAVE_Z_COMBRELOC
autoheader: warning: missing template: LINK_OBSOLETE_NSL
autoheader: warning: missing template: LINK_OBSOLETE_RPC
autoheader: warning: missing template: NO_CTORS_DTORS_SECTIONS
autoheader: warning: missing template: NO_HIDDEN
autoheader: warning: missing template: STACK_PROTECTOR_LEVEL
autoheader: warning: missing template: USE_LDCONFIG
autoheader: warning: missing template: USE_MULTIARCH
autoheader: warning: missing template: USE_NSCD
autoheader: warning: missing template: USE_STAP_PROBE
autoreconf: /work/qemu_x86_64_glibc_eudev/host/bin/autoheader failed
with exit status: 1

--
Carlos Santos <unixmania@gmail.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH] package/glibc: drop dependency of utilities on bash
  2019-12-09  1:38   ` Carlos Santos
@ 2019-12-09  7:53     ` Thomas Petazzoni
  2019-12-09 11:41       ` Carlos Santos
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Petazzoni @ 2019-12-09  7:53 UTC (permalink / raw)
  To: buildroot

Hello Carlos,

On Sun, 8 Dec 2019 22:38:52 -0300
Carlos Santos <unixmania@gmail.com> wrote:

> I'm working on a patch series to glibc but it requires ATORECONF,
> which fails because GLIBC_SUBDIR is set to "build" and there
> configure.ac is not there. I circumvented the problem by using
> 
> define GLIBC_AUTORECONF
>         cd $(@D) && $(AUTORECONF) || true
> endef
> 
> GLIBC_PRE_CONFIGURE_HOOKS = GLIBC_AUTORECONF
> 
> The "|| true" there is a kludge to ignore this error:
> 
> Use of uninitialized value $args[0] in split at
> /work/qemu_x86_64_glibc_eudev/host/bin/autoreconf line 493, <GEN2>

Hum, OK. Perhaps another way is to simply have your patch make its way
upstream, and wait until the next glibc release to really use it in
Buildroot. In the mean time, we can keep the post patch hook that you
have implemented and that was merged in Buildroot.

What is important is that at some point in the future, there will be an
upstream solution. We don't necessarily need to use it immediately in
Buildroot.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH] package/glibc: drop dependency of utilities on bash
  2019-12-09  7:53     ` Thomas Petazzoni
@ 2019-12-09 11:41       ` Carlos Santos
  2019-12-09 12:41         ` Thomas Petazzoni
  0 siblings, 1 reply; 6+ messages in thread
From: Carlos Santos @ 2019-12-09 11:41 UTC (permalink / raw)
  To: buildroot

On Mon, Dec 9, 2019 at 4:53 AM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> Hello Carlos,
>
> On Sun, 8 Dec 2019 22:38:52 -0300
> Carlos Santos <unixmania@gmail.com> wrote:
>
> > I'm working on a patch series to glibc but it requires ATORECONF,
> > which fails because GLIBC_SUBDIR is set to "build" and there
> > configure.ac is not there. I circumvented the problem by using
> >
> > define GLIBC_AUTORECONF
> >         cd $(@D) && $(AUTORECONF) || true
> > endef
> >
> > GLIBC_PRE_CONFIGURE_HOOKS = GLIBC_AUTORECONF
> >
> > The "|| true" there is a kludge to ignore this error:
> >
> > Use of uninitialized value $args[0] in split at
> > /work/qemu_x86_64_glibc_eudev/host/bin/autoreconf line 493, <GEN2>
>
> Hum, OK. Perhaps another way is to simply have your patch make its way
> upstream, and wait until the next glibc release to really use it in
> Buildroot. In the mean time, we can keep the post patch hook that you
> have implemented and that was merged in Buildroot.
>
> What is important is that at some point in the future, there will be an
> upstream solution. We don't necessarily need to use it immediately in
> Buildroot.

RFE submitted: https://sourceware.org/bugzilla/show_bug.cgi?id=25259

-- 
Carlos Santos <unixmania@gmail.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH] package/glibc: drop dependency of utilities on bash
  2019-12-09 11:41       ` Carlos Santos
@ 2019-12-09 12:41         ` Thomas Petazzoni
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Petazzoni @ 2019-12-09 12:41 UTC (permalink / raw)
  To: buildroot

On Mon, 9 Dec 2019 08:41:40 -0300
Carlos Santos <unixmania@gmail.com> wrote:

> > Hum, OK. Perhaps another way is to simply have your patch make its way
> > upstream, and wait until the next glibc release to really use it in
> > Buildroot. In the mean time, we can keep the post patch hook that you
> > have implemented and that was merged in Buildroot.
> >
> > What is important is that at some point in the future, there will be an
> > upstream solution. We don't necessarily need to use it immediately in
> > Buildroot.  
> 
> RFE submitted: https://sourceware.org/bugzilla/show_bug.cgi?id=25259

Thanks a lot! Much appreciated.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-12-09 12:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-03  0:14 [Buildroot] [PATCH] package/glibc: drop dependency of utilities on bash unixmania at gmail.com
2019-12-05 22:17 ` Thomas Petazzoni
2019-12-09  1:38   ` Carlos Santos
2019-12-09  7:53     ` Thomas Petazzoni
2019-12-09 11:41       ` Carlos Santos
2019-12-09 12:41         ` Thomas Petazzoni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.