diff mbox series

[bug#49293] isc-dhcp: Fix dhclient-script wrapper when cross-compiling.

Message ID 19e78b632e9d3dff63fae6409ccc98708907a297.camel@telenet.be
State Accepted
Headers show
Series [bug#49293] isc-dhcp: Fix dhclient-script wrapper when cross-compiling. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

M June 30, 2021, 2:13 p.m. UTC
This causes many rebuilds, but only when cross-compiling.
This should unbreak Internet access on cross-compiled pinebook
images.

Reported-By: Guest4977 (on IRC)

Comments

Mathieu Othacehe July 7, 2021, 2:28 p.m. UTC | #1
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?

Thanks,

Mathieu
M July 8, 2021, 8:44 p.m. UTC | #2
Mathieu Othacehe schreef op wo 07-07-2021 om 16:28 [+0200]:
> 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.
Mathieu Othacehe July 8, 2021, 9 p.m. UTC | #3
Hey Maxime,

> 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:
https://lists.gnu.org/archive/html/guix-devel/2020-06/msg00123.html.

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.

> (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
Mathieu Othacehe Aug. 29, 2021, 9:58 a.m. UTC | #4
Hello,

> 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
diff mbox series

Patch

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
  <https://issues.guix.gnu.org/49290>.
---
 gnu/packages/admin.scm | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

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