GNU bug report logs - #76110
Broken i686 package on x86_64 since commit 28e4018e59

Previous Next

Package: guix;

Reported by: Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org>

Date: Fri, 7 Feb 2025 00:18:01 UTC

Severity: normal

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 76110 in the body.
You can then email your comments to 76110 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#76110; Package guix. (Fri, 07 Feb 2025 00:18:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Fri, 07 Feb 2025 00:18:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org>
To: bug-guix <at> gnu.org, Ludovic Courtès <ludo <at> gnu.org>, David
 Elsing <david.elsing <at> posteo.net>
Subject: Broken i686 package on x86_64 since commit 28e4018e59
Date: Fri, 7 Feb 2025 01:15:41 +0100
[Message part 1 (text/plain, inline)]
Hi,

I run a 32bit version of PostgreSQL that I compile with the package
definition below:
> ;; Copyright (C) 2024 Denis 'GNUtoo' Carikli
> ;; <GNUtoo <at> cyberdimension.org>
> ;; This file is free software; you can redistribute it and/or modify
> ;; it under the terms of the GNU General Public License as
> ;; published by the Free Software Foundation; either version 3 of the
> ;; License, or (at your option) any later version.
> ;;
> ;; This file is distributed in the hope that it will be useful, but
> ;; WITHOUT ANY WARRANTY; without even the implied warranty of
> ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> ;; GNU General Public License for more details.
> ;;
> ;; You should have received a copy of the GNU General Public License
> ;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
> 
> (define-module (postgresql-i686-linux)
>   #:use-module (gnu packages databases)
>   #:use-module (guix packages)
>   #:use-module (guix utils))
> 
> (define-public postgresql-14-i686-linux
>   (package
>    (inherit postgresql-14)
>    (name "postgresql-14-i686-linux")
>    (arguments
>     (ensure-keyword-arguments
>      (package-arguments postgresql-14)
>      '(#:system "i686-linux")))))
> 
> (list postgresql-14-i686-linux)

Here's why it is broken:
> $ guix build -f postgresql-i686-linux.scm
> [...]
> /gnu/store/[...]-postgresql-14-i686-linux-14.13

> $ file /gnu/store/[...]-postgresql-14-i686-linux-14.13/bin/psql
> /gnu/store/[...]-postgresql-14-i686-linux-14.13/bin/psql:
> ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically
> linked, interpreter
> /gnu/store/[...]-glibc-2.39/lib/ld-linux.so.2,

> $ ls -l /gnu/store/[...]-postgresql-14-i686-linux-14.13/bin/psql
> -r-xr-xr-x 2 root root 674532 Jan  1  1970
> /gnu/store/jb8jdcyf8q4whlczhp76kdgpqs007jz9-postgresql-14-i686-linux-14.13/bin/psql

> $ /gnu/store/[...]-postgresql-14-i686-linux-14.13/bin/psql --help
> bash:
> /gnu/store/jb8jdcyf8q4whlczhp76kdgpqs007jz9-postgresql-14-i686-linux-14.13/bin/psql:
> No such file or directory

Before the commit 28e4018e59d30efb3d52aa950ce2261f11b69b33, the same
command printed the help of the psql program.

So I bisected with the script below (ran manually, not with git bisect
run):

> #!/usr/bin/env bash
> $(guix time-machine \
> --commit=$(git show HEAD --no-patch --pretty="%H") -- \
> build -f \
> ~/work/setup/configs/packages/postgresql-i686-linux.scm )/bin/psql
> --help

And the process gave the commit 28e4018e59d30efb3d52aa950ce2261f11b69b33
("grafts: Allow file-like objects in the ‘replacement’ field of
<graft>.").

However I didn't look into how to repair the behavior above as I'm not
familiar at all with the code that the 28e4018e59 patch touches.

Denis.
[Message part 2 (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#76110; Package guix. (Sat, 08 Feb 2025 13:02:02 GMT) Full text and rfc822 format available.

Message #8 received at 76110 <at> debbugs.gnu.org (full text, mbox):

From: David Elsing <david.elsing <at> posteo.net>
To: Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org>,
 76110 <at> debbugs.gnu.org, Ludovic Courtès <ludo <at> gnu.org>
Subject: Re: Broken i686 package on x86_64 since commit 28e4018e59
Date: Sat, 08 Feb 2025 13:01:26 +0000
[Message part 1 (text/plain, inline)]
Hi,

Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org> writes:

> And the process gave the commit 28e4018e59d30efb3d52aa950ce2261f11b69b33
> ("grafts: Allow file-like objects in the ‘replacement’ field of
> <graft>.").
>
> However I didn't look into how to repair the behavior above as I'm not
> familiar at all with the code that the 28e4018e59 patch touches.

The problematic change with commit 28e4018e59 is that the 'system'
argument in `input-graft' (and `system' and `target' in
`input-cross-graft') is no longer respected for the replacement, such
that the 'origin' and 'replacement' fields are built for a different
system. Therefore, I would suggest to indeed add another wrapping by
`with-parameters' to `input-graft' and `input-cross-graft' (but keeping
the `with-parameters' wrapping which sets %grafts in
`graft-derivation/shallow', even if it doesn't do anything yet [2]).

Attached is a patch with the change. Unlike other parameters, for which
`with-parameters' currently does not work with packages [2],
`%current-system' and `%current-target-system' are treated specially and
are working correctly.

However, this still does not really solve the issue for your package:
It still (correctly) calls `package->derivation' with the 'system'
argument set to "x86_64-linux", which is then overridden by the #:system
argument in the system package in `bag->derivation'.
The same is not the case however for grafts, and `graft-derivation*' is
still called with "x86_64-linux", which is arguably correct, but
inconsistent with the #:system package argument. IIUC, this leads to
grafts being missed, as some are calculated for "x86_64-linux" (which
are not applicable) and some for "i686-linux".

For reference, is setting #:system in a package even intended? It seems
more coincidental to me that it works, as the #:system argument of a package
overrides the previous #:system argument in `bag->derivation'.
I think it makes more sense to use `with-parameters', which works
correctly in this case (also without the new patch):

--8<---------------cut here---------------start------------->8---
(with-parameters
    ((%current-system "i686-linux"))
  postgresql-14)
--8<---------------cut here---------------end--------------->8---

Cheers,
David

[1] https://issues.guix.gnu.org/70895
[2] https://issues.guix.gnu.org/75879

[graft-replacement-system.patch (text/x-patch, inline)]
diff --git a/guix/packages.scm b/guix/packages.scm
index 78726b089ae..43125bac61a 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -1824,7 +1824,9 @@ (define (input-graft system)
                         (return (graft
                                   (origin orig)
                                   (origin-output output)
-                                  (replacement replacement)
+                                  (replacement
+                                   (with-parameters ((%current-system system))
+                                     replacement))
                                   (replacement-output output))))
                       package output system)
              (return #f))))
@@ -1846,7 +1848,10 @@ (define (input-cross-graft target system)
                (return (graft
                          (origin orig)
                          (origin-output output)
-                         (replacement replacement)
+                         (replacement
+                          (with-parameters ((%current-system system)
+                                            (%current-target-system target))
+                            replacement))
                          (replacement-output output))))
              (return #f))))
       (_

Information forwarded to bug-guix <at> gnu.org:
bug#76110; Package guix. (Thu, 27 Feb 2025 14:44:02 GMT) Full text and rfc822 format available.

Message #11 received at 76110 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: David Elsing <david.elsing <at> posteo.net>
Cc: 76110 <at> debbugs.gnu.org, Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org>
Subject: Re: Broken i686 package on x86_64 since commit 28e4018e59
Date: Thu, 27 Feb 2025 15:43:12 +0100
Hi David,

David Elsing <david.elsing <at> posteo.net> skribis:

> diff --git a/guix/packages.scm b/guix/packages.scm
> index 78726b089ae..43125bac61a 100644
> --- a/guix/packages.scm
> +++ b/guix/packages.scm
> @@ -1824,7 +1824,9 @@ (define (input-graft system)
>                          (return (graft
>                                    (origin orig)
>                                    (origin-output output)
> -                                  (replacement replacement)
> +                                  (replacement
> +                                   (with-parameters ((%current-system system))
> +                                     replacement))
>                                    (replacement-output output))))
>                        package output system)
>               (return #f))))
> @@ -1846,7 +1848,10 @@ (define (input-cross-graft target system)
>                 (return (graft
>                           (origin orig)
>                           (origin-output output)
> -                         (replacement replacement)
> +                         (replacement
> +                          (with-parameters ((%current-system system)
> +                                            (%current-target-system target))
> +                            replacement))
>                           (replacement-output output))))

I think we should apply this patch, it makes perfect sense.

And yes, passing #:system in the ‘arguments’ field is valid: it’s used
in a handful of packages.

David, would you be willing/able to send it as a proper patch to
guix-patches, ideally with a test?

Thanks,
Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#76110; Package guix. (Sun, 02 Mar 2025 22:53:02 GMT) Full text and rfc822 format available.

Message #14 received at 76110 <at> debbugs.gnu.org (full text, mbox):

From: David Elsing <david.elsing <at> posteo.net>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 76110 <at> debbugs.gnu.org, Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org>
Subject: Re: Broken i686 package on x86_64 since commit 28e4018e59
Date: Sun, 02 Mar 2025 22:52:08 +0000
Hello,

Ludovic Courtès <ludo <at> gnu.org> writes:

> David, would you be willing/able to send it as a proper patch to
> guix-patches, ideally with a test?

The patch is here: https://issues.guix.gnu.org/76694
I had to adjust other tests as well, because the replacement can now
only be compared by lowering it to a derivation first.

Best,
David




Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Sat, 08 Mar 2025 15:19:02 GMT) Full text and rfc822 format available.

Notification sent to Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org>:
bug acknowledged by developer. (Sat, 08 Mar 2025 15:19:04 GMT) Full text and rfc822 format available.

Message #19 received at 76110-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: David Elsing <david.elsing <at> posteo.net>
Cc: 76694-done <at> debbugs.gnu.org, 76110-done <at> debbugs.gnu.org,
 Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org>
Subject: Re: [bug#76694] [PATCH] packages: Honor system and target system
 for graft replacements.
Date: Sat, 08 Mar 2025 16:18:23 +0100
Hi David,

David Elsing <david.elsing <at> posteo.net> skribis:

> * guix/packages.scm (input-graft, input-cross-graft): Wrap graft replacement
> in ‘with-parameters’.
> * tests/packages.scm ("package-grafts, indirect grafts")
> ("package-grafts, indirect grafts, propagated inputs")
> ("package-grafts, same replacement twice")
> ("package-grafts, dependency on several outputs")
> ("replacement also grafted"): Adjust accordingly by comparing the replacement
> after lowering to a derivation.
> ("package-grafts, indirect grafts, #:system argument"): New test.
> ---
> The modified tests are now more expensive, because comparing the
> replacements now needs to be done by comparing the resulting derivations
> due to the wrapping in <parameterized>. This requires building the
> original package.

Applied, thanks for fixing it!  I tweaked the commit log to include a
reference to the bug report and to the reporter.

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 06 Apr 2025 11:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 33 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.