[PATCH] isc-dhcp: Fix dhclient-script wrapper when cross-compiling.

  • Done
  • quality assurance status badge
Details
2 participants
  • Maxime Devos
  • Mathieu Othacehe
Owner
unassigned
Submitted by
Maxime Devos
Severity
normal
M
M
Maxime Devos wrote on 30 Jun 2021 16:13
(address . guix-patches@gnu.org)
19e78b632e9d3dff63fae6409ccc98708907a297.camel@telenet.be
This causes many rebuilds, but only when cross-compiling.
This should unbreak Internet access on cross-compiled pinebook
images.

Reported-By: Guest4977 (on IRC)
From 12973e011f031f0142d1cb4ab0a6dcb1376cc449 Mon Sep 17 00:00:00 2001
From: Maxime Devos <maximedevos@telenet.be>
Date: Wed, 30 Jun 2021 15:43:42 +0200
Subject: [PATCH] isc-dhcp: Fix dhclient-script wrapper when cross-compiling.

This causes many rebuilds, but only when cross-compiling.
This should unbreak Internet access on cross-compiled pinebook
images.

Reported-By: Guest4977 (on IRC)

* gnu/gnunet/packages/admin.scm
(isc-dhcp)[arguments]<#:phases>{post-install}: Use the
cross-compiled bash when cross-compiling. Work-around
---
gnu/packages/admin.scm | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)

