FS#73500 - [duktape] support polkit by linking with libm

Attached to Project: Community Packages
Opened by tinywrkb (tinywrkb) - Tuesday, 25 January 2022, 17:04 GMT
Last edited by Toolybird (Toolybird) - Tuesday, 02 August 2022, 23:30 GMT
Task Type Feature Request
Category Packages
Status Closed
Assigned To Alexander F. Rødseth (xyproto)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Polkit now supports Duktape as the Javascript engine but it's failing with the error: "polkitd[5586]: /usr/lib/polkit-1/polkitd: Relink `/usr/lib/libduktape.so.206' with `/usr/lib/libm.so.6' for IFUNC symbol `ceil'".
So I suggest forcing linking against libm.

I also added a patch with the packaging/buildsystem changes from https://github.com/svaarala/duktape/pull/2457, so we can drop most of the buildsystem hacks, though I suggest removing the optimization flag `-Os` and just default to whatever we have in CFLAGS.
This also enables full RELRO, D_FORTIFY_SOURCE.
This task depends upon

Closed by  Toolybird (Toolybird)
Tuesday, 02 August 2022, 23:30 GMT
Reason for closing:  Fixed
Additional comments about closing:  Reporter says "Change was implemented."
Comment by tinywrkb (tinywrkb) - Tuesday, 25 January 2022, 17:56 GMT Comment by tinywrkb (tinywrkb) - Tuesday, 25 January 2022, 19:19 GMT
Updated patch as I forgot the DUK_USE_FASTINT definition.
Comment by loqs (loqs) - Tuesday, 25 January 2022, 19:28 GMT
You can avoid --no-as-needed by changing the option ordering so the source file is referenced before the library [1].

[1] https://stackoverflow.com/questions/8140494/why-am-i-getting-a-gcc-undefined-reference-error-trying-to-create-shared-objec
Comment by tinywrkb (tinywrkb) - Tuesday, 25 January 2022, 20:39 GMT
@loqs thanks! Your suggestion works and is more elegant.

Here's an updated patch that also fixes an issue that my previous suggestion introduced to the prefix variable of the pkgconfig file.
Comment by tinywrkb (tinywrkb) - Saturday, 19 February 2022, 19:08 GMT
Now that 2.7.0 is released, the buildsystem patch can be dropped, so we just need to explicitly link against libm.
I attached an updated patch for the packaging.
Comment by tinywrkb (tinywrkb) - Monday, 21 February 2022, 01:39 GMT
@arodseth I see that 2.7.0 is now in testing, but just doing pkgver bump is wrong.
Why is this bug report being ignored? Please look at the changes here.
Comment by Alexander F. Rødseth (xyproto) - Monday, 21 February 2022, 12:22 GMT
Thanks for reporting. This feature request is not being ignored. Keep in mind that this feature request was assigned to me 2022-02-16, and not 2022-01-25.
Comment by Stephan Wurm (Atomisirsi) - Monday, 07 March 2022, 19:35 GMT
2.7.0-1 is now available in community repo but does not seem to include the libm-linker-fix.
Is it safe to upgrade or should we stick to tinywrkb's PKGBUILD?
Comment by Alexander F. Rødseth (xyproto) - Wednesday, 16 March 2022, 12:09 GMT
* 2.7.0-1 does not include the changes requested by this feature request.
* It is safe to upgrade, unless you depend on this feature request being implemented.
Comment by tinywrkb (tinywrkb) - Thursday, 17 March 2022, 01:51 GMT
I tried forcing linking polkit against libm (see the attached patch), and avoid having to link duktape to libm, but it doesn't seem to help, polkit still segfaults, even when its daemon and all libs are linked against libm.
So unless I'm doing something wrong, I don't see a way to avoid linking duktape to libm, and if there's no other way to solve, then this is not a feature request but a packaging issue that should be fixed.
Comment by Alexander F. Rødseth (xyproto) - Sunday, 05 June 2022, 19:11 GMT
I'll look into this once I get my new packaging key signed.
Comment by tinywrkb (tinywrkb) - Tuesday, 02 August 2022, 23:16 GMT
My suggested change to link against libm was implemented upstream, so nothing to do here anymore.

Loading...