Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 797655 - sci-mathematics/singular-4.2.0_p3 segfault on amd64
Summary: sci-mathematics/singular-4.2.0_p3 segfault on amd64
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Science Mathematics related packages
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2021-06-22 21:50 UTC by François Bissey
Modified: 2021-07-02 01:03 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description François Bissey 2021-06-22 21:50:54 UTC
The current ebuild has several issues:
* the `--with-ntl="${EPREFIX}"/usr` configuration flag causes `-L/usr/lib` to be used in linking on 64bit archs. Upstream has merged PR that make the addition of the `="${EPREFIX}"/usr` unnecessary.
* the package doesn't pass its test suite one test at least fails by segfault
==================================================================
   singular 4.2.0: Singular/dyn_modules/syzextra/test-suite.log
==================================================================

# TOTAL: 1
# PASS:  0
# SKIP:  0
# XFAIL: 0
# FAIL:  1
# XPASS: 0
# ERROR: 0

.. contents:: :depth: 2

FAIL: test_release.sh
=====================

./test.sh: line 6: 463288 Segmentation fault      (core dumped) "$SINGULAR_EXECUTABLE" -tec 'LIB "schreyer.lib"; listvar(Top); example Sres; $'
FAIL test_release.sh (exit status: 1)

* Once installed the singular executable itself segfault on execution
fbissey@tarazed ~ $ singular
Segmentation fault (core dumped)

In comparison, building singular 4.2.0_p3 with sage on the machine does work. Tricking The Gentoo singular executable will not segfault when tricked into using singular's libraries built in vanilla sage with the appropriate LD_LIBRARY_PATH.

Removing the Gentoo patches has no effect. Forcing the C++ standard to c++11 has no effect.


Reproducible: Always
Comment 1 François Bissey 2021-06-22 22:12:18 UTC
The configuration flag `--disable-optimizationflags` which was added in the 4.2.0_p3 ebuild and wasn't present in 4.2.0_p1 is responsible for both the general segfault and the test failure.
Comment 2 François Bissey 2021-06-24 02:44:52 UTC
I just found that the doc_install patch has a mistake. Will add to the PR.
Comment 3 Michael Orlitzky gentoo-dev 2021-07-01 19:50:17 UTC
Sorry, I hadn't seen this yet. I added --disable-optimizationflags to keep the build system from appending all of these to CFLAGS,

OPTFLAGS="-g0 -O3 -Wno-unused-function -Wno-trigraphs -Wno-unused-parameter
  -Wunknown-pragmas -Wno-unused-variable -fomit-frame-pointer -fwrapv
  -fvisibility=default -finline-functions -fno-exceptions
  -fno-threadsafe-statics -fno-enforce-eh-specs -fconserve-space
  -funroll-loops -fno-delete-null-pointer-checks"

because they were overriding the user's own CFLAGS. Let me see if I can reproduce this with CFLAGS="-O2 -pipe", and then I'll start to add those flags back until I find the one whose absence is causing the segfault.
Comment 4 Michael Orlitzky gentoo-dev 2021-07-01 22:07:15 UTC
It looks like "-fno-delete-null-pointer-checks" avoids the segfault. Note that the problem doesn't appear when CXXFLAGS is empty; it only shows up for me with CXXFLAGS="-O2". But then CXXFLAGS="-O2 -pipe -fno-delete-null-pointer-checks" is okay.

Can you confirm that appending -fno-delete-null-pointer-checks in the ebuild (but leaving --disable-optimizationflags) fixes the issue? If so, I'll report this upstream.
Comment 5 François Bissey 2021-07-01 22:08:35 UTC
I'll be on it as soon as I can. It is a bit busy right now.
Comment 6 François Bissey 2021-07-01 23:19:33 UTC
Yes, adding that flag does the trick. No more singular crashes.
Comment 7 Michael Orlitzky gentoo-dev 2021-07-01 23:59:56 UTC
Ok, I reported upstream at https://github.com/Singular/Singular/issues/1105

If you want to update the PR I'll merge it ASAP (the other changes LGTM).
Comment 8 Larry the Git Cow gentoo-dev 2021-07-02 01:03:27 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0f67609cac00b0e0009925a651d2486f0ed61d34

commit 0f67609cac00b0e0009925a651d2486f0ed61d34
Author:     François Bissey <frp.bissey@gmail.com>
AuthorDate: 2021-07-02 00:17:49 +0000
Commit:     Michael Orlitzky <mjo@gentoo.org>
CommitDate: 2021-07-02 00:42:13 +0000

    sci-mathematics/singular: better flag control to avoid segfault
    
    Closes: https://bugs.gentoo.org/797655
    Closes: https://github.com/gentoo/gentoo/pull/21381
    Package-Manager: Portage-3.0.20, Repoman-3.0.2
    Signed-off-by: François René Pierre Bissey <frp.bissey@gmail.com>
    Signed-off-by: Michael Orlitzky <mjo@gentoo.org>

 sci-mathematics/singular/singular-4.2.0_p3-r1.ebuild | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Additionally, it has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0972e08163c4ebf06a69371ba89051758735e46a

commit 0972e08163c4ebf06a69371ba89051758735e46a
Author:     François Bissey <frp.bissey@gmail.com>
AuthorDate: 2021-06-23 02:12:37 +0000
Commit:     Michael Orlitzky <mjo@gentoo.org>
CommitDate: 2021-07-02 00:40:24 +0000

    sci-mathematics/singular: Fix QA issues in 4.2.0_p3
    
    Package-Manager: Portage-3.0.20, Repoman-3.0.2
    Bug: https://bugs.gentoo.org/797655
    Signed-off-by: François René Pierre Bissey <frp.bissey@gmail.com>
    Signed-off-by: Michael Orlitzky <mjo@gentoo.org>

 .../singular/singular-4.2.0_p3-r1.ebuild           | 104 +++++++++++++++++++++
 1 file changed, 104 insertions(+)