Toggle diff (53 lines)
diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index 16fcdfcb8c..bb66e005a7 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -42,6 +42,7 @@
;;; Copyright © 2021 David Larsson <david.larsson@selfhosted.xyz>
;;; Copyright © 2021 WinterHound <winterhound@yandex.com>
;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
+;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -1228,7 +1229,11 @@ connection alive.")
"--owner=root:0"
"--group=root:0")))))
(add-after 'install 'post-install
- (lambda* (#:key inputs outputs #:allow-other-keys)
+ ;; TODO(core-updates): native-inputs isn't required anymore.
+ (lambda* (#:key ,@(if (%current-target-system)
+ '(native-inputs)
+ '())
+ inputs outputs #:allow-other-keys)
;; Install the dhclient script for GNU/Linux and make sure
;; if finds all the programs it needs.
(let* ((out (assoc-ref outputs "out"))
@@ -1253,6 +1258,13 @@ connection alive.")
(string-append dir "/bin:"
dir "/sbin"))
(list inetutils net-tools coreutils sed))))
+ ;; TODO(core-updates): should not be required anymore,
+ ;; once <https://issues.guix.gnu.org/49290> has been merged.
+ ,@(if (%current-target-system)
+ '((substitute* (string-append libexec "/dhclient-script")
+ (((assoc-ref native-inputs "bash"))
+ (assoc-ref inputs "bash"))))
+ '())
#t))))))
(native-inputs
@@ -1260,6 +1272,11 @@ connection alive.")
("file" ,file)))
(inputs `(("inetutils" ,inetutils)
+ ;; TODO(core-updates): simply make this unconditional
+ ,@(if (%current-target-system)
+ ;; for wrap-program
+ `(("bash" ,(canonical-package bash-minimal)))
+ '())
,@(if (hurd-target?) '()
`(("net-tools" ,net-tools)
("iproute" ,iproute)))
--
2.32.0
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYNx8GhccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7oWtAP4so0/huQB/zSNm88r6XRS2vEC6
XBVnkZCKyKZtMoR3LQD/YbUrCTmluIedFuaDUr7NdvnvVflN8E5P5upsA93uQQ4=
=5piT
-----END PGP SIGNATURE-----


M
M
Mathieu Othacehe wrote on 7 Jul 2021 16:28
(name . Maxime Devos)(address . maximedevos@telenet.be)(address . 49293@debbugs.gnu.org)
87pmvu42qk.fsf@gnu.org
Hello Maxime,

Toggle quote (5 lines)
> * gnu/gnunet/packages/admin.scm
> (isc-dhcp)[arguments]<#:phases>{post-install}: Use the
> cross-compiled bash when cross-compiling. Work-around
> <https://issues.guix.gnu.org/49290>.

When running:

Toggle snippet (5 lines)
mathieu@meije ~/guix [env]$ grep -nr bash /gnu/store/wgrh2kzgj1h6bnhxi8vv42qvriarmhsy-isc-dhcp-4.4.2-P1
/gnu/store/wgrh2kzgj1h6bnhxi8vv42qvriarmhsy-isc-dhcp-4.4.2-P1/libexec/dhclient-script:1:#!/gnu/store/xrvzr2xxf9azy9frn1a4ggfyws0jzg4a-bash-minimal-5.0.16/bin/bash
/gnu/store/wgrh2kzgj1h6bnhxi8vv42qvriarmhsy-isc-dhcp-4.4.2-P1/libexec/.dhclient-script-real:1:#!/gnu/store/pwcp239kjf7lnj5i4lkdzcfcxwcfyk72-bash-minimal-5.0.16/bin/bash

the first bash shebang reports:

Toggle snippet (4 lines)
mathieu@meije ~/guix [env]$ file /gnu/store/xrvzr2xxf9azy9frn1a4ggfyws0jzg4a-bash-minimal-5.0.16/bin/bash
/gnu/store/xrvzr2xxf9azy9frn1a4ggfyws0jzg4a-bash-minimal-5.0.16/bin/bash: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /gnu/store/qxbv3y3992whk7hrbbcl391mgnqnyxch-glibc-cross-aarch64-linux-gnu-2.31/lib/ld-linux-aarch64.so.1, for GNU/Linux 2.6.32, not stripped

which seems fine, but for the second one:

Toggle snippet (4 lines)
mathieu@meije ~/guix [env]$ file /gnu/store/pwcp239kjf7lnj5i4lkdzcfcxwcfyk72-bash-minimal-5.0.16/bin/bash
/gnu/store/pwcp239kjf7lnj5i4lkdzcfcxwcfyk72-bash-minimal-5.0.16/bin/bash: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /gnu/store/fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31/lib/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, not stripped

As the first script is exec-ing the second one, it could be problematic,
right?

Thanks,

Mathieu
M
M
Maxime Devos wrote on 8 Jul 2021 22:44
(name . Mathieu Othacehe)(address . othacehe@gnu.org)(address . 49293@debbugs.gnu.org)
e63eafebf0a5b1f18c29a63a54efb8bfddcf4278.camel@telenet.be
Mathieu Othacehe schreef op wo 07-07-2021 om 16:28 [+0200]:
Toggle quote (32 lines)
> Hello Maxime,
>
> > * gnu/gnunet/packages/admin.scm
> > (isc-dhcp)[arguments]<#:phases>{post-install}: Use the
> > cross-compiled bash when cross-compiling. Work-around
> > <https://issues.guix.gnu.org/49290>;.
>
> When running:
>
> --8<---------------cut here---------------start------------->8---
> mathieu@meije ~/guix [env]$ grep -nr bash /gnu/store/wgrh2kzgj1h6bnhxi8vv42qvriarmhsy-isc-dhcp-4.4.2-P1
> /gnu/store/wgrh2kzgj1h6bnhxi8vv42qvriarmhsy-isc-dhcp-4.4.2-P1/libexec/dhclient-script:1:#!/gnu/store/xrvzr2xxf9azy9frn1a4ggfyws0jzg4a-bash-minimal-5.0.16/bin/bash
> /gnu/store/wgrh2kzgj1h6bnhxi8vv42qvriarmhsy-isc-dhcp-4.4.2-P1/libexec/.dhclient-script-real:1:#!/gnu/store/pwcp239kjf7lnj5i4lkdzcfcxwcfyk72-bash-minimal-5.0.16/bin/bash
> --8<---------------cut here---------------end--------------->8---
>
> the first bash shebang reports:
>
> --8<---------------cut here---------------start------------->8---
> mathieu@meije ~/guix [env]$ file /gnu/store/xrvzr2xxf9azy9frn1a4ggfyws0jzg4a-bash-minimal-5.0.16/bin/bash
> /gnu/store/xrvzr2xxf9azy9frn1a4ggfyws0jzg4a-bash-minimal-5.0.16/bin/bash: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /gnu/store/qxbv3y3992whk7hrbbcl391mgnqnyxch-glibc-cross-aarch64-linux-gnu-2.31/lib/ld-linux-aarch64.so.1, for GNU/Linux 2.6.32, not stripped
> --8<---------------cut here---------------end--------------->8---
>
> which seems fine, but for the second one:
>
> --8<---------------cut here---------------start------------->8---
> mathieu@meije ~/guix [env]$ file /gnu/store/pwcp239kjf7lnj5i4lkdzcfcxwcfyk72-bash-minimal-5.0.16/bin/bash
> /gnu/store/pwcp239kjf7lnj5i4lkdzcfcxwcfyk72-bash-minimal-5.0.16/bin/bash: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /gnu/store/fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31/lib/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, not stripped
> --8<---------------cut here---------------end--------------->8---
>
> As the first script is exec-ing the second one, it could be problematic,
> right?

Yes, indeed. It seems like the same thing needs to be done for libexec/.dhclient-script.
Also, I'm not sure if using 'canonical-package' is the right thing.
I wonder when 'canonical-package' is supposed to be used.

(Somewhat unrelated) I'll rebase the meson patch on core-updates and try to
cross-compile some qt application and run it under qemu.

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYOdjkxccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7ppRAP9IoJDFWz+QGC/2kPH8iTCQnPOo
iAw3EG8qw0E//cT9bwD/btRu66PW903ZFpvn3gyWGGAeMuMdpn5jSQ0Q90mbww4=
=KGAo
-----END PGP SIGNATURE-----


M
M
Mathieu Othacehe wrote on 8 Jul 2021 23:00
(name . Maxime Devos)(address . maximedevos@telenet.be)(address . 49293@debbugs.gnu.org)
87mtqwttb5.fsf@gnu.org
Hey Maxime,

Toggle quote (4 lines)
> Yes, indeed. It seems like the same thing needs to be done for libexec/.dhclient-script.
> Also, I'm not sure if using 'canonical-package' is the right thing.
> I wonder when 'canonical-package' is supposed to be used.

There's at least one issue with canonical-package that is discussed
here:

The problem is that having for instance the canonical and non-canonical
package "coreutils" in a package or system closure, will significantly
increase its size.

Toggle quote (3 lines)
> (Somewhat unrelated) I'll rebase the meson patch on core-updates and try to
> cross-compile some qt application and run it under qemu.

I put the cross-compilation effort aside lately, it's really great to
see you bringing real progress on that front.

Thanks,

Mathieu
M
M
Mathieu Othacehe wrote on 29 Aug 2021 11:58
(name . Maxime Devos)(address . maximedevos@telenet.be)(address . 49293-done@debbugs.gnu.org)
87lf4kvag8.fsf_-_@gnu.org
Hello,

Toggle quote (4 lines)
> Yes, indeed. It seems like the same thing needs to be done for libexec/.dhclient-script.
> Also, I'm not sure if using 'canonical-package' is the right thing.
> I wonder when 'canonical-package' is supposed to be used.

I fixed this issue and pushed it as
7256d9d2049352e9a63594eb558dc44978bd6687.

Thanks,

Mathieu
Closed
?