All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2 1/1] package/dhcp: add host-gawk to dependencies and build environment
@ 2021-02-14 14:54 Sergey Matyukevich
  2021-05-20 18:22 ` Arnout Vandecappelle
  0 siblings, 1 reply; 3+ messages in thread
From: Sergey Matyukevich @ 2021-02-14 14:54 UTC (permalink / raw)
  To: buildroot

DHCP package may silently fail to install binaries to the target image.
The problem occurs when buildroot configuration and build host provide
different flavors of awk. For instance, mawk on build host and gawk in
buildroot output/host. In this case isc-dhcp configure script detects
gawk in output/host and generates Makefiles specifying gawk without
absolute path. During Buildroot installation phase, those Makefiles
are used to install dhcp binaries. They attempt to use gawk without
absolute path. However build host does not have gawk.

To resolve the issue add host-gawk to the list of dhcp dependencies
and explicitely specify absolute path to host-gawk.

Signed-off-by: Sergey Matyukevich <geomatsi@gmail.com>
---

Changes v1 -> v2 (after review and tests by Thomas Petazzoni):
 - suggested change is the same
 - root cause is figured out and commit message updated

The root cause is explained in commit message. Here are the steps
to reproduce the issue.

Buildroot Docker image at support/docker/Dockerfile provides a way to
reproduce the issue. This docker image includes mawk. Each of the
following cases starts from default qemu_x86_defconfig:

1. Keep using uclibc, enable isc-dhcp server and client
Buildroot does not have any awk flavor installed in output/host, so
mawk from build host is used. Build dhcp. The result is ok: both
dhclient and dhcpd are installed on the target.

2. Switch to glibc, enable isc-dhcp server and client
Note that glibc package has host-gawk among its dependencies. So in
this case build host awk (mawk) differs from buildroot host awk (gawk).
Build dhcp. The result is not ok: neither dhclient nor dhcpd are
installed to the target.

Regards,
Sergey

 package/dhcp/dhcp.mk | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/package/dhcp/dhcp.mk b/package/dhcp/dhcp.mk
index 988c7792dc..4a9e98485c 100644
--- a/package/dhcp/dhcp.mk
+++ b/package/dhcp/dhcp.mk
@@ -10,6 +10,7 @@ DHCP_INSTALL_STAGING = YES
 DHCP_LICENSE = MPL-2.0
 DHCP_LICENSE_FILES = LICENSE
 DHCP_DEPENDENCIES = bind
+DHCP_DEPENDENCIES = bind host-gawk
 DHCP_CPE_ID_VENDOR = isc
 
 # use libtool-enabled configure.ac
@@ -22,6 +23,8 @@ DHCP_CONF_ENV = \
 		-D_PATH_DHCLIENT_CONF=\"/etc/dhcp/dhclient.conf\"' \
 	CFLAGS='$(TARGET_CFLAGS) -DISC_CHECK_NONE=1'
 
+DHCP_CONF_ENV += ac_cv_prog_AWK=$(HOST_DIR)/bin/gawk
+
 DHCP_CONF_OPTS = \
 	--with-libbind=$(STAGING_DIR)/usr \
 	--with-randomdev=/dev/random \
-- 
2.30.1

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

* [Buildroot] [PATCH v2 1/1] package/dhcp: add host-gawk to dependencies and build environment
  2021-02-14 14:54 [Buildroot] [PATCH v2 1/1] package/dhcp: add host-gawk to dependencies and build environment Sergey Matyukevich
@ 2021-05-20 18:22 ` Arnout Vandecappelle
  2021-05-20 21:11   ` Sergey Matyukevich
  0 siblings, 1 reply; 3+ messages in thread
From: Arnout Vandecappelle @ 2021-05-20 18:22 UTC (permalink / raw)
  To: buildroot



On 14/02/2021 15:54, Sergey Matyukevich wrote:
> DHCP package may silently fail to install binaries to the target image.
> The problem occurs when buildroot configuration and build host provide
> different flavors of awk. For instance, mawk on build host and gawk in
> buildroot output/host. In this case isc-dhcp configure script detects
> gawk in output/host and generates Makefiles specifying gawk without
> absolute path. During Buildroot installation phase, those Makefiles
> are used to install dhcp binaries. They attempt to use gawk without
> absolute path. However build host does not have gawk.
> 
> To resolve the issue add host-gawk to the list of dhcp dependencies
> and explicitely specify absolute path to host-gawk.
> 
> Signed-off-by: Sergey Matyukevich <geomatsi@gmail.com>

 Heiko recently posted a patch that does the same thing, and I applied that one
because it only adds the dependency when the server is enabled (client doesn't
need gawk).

 Thanks!

 Regards,
 Arnout

> ---
> 
> Changes v1 -> v2 (after review and tests by Thomas Petazzoni):
>  - suggested change is the same
>  - root cause is figured out and commit message updated
> 
> The root cause is explained in commit message. Here are the steps
> to reproduce the issue.
> 
> Buildroot Docker image at support/docker/Dockerfile provides a way to
> reproduce the issue. This docker image includes mawk. Each of the
> following cases starts from default qemu_x86_defconfig:
> 
> 1. Keep using uclibc, enable isc-dhcp server and client
> Buildroot does not have any awk flavor installed in output/host, so
> mawk from build host is used. Build dhcp. The result is ok: both
> dhclient and dhcpd are installed on the target.
> 
> 2. Switch to glibc, enable isc-dhcp server and client
> Note that glibc package has host-gawk among its dependencies. So in
> this case build host awk (mawk) differs from buildroot host awk (gawk).
> Build dhcp. The result is not ok: neither dhclient nor dhcpd are
> installed to the target.
> 
> Regards,
> Sergey
> 
>  package/dhcp/dhcp.mk | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/package/dhcp/dhcp.mk b/package/dhcp/dhcp.mk
> index 988c7792dc..4a9e98485c 100644
> --- a/package/dhcp/dhcp.mk
> +++ b/package/dhcp/dhcp.mk
> @@ -10,6 +10,7 @@ DHCP_INSTALL_STAGING = YES
>  DHCP_LICENSE = MPL-2.0
>  DHCP_LICENSE_FILES = LICENSE
>  DHCP_DEPENDENCIES = bind
> +DHCP_DEPENDENCIES = bind host-gawk
>  DHCP_CPE_ID_VENDOR = isc
>  
>  # use libtool-enabled configure.ac
> @@ -22,6 +23,8 @@ DHCP_CONF_ENV = \
>  		-D_PATH_DHCLIENT_CONF=\"/etc/dhcp/dhclient.conf\"' \
>  	CFLAGS='$(TARGET_CFLAGS) -DISC_CHECK_NONE=1'
>  
> +DHCP_CONF_ENV += ac_cv_prog_AWK=$(HOST_DIR)/bin/gawk
> +
>  DHCP_CONF_OPTS = \
>  	--with-libbind=$(STAGING_DIR)/usr \
>  	--with-randomdev=/dev/random \
> 

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

* [Buildroot] [PATCH v2 1/1] package/dhcp: add host-gawk to dependencies and build environment
  2021-05-20 18:22 ` Arnout Vandecappelle
