Skip to contentSkip to conversation

package: libgpg-error: make sure to use host-gawk

PATCH Applied Alexis Lothoré via buildroot 1 participant 3 messages Jun 18 – Jul 15

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package: libgpg-error: make sure to use host-gawk

From: Bernard Gautier <[email protected]>

During its configure step, libgpg-error needs awk:

configure -> src/gen-lock-obj.sh -> objdump + awk on test binary

This call is used on the output from objdump on a test binary to retrieve the size of some data structure, and generate accordingly an internal header (lock-obj-pub.native.h). However, libgpg-error buildroot package does not depend explicitely on host-gawk: if host-gawk is not part of the build, or if it is built later than libgpg-error, libgpg-error autotool tooling will eventually pick the build machine awk. On top of this issue, despite the configure.ac suggesting that it supports different implementations of awk, libgpg-error configure step will not parse correctly the output from objdump when using mawk, leading to a wrong lock-obj-pub.native.h header being generated:

With gawk:

  typedef struct
  {
    long _vers;
    union {
      volatile char _priv[24];
      long _x_align;
      long *_xp_align;
    } u;
  } gpgrt_lock_t;

  #define GPGRT_LOCK_INITIALIZER {1,{{0,0,0,0,0,0,0,0, \
                                      0,0,0,0,0,0,0,0, \
                                      0,0,0,0,0,0,0,0}}}

With mawk:

  typedef struct
  {
    long _vers;
    union {
      volatile char _priv[0];
      long _x_align;
      long *_xp_align;
    } u;
  } gpgrt_lock_t;

  #define GPGRT_LOCK_INITIALIZER {1,{{}}}

This issue has been observed for example on Debian 13 with mawk
installed: it fails to parse mtx_size, leading to a size 0, and so generating crashes at runtime because of the invalid size embedded in libgpg-error.

libgpg-error should be fixed upstream to properly handle this data structure size guessing even when using mawk, but anyway the corresponding buildroot package should not randomly use the build machine host tooling or buildroot-provided host tooling depending on whether host-gawk has been selected and built before it.

Enforce an explicit dependency on host-gawk for libgpg-error to make sure that it systematically uses the buildroot-provided awk.

---
 package/libgpg-error/libgpg-error.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/libgpg-error/libgpg-error.mk +1 -1
index df95e5fe0c14..31ffcee7432f 100644
@@ -12,7 +12,7 @@ LIBGPG_ERROR_LICENSE_FILES = COPYING COPYING.LIB
 LIBGPG_ERROR_CPE_ID_VENDOR = gnupg
 LIBGPG_ERROR_INSTALL_STAGING = YES
 LIBGPG_ERROR_CONFIG_SCRIPTS = gpg-error-config
-LIBGPG_ERROR_DEPENDENCIES = $(TARGET_NLS_DEPENDENCIES)
+LIBGPG_ERROR_DEPENDENCIES = $(TARGET_NLS_DEPENDENCIES) host-gawk
 LIBGPG_ERROR_CONF_OPTS = \
 	cross_compiling=yes \
 	--host=$(BR2_PACKAGE_LIBGPG_ERROR_SYSCFG) \

---
base-commit: 67449130e9fdd71a38ca26539dddfa8c882b1977
change-id: 20260618-libgpg-error-gawk-98715c0dea15

Best regards,

Signature · 6 lines
Alexis Lothoré <[email protected]>

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 58 lines · Alexis Lothoré via buildroot

From: Bernard Gautier <[email protected]>

During its configure step, libgpg-error needs awk:

configure -> src/gen-lock-obj.sh -> objdump + awk on test binary

This call is used on the output from objdump on a test binary to retrieve the size of some data structure, and generate accordingly an internal header (lock-obj-pub.native.h). However, libgpg-error buildroot package does not depend explicitely on host-gawk: if host-gawk is not part of the build, or if it is built later than libgpg-error, libgpg-error autotool tooling will eventually pick the build machine awk. On top of this issue, despite the configure.ac suggesting that it supports different implementations of awk, libgpg-error configure step will not parse correctly the output from objdump when using mawk, leading to a wrong lock-obj-pub.native.h header being generated:

With gawk:

  typedef struct
  {
    long _vers;
    union {
      volatile char _priv[24];
      long _x_align;
      long *_xp_align;
    } u;
  } gpgrt_lock_t;

  #define GPGRT_LOCK_INITIALIZER {1,{{0,0,0,0,0,0,0,0, \
                                      0,0,0,0,0,0,0,0, \
                                      0,0,0,0,0,0,0,0}}}

With mawk:

  typedef struct
  {
    long _vers;
    union {
      volatile char _priv[0];
      long _x_align;
      long *_xp_align;
    } u;
  } gpgrt_lock_t;

  #define GPGRT_LOCK_INITIALIZER {1,{{}}}

This issue has been observed for example on Debian 13 with mawk
installed: it fails to parse mtx_size, leading to a size 0, and so generating crashes at runtime because of the invalid size embedded in libgpg-error.

libgpg-error should be fixed upstream to properly handle this data structure size guessing even when using mawk, but anyway the corresponding buildroot package should not randomly use the build machine host tooling or buildroot-provided host tooling depending on whether host-gawk has been selected and built before it.

Quoted 7 lines

Enforce an explicit dependency on host-gawk for libgpg-error to make sure that it systematically uses the buildroot-provided awk.

Applied to master, thanks.

While reviewing, I observed the mawk version from Debian 12 is working as expected. Only the version in Debian 13 shows the issue. I added this side note in the commit log, when applying.

Best regards,

Julien.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#2 lore raw

Hi Julien,

Quoted 1 line · Julien Olivain

On 18/06/2026 16:49, Alexis Lothoré via buildroot wrote:

[...]

Quoted 10 lines
Quoted 9 lines

Enforce an explicit dependency on host-gawk for libgpg-error to make sure that it systematically uses the buildroot-provided awk.

Co-developped-by: Bernard Gautier
<[email protected]>
Signed-off-by: Bernard Gautier
<[email protected]>

Quoted 7 lines

Applied to master, thanks.

While reviewing, I observed the mawk version from Debian 12 is working as
expected. Only the version in Debian 13 shows the issue. I added this side
note in the commit log, when applying.

Thanks for the update. In the mean time, I have proposed a fix in the upstream package that eventually went further ([1]) and actually dropped awk usage from libgpg-error. The fix has been integrated but libgpg-error has not been re-released yet, once there's a new tag, we can bump the package and drop the awk dep.

Thanks

Alexis

[1] https://github.com/gpg/libgpg-error/commit/61d9a64f91aa89652265da97e32edee86d5fba45

Quoted 4 lines

Best regards,

Julien.

Signature · 8 lines
Alexis Lothoré, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot