GNU bug report logs - #48849
[PATCH core-updates]: Add #:sh argument to wrap-qt-program

Previous Next

Package: guix-patches;

Reported by: Maxime Devos <maximedevos <at> telenet.be>

Date: Sat, 5 Jun 2021 14:04:01 UTC

Severity: normal

Tags: patch

Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

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 48849 in the body.
You can then email your comments to 48849 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 guix-patches <at> gnu.org:
bug#48849; Package guix-patches. (Sat, 05 Jun 2021 14:04:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Maxime Devos <maximedevos <at> telenet.be>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sat, 05 Jun 2021 14:04:02 GMT) Full text and rfc822 format available.

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

From: Maxime Devos <maximedevos <at> telenet.be>
To: guix-patches <at> gnu.org
Subject: [PATCH core-updates]: Add #:sh argument to wrap-qt-program
Date: Sat, 05 Jun 2021 13:49:23 +0200
[Message part 1 (text/plain, inline)]
Hi guix,

This patch series adds a #:sh keyword argument to wrap-qt-program
and adjusts callers to set this keyword argument appropriately.

Setting this argument appropriately is required for cross-compilation.
Otherwise, a bash for SYSTEM (as in --system=..) is used instead
of a bash for TARGET (as in --target=...).

I didn't test building some qt programs with this patch series yet,
as I'm currently waiting on the substitute servers to catch up
with recent changed to core-updates (to avoid building a tower
of rusts). I'll do that later.

Greetings,
Maxime
[0001-qt-utils-Allow-overriding-the-shell-interpreter-in-w.patch (text/x-patch, attachment)]
[0002-gnu-qbittorrent-Set-sh-argument-of-wrap-qt-program.patch (text/x-patch, attachment)]
[0003-gnu-electron-cash-Set-sh-argument-of-wrap-qt-program.patch (text/x-patch, attachment)]
[0004-gnu-qgis-Set-sh-argument-of-wrap-qt-program.patch (text/x-patch, attachment)]
[0005-gnu-keepassxc-Set-sh-argument-of-wrap-qt-program.patch (text/x-patch, attachment)]
[0006-gnu-qtpass-Set-sh-argument-of-wrap-qt-program.patch (text/x-patch, attachment)]
[0007-gnu-openshot-Set-sh-argument-of-wrap-qt-program.patch (text/x-patch, attachment)]
[0008-gnu-kristall-Set-sh-argument-of-wrap-qt-program.patch (text/x-patch, attachment)]
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#48849; Package guix-patches. (Sat, 20 Jan 2024 22:26:02 GMT) Full text and rfc822 format available.

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

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Maxime Devos <maximedevos <at> telenet.be>
Cc: 48849 <at> debbugs.gnu.org
Subject: Re: bug#48849: [PATCH core-updates]: Add #:sh argument to
 wrap-qt-program
Date: Sat, 20 Jan 2024 17:24:50 -0500
Hi Maxime,

Maxime Devos <maximedevos <at> telenet.be> writes:

> Hi guix,
>
> This patch series adds a #:sh keyword argument to wrap-qt-program
> and adjusts callers to set this keyword argument appropriately.
>
> Setting this argument appropriately is required for cross-compilation.
> Otherwise, a bash for SYSTEM (as in --system=..) is used instead
> of a bash for TARGET (as in --target=...).
>
> I didn't test building some qt programs with this patch series yet,
> as I'm currently waiting on the substitute servers to catch up
> with recent changed to core-updates (to avoid building a tower
> of rusts). I'll do that later.
>
> Greetings,
> Maxime
>
> From 27d42f25f54b16f382e18b9ef0fb202fb00da90d Mon Sep 17 00:00:00 2001
> From: Maxime Devos <maximedevos <at> telenet.be>
> Date: Sat, 5 Jun 2021 11:02:16 +0200
> Subject: [PATCH 1/8] qt-utils: Allow overriding the shell interpreter in
>  'wrap-qt-program'.
>
> * guix/build/qt-utils.scm (wrap-qt-program): Introduce a #:sh keyword
>   argument and pass it to 'wrap-program'.

If bash-minimal is added to inputs as we do for other packages making
use of wrap-program, we don't need to do more, no?  Why do we need to
explicit the argument here?

-- 
Thanks,
Maxim