@ 2021-05-20 21:11   ` Sergey Matyukevich
  0 siblings, 0 replies; 3+ messages in thread
From: Sergey Matyukevich @ 2021-05-20 21:11 UTC (permalink / raw)
  To: buildroot

Hello Arnout,

> > DHCP package may silently fail to install binaries to the target image.
> > The problem occurs when buildroot configuration and build host provide
> > different flavors of awk. For instance, mawk on build host and gawk in
> > buildroot output/host. In this case isc-dhcp configure script detects
> > gawk in output/host and generates Makefiles specifying gawk without
> > absolute path. During Buildroot installation phase, those Makefiles
> > are used to install dhcp binaries. They attempt to use gawk without
> > absolute path. However build host does not have gawk.
> > 
> > To resolve the issue add host-gawk to the list of dhcp dependencies
> > and explicitely specify absolute path to host-gawk.
> > 
> > Signed-off-by: Sergey Matyukevich <geomatsi@gmail.com>
> 
>  Heiko recently posted a patch that does the same thing, and I applied that one
> because it only adds the dependency when the server is enabled (client doesn't
> need gawk).

I did some build tests in support/docker/Dockerfile image. It turns out
that the patch suggested by Heiko is not enough. It adds host-gawk to 
dependencies, but it does not set explicit path to this gawk in dhcp
configuration scripts. As a result, the same issue can be reproduced
immediately even with uclibc. The build test is as follows:
- use docker builder image described in support/docker/Dockerfile
  -- note that this image provides mawk flavor
- start from default qemu_x86_defconfig
- enable both isc-dhcp client and server

As a result, neighter dhclient nor dhcpd are installed into
output/target. Previously, before the applied patch, the issue could be
reproduced only with glibc which pulled host-gawk dependency. Besides,
unless I missed something in my tests, dhclient installation is also
impacted, so host-gawk should be added globally.

I will update my patch and send v3.

Regards,
Sergey

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

end of thread, other threads:[~2021-05-20 21:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-14 14:54 [Buildroot] [PATCH v2 1/1] package/dhcp: add host-gawk to dependencies and build environment Sergey Matyukevich
2021-05-20 18:22 ` Arnout Vandecappelle
2021-05-20 21:11   ` Sergey Matyukevich

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.