Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 948209 - sci-visualization/gnuplot: SIGSEGV when the $LANG contains encoding
Summary: sci-visualization/gnuplot: SIGSEGV when the $LANG contains encoding
Status: RESOLVED NEEDINFO
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal major
Assignee: Ulrich Müller
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 915000
  Show dependency tree
 
Reported: 2025-01-16 21:58 UTC by mtxn
Modified: 2025-01-25 18:02 UTC (History)
7 users (show)

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


Attachments
compressed build.log (build.log.xz,655.00 KB, application/x-xz)
2025-01-17 22:07 UTC, mtxn
Details
emerge --info (file_948209.txt,8.26 KB, text/plain)
2025-01-25 13:56 UTC, Sam James
Details
LD_DEBUG=symbols gnuplot (file_948209.txt,2.09 KB, text/plain)
2025-01-25 13:57 UTC, Sam James
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mtxn 2025-01-16 21:58:11 UTC
When the "LANG" environment variable contains locale with included encoding (like "en_US.utf8" OR "en_US.UTF-8"), Execution results in SIGSEGV. when the $LANG is unset OR doesn't include an encoding (like "en_US") problem does not arise.

flags:
USE="X bitmap cairo doc examples gd gpic latex lua qt6 readline wxwidgets -amos (-aqua) -libcaca -libcerf -metafont -metapost -regis -tgif" LUA_SINGLE_TARGET="lua5-4 -lua5-1 -lua5-3"
Comment 1 James Cloos 2025-01-17 07:50:13 UTC
fwiw:

my ~amd64 works ok, but i have -lua.

it also may depend on the terminal in use.  i get qt as the default terminal.
i've also test wxt.
Comment 2 mtxn 2025-01-17 17:54:12 UTC
It's some type of Heisenbug. It just somehow runs under the gdb without any trouble.
I've compiled the source manually and bug still occurs.
It looks like gnuplot SIGSEGVs before execution even hits "main" symbol.
Probably some bug in shared library.

edit.

After running the gnuplot with "LD_DEBUG=symbols" it appears that this bug has something to do with "/usr/lib64/gconv/UTF-32.so" and symbol "gconv_end" or one after it.

Sorry for sending a bug report without researching it first!
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-01-17 17:58:03 UTC
Please include emerge --info and a backtrace: https://wiki.gentoo.org/wiki/Debugging.
Comment 4 mtxn 2025-01-17 19:32:53 UTC
(In reply to Sam James from comment #3)
> Please include emerge --info and a backtrace:
> https://wiki.gentoo.org/wiki/Debugging.

I'm unable to provide a backtrace because SIGSEGV occurs when resolving dynamic libraries. 
As some form of backtrace I'm able to send some last lines of stderr of "LD_DEBUG=symbols gnuplot" before SIGSEGV

emerge --info: https://pastebin.com/uDfUn5um
LD_DEBUG=symbols gnuplot: https://pastebin.com/aNS1TN3Z

It may be an issue with sys-libs/glibc (2.40-r7)
I'm also using GCC 15 (15.0.9999) but compiling with GCC 14 (14.2.1_p20241221) has comparable results
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-01-17 19:37:30 UTC
Compiling gnuplot or glibc? It's possible the loader was miscompiled.

What version specifically (what commit) for gcc-15.0.9999 (run --version)?

Can you hit it with any other application?
Comment 6 mtxn 2025-01-17 20:02:30 UTC
(In reply to Sam James from comment #5)
> Compiling gnuplot or glibc? It's possible the loader was miscompiled.
> 
> What version specifically (what commit) for gcc-15.0.9999 (run --version)?
> 
> Can you hit it with any other application?


gcc (Gentoo 15.0.9999 p, commit 2e47edeb6aa67d66f1ebe828137dd296fd9bb4dc) 15.0.1 20250115 (experimental) bea593f115bccffcb2570fc9cd642403193265d9

I can't find any other application with the same problem.
this bug occurs only when using terminal emulator (kitty in my case) or graphical environment (Hyprland in my case), gnuplot works fine in TTY
Comment 7 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-01-17 20:28:23 UTC
(In reply to Sam James from comment #5)
> Compiling gnuplot or glibc? It's possible the loader was miscompiled.
> 

Please answer this bit too. I'll try reproduce now.

Could you also try..
emerge -v1o --with-test-deps sys-libs/glibc --usepkg=n
FEATURES=test emerge -v1 sys-libs/glibc --usepkg=n
and show me the build.log if any tests fail? (keep the builddir around if so).
Comment 8 mtxn 2025-01-17 22:07:42 UTC
Created attachment 916935 [details]
compressed build.log
Comment 9 mtxn 2025-01-17 22:11:07 UTC
After too many attempts (my fault) I got build.log (sorry for so long).
As you probably expected some tests failed.

		=== Summary of results ===
     14 FAIL
   4937 PASS
     42 UNSUPPORTED
     17 XFAIL
     10 XPASS
Comment 10 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-01-18 10:54:59 UTC
Thanks.

```
FAIL: malloc/tst-aligned-alloc
FAIL: malloc/tst-aligned-alloc-malloc-check
FAIL: malloc/tst-aligned-alloc-malloc-hugetlb1
FAIL: malloc/tst-aligned-alloc-malloc-hugetlb2
FAIL: malloc/tst-aligned-alloc-mcheck
FAIL: malloc/tst-aligned-alloc-static
FAIL: malloc/tst-aligned-alloc-static-malloc-hugetlb1
FAIL: malloc/tst-aligned-alloc-static-malloc-hugetlb2
FAIL: malloc/tst-compathooks-on
FAIL: malloc/tst-malloc-too-large
FAIL: malloc/tst-malloc-too-large-malloc-check
FAIL: malloc/tst-malloc-too-large-malloc-hugetlb1
FAIL: malloc/tst-malloc-too-large-malloc-hugetlb2
FAIL: malloc/tst-malloc-too-large-mcheck
```

These are okay. See https://sourceware.org/PR32366 which I've backported upstream to 2.39/2.40 but not yet downstream in Gentoo.
Comment 11 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-01-25 13:55:40 UTC
I still haven't been able to reproduce. Please confirm whether building glibc and gnuplot w/ GCC 14 helps?
Comment 12 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-01-25 13:56:57 UTC
Created attachment 917461 [details]
emerge --info
Comment 13 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-01-25 13:57:23 UTC
Created attachment 917462 [details]
LD_DEBUG=symbols gnuplot
Comment 14 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-01-25 13:57:56 UTC
(I've added both your pastes as attachments, as pastebins expire/may not be accessible behind firewalls.)
Comment 15 Ulrich Müller gentoo-dev 2025-01-25 15:09:25 UTC
Please tell us what version this bug is about and attach the build.log.