Added tag(s) moreinfo. Request was from Maxim Cournoyer <maxim.cournoyer <at> gmail.com> to control <at> debbugs.gnu.org. (Sat, 20 Jan 2024 22:26:02 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#48849; Package guix-patches. (Sat, 20 Jan 2024 23:06:02 GMT) Full text and rfc822 format available.

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

From: M <maximedevos <at> telenet.be>
To: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>, 
 "48849 <at> debbugs.gnu.org" <48849 <at> debbugs.gnu.org>
Subject: RE: bug#48849: [PATCH core-updates]: Add #:sh argument
 towrap-qt-program
Date: Sun, 21 Jan 2024 00:04:57 +0100
[Message part 1 (text/plain, inline)]
>> Subject: [PATCH 1/8] qt-utils: Allow overriding the shell interpreter in
>>  'wrap-qt-program'.
>>
>> * guix/build/qt-utils.scm (wrap-qt-program): Introduce a #:sh keyword
>>   argument and pass it to 'wrap-program'.
>
> If bash-minimal is added to inputs as we do for other packages making
> use of wrap-program, we don't need to do more, no?  Why do we need to
> explicit the argument here?

Post-hoc reason (for the first patch): wrap-program has #:sh argument, wrap-qt-program doesn’t, which is inconsistent.

For the rest (to be clear I think the remaining patches can be removed):

Right, technically we don’t. The reason is to make sure that it’s the bash from inputs instead of the bash native-inputs. Currently, at first it gets the (wrong) native bash, and later on this is fixed up by the patch-shebangs phase, IIRC.

However, (IIRC) that behaviour is a bug – patch-shebangs is for /usr/bin/… -> /gnu/store/… stuff – if the code “make install” or the like already set a proper /gnu/store/… shebang, why automatically change it to something else? Presumably it set it to the right interpreter, and now patch-shebangs might autocorrupt it.

Another problem: there might not even be a patch-shebangs phase, uses of wrap-program, wrap-qt-program and the phase of the qt-build-system that uses wrap-qt-program (IIRC there exists such a phase) should be usable in isolation. Also, there is a hidden assumption that the uses of wrap-program are _before_ the shebang patching, whereas it might be run afterwards as wll.

Instead, I think it’s better for the uses of ‘wrap-program’ to directly set it to the _right_ bash.
That’s what the #:sh argument is for, but #:sh is set to by default (which “bash”), which is incorrect. Hence, #:sh needs to be set explicitly, and hence wrap-qt-program needs a #:sh argument or the like to pass on to wrap-program.

That said, I don’t think all this explicit #:sh is appropriate either – it would need to be repeated for every single package definition refering to wrap-program, etc.. Instead, for the future, I’d propose to eliminate the argument list of phases, turning phase procedures in phase thunks and stuffing the old arguments in parameter objects instead.

Then, the #:sh of ‘wrap-program’ could default to (search-input-file (inputs) “bin/inputs”) – automatically correct (without needing patch-shebangs) both for native and cross-compilation, and when cross-compiling without “bash” in (implicit) inputs, it automatically errors out (instead of doing the wrong thing as done currently).

The phases would also be a bit less verbose to write – (lambda* (#:key this that #:allow-other-keys) (proc this) stuff …) could become (lambda () (proc) stuff …).

(The ‘procedure’ syntax (inputs) for parameter objects might not be the best here, but that’s nothing some bikeshedding over the precise syntax can’t fix.)

Bst regards,
Maxime Devos

(p.s. I received the mails for the other patches but I’m not responding at the time – not active with Guix currently, and borrowing another computer because of repairs.)
[Message part 2 (text/html, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#48849; Package guix-patches. (Mon, 22 Jan 2024 05:00:02 GMT) Full text and rfc822 format available.

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

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: M <maximedevos <at> telenet.be>
Cc: "48849 <at> debbugs.gnu.org" <48849 <at> debbugs.gnu.org>
Subject: Re: bug#48849: [PATCH core-updates]: Add #:sh argument to
 wrap-qt-program
Date: Sun, 21 Jan 2024 23:58:59 -0500
Hi Maxime,

M <maximedevos <at> telenet.be> writes:

>>> Subject: [PATCH 1/8] qt-utils: Allow overriding the shell interpreter in
>>>  'wrap-qt-program'.
>>>
>>> * guix/build/qt-utils.scm (wrap-qt-program): Introduce a #:sh keyword
>>>   argument and pass it to 'wrap-program'.
>>
>> If bash-minimal is added to inputs as we do for other packages making
>> use of wrap-program, we don't need to do more, no?  Why do we need to
>> explicit the argument here?
>
> Post-hoc reason (for the first patch): wrap-program has #:sh argument,
> wrap-qt-program doesn’t, which is inconsistent.

Good point.

> For the rest (to be clear I think the remaining patches can be removed):

OK, good.

> Right, technically we don’t. The reason is to make sure that it’s the
> bash from inputs instead of the bash native-inputs. Currently, at
> first it gets the (wrong) native bash, and later on this is fixed up
> by the patch-shebangs phase, IIRC.

I see.

> However, (IIRC) that behaviour is a bug – patch-shebangs is for
> /usr/bin/… -> /gnu/store/… stuff – if the code “make install” or the
> like already set a proper /gnu/store/… shebang, why automatically
> change it to something else? Presumably it set it to the right
> interpreter, and now patch-shebangs might autocorrupt it.

Ah!  Interesting.  I haven't seen any report for such bug.

> Another problem: there might not even be a patch-shebangs phase, uses
> of wrap-program, wrap-qt-program and the phase of the qt-build-system
> that uses wrap-qt-program (IIRC there exists such a phase) should be
> usable in isolation. Also, there is a hidden assumption that the uses
> of wrap-program are _before_ the shebang patching, whereas it might be
> run afterwards as wll.
>
> Instead, I think it’s better for the uses of ‘wrap-program’ to directly set it to the _right_ bash.
> That’s what the #:sh argument is for, but #:sh is set to by default
> (which “bash”), which is incorrect. Hence, #:sh needs to be set
> explicitly, and hence wrap-qt-program needs a #:sh argument or the
> like to pass on to wrap-program.
>
> That said, I don’t think all this explicit #:sh is appropriate either
> – it would need to be repeated for every single package definition
> refering to wrap-program, etc.. Instead, for the future, I’d propose
> to eliminate the argument list of phases, turning phase procedures in
> phase thunks and stuffing the old arguments in parameter objects
> instead.
>
> Then, the #:sh of ‘wrap-program’ could default to (search-input-file
> (inputs) “bin/inputs”) – automatically correct (without needing
> patch-shebangs) both for native and cross-compilation, and when
> cross-compiling without “bash” in (implicit) inputs, it automatically
> errors out (instead of doing the wrong thing as done currently).
>
> The phases would also be a bit less verbose to write – (lambda* (#:key
> this that #:allow-other-keys) (proc this) stuff …) could become
> (lambda () (proc) stuff …).
>
> (The ‘procedure’ syntax (inputs) for parameter objects might not be
> the best here, but that’s nothing some bikeshedding over the precise
> syntax can’t fix.)

Thanks for sharing your perspective on this.  It's an interesting idea
that you are proposing, but it'd entail a massive effort to port the
code base.

Cheers!  Enjoy whatever hack you are currently pursuing!

-- 
Maxim




Removed tag(s) moreinfo. Request was from Maxim Cournoyer <maxim.cournoyer <at> gmail.com> to control <at> debbugs.gnu.org. (Mon, 22 Jan 2024 05:10:02 GMT) Full text and rfc822 format available.

Reply sent to Maxim Cournoyer <maxim.cournoyer <at> gmail.com>:
You have taken responsibility. (Mon, 22 Jan 2024 05:13:02 GMT) Full text and rfc822 format available.

Notification sent to Maxime Devos <maximedevos <at> telenet.be>:
bug acknowledged by developer. (Mon, 22 Jan 2024 05:13:02 GMT) Full text and rfc822 format available.

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

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Maxime Devos <maximedevos <at> telenet.be>
Cc: 48849-done <at> debbugs.gnu.org
Subject: Re: bug#48849: [PATCH core-updates]: Add #:sh argument to
 wrap-qt-program
Date: Mon, 22 Jan 2024 00:12:36 -0500
Hi again,

Maxime Devos <maximedevos <at> telenet.be> writes:

> Hi guix,
>
> This patch series adds a #:sh keyword argument to wrap-qt-program
> and adjusts callers to set this keyword argument appropriately.
>
> Setting this argument appropriately is required for cross-compilation.
> Otherwise, a bash for SYSTEM (as in --system=..) is used instead
> of a bash for TARGET (as in --target=...).
>
> I didn't test building some qt programs with this patch series yet,
> as I'm currently waiting on the substitute servers to catch up
> with recent changed to core-updates (to avoid building a tower
> of rusts). I'll do that later.
>
> Greetings,
> Maxime
>
> From 27d42f25f54b16f382e18b9ef0fb202fb00da90d Mon Sep 17 00:00:00 2001
> From: Maxime Devos <maximedevos <at> telenet.be>
> Date: Sat, 5 Jun 2021 11:02:16 +0200
> Subject: [PATCH 1/8] qt-utils: Allow overriding the shell interpreter in
>  'wrap-qt-program'.
>
> * guix/build/qt-utils.scm (wrap-qt-program): Introduce a #:sh keyword
>   argument and pass it to 'wrap-program'.

I see this patch was already merged by Mathieu in
77b98bf1874aac8ed447e9f0b0ee0865a1d652ba; thus, I'm closing this ticket.

Thank you!

-- 
Maxim




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 19 Feb 2024 12:24:13 GMT) Full text and rfc822 format available.

This bug report was last modified 59 days ago.

Previous Next


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