Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 628744 - sys-devel/flex-2.6.4 with sys-libs/glibc-2.26 - Segmentation fault: …src/stage1flex -o stage1scan.c …/src/scan.l
Summary: sys-devel/flex-2.6.4 with sys-libs/glibc-2.26 - Segmentation fault: …src/stag...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo's Team for Core System packages
URL: https://github.com/westes/flex/issues...
Whiteboard: fixed in 2.6.4-r4
Keywords: PATCH
: 634984 (view as bug list)
Depends on:
Blocks: c99-porting glibc-2.26
  Show dependency tree
 
Reported: 2017-08-23 17:37 UTC by iGentoo
Modified: 2024-10-25 19:16 UTC (History)
4 users (show)

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


Attachments
flex-2.6.4-build.log (flex-2.6.4-build.log,59.05 KB, text/plain)
2017-08-23 17:37 UTC, iGentoo
Details
workaround patch (flex-2.6.4-glibc-2.26.patch,321 bytes, patch)
2017-08-23 17:39 UTC, iGentoo
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description iGentoo 2017-08-23 17:37:38 UTC
Created attachment 490322 [details]
flex-2.6.4-build.log

/bin/bash ../libtool  --tag=CC   --mode=link x86_64-pc-linux-gnu-gcc  -Wall -march=native -O2 -pipe -frecord-gcc-switches -ggdb  -Wl,-O1 -Wl,--as-needed -o stage1flex stage1flex-scan.o stage1flex-buf.o stage1flex-ccl.o stage1flex-dfa.o stage1flex-ecs.o stage1flex-filter.o stage1flex-gen.o stage1flex-main.o stage1flex-misc.o stage1flex-nfa.o stage1flex-options.o stage1flex-parse.o stage1flex-regex.o stage1flex-scanflags.o stage1flex-scanopt.o stage1flex-skel.o stage1flex-sym.o stage1flex-tables.o stage1flex-tables_shared.o stage1flex-tblcmp.o stage1flex-yylex.o    -lm 
libtool: link: x86_64-pc-linux-gnu-gcc -Wall -march=native -O2 -pipe -frecord-gcc-switches -ggdb -Wl,-O1 -o stage1flex stage1flex-scan.o stage1flex-buf.o stage1flex-ccl.o stage1flex-dfa.o stage1flex-ecs.o stage1flex-filter.o stage1flex-gen.o stage1flex-main.o stage1flex-misc.o stage1flex-nfa.o stage1flex-options.o stage1flex-parse.o stage1flex-regex.o stage1flex-scanflags.o stage1flex-scanopt.o stage1flex-skel.o stage1flex-sym.o stage1flex-tables.o stage1flex-tables_shared.o stage1flex-tblcmp.o stage1flex-yylex.o  -Wl,--as-needed -lm
./stage1flex   -o stage1scan.c /var/tmp/portage/sys-devel/flex-2.6.4/work/flex-2.6.4/src/scan.l
make[2]: *** [Makefile:1696: stage1scan.c] Segmentation fault (core dumped)
make[2]: Leaving directory '/var/tmp/portage/sys-devel/flex-2.6.4/work/flex-2.6.4-abi_x86_64.amd64/src'




(gdb) run 
Starting program: /var/tmp/portage/sys-devel/flex-2.6.4/work/flex-2.6.4-abi_x86_64.amd64/src/stage1flex -o stage1scan.c /var/tmp/portage/sys-devel/flex-2.6.4/work/flex-2.6.4/src/scan.l

Program received signal SIGSEGV, Segmentation fault.
flexinit (argc=4, argv=0x7fffffffdeb8) at /var/tmp/portage/sys-devel/flex-2.6.4/work/flex-2.6.4/src/main.c:976
976		action_array[0] = '\0';
(gdb) backtrace 
#0  flexinit (argc=4, argv=0x7fffffffdeb8) at /var/tmp/portage/sys-devel/flex-2.6.4/work/flex-2.6.4/src/main.c:976
#1  0x000000010002f5ff in flex_main (argc=4, argv=0x7fffffffdeb8) at /var/tmp/portage/sys-devel/flex-2.6.4/work/flex-2.6.4/src/main.c:168
#2  0x00007f5fb3132f3a in __libc_start_main () from /lib64/libc.so.6
#3  0x000000010001a59a in _start ()
(gdb) 



Portage 2.3.8 (python 3.6.1-final-0, default/linux/amd64/17.0, gcc-7.2.0, glibc-2.26, 4.12.8-gentoo.x86_64 x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-4.12.8-gentoo.x86_64-x86_64-Intel-R-_Core-TM-2_Quad_CPU_Q9300_@_2.50GHz-with-gentoo-2.4.1
KiB Mem:     6118040 total,    713208 free
KiB Swap:    6291452 total,   6267008 free
Head commit of repository gentoo: ee14e170f16813fd85379f7d5617db3b6c5b3b8d

sh dash 0.5.9.1-r2
ld GNU gold (Gentoo 2.29 p1.0 2.29) 1.14
ccache version 3.3.4 [disabled]
app-shells/bash:          4.4_p12::gentoo
dev-java/java-config:     2.2.0-r3::gentoo
dev-lang/perl:            5.26.0::gentoo
dev-lang/python:          2.7.13::gentoo, 3.6.1-r1::gentoo
dev-util/ccache:          3.3.4::gentoo
dev-util/cmake:           3.9.1::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.4.1-r1::gentoo
sys-apps/sandbox:         2.11-r5::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r4::gentoo
sys-devel/automake:       1.15.1-r1::gentoo
sys-devel/binutils:       2.29::gentoo
sys-devel/gcc:            7.2.0::local-repo
sys-devel/gcc-config:     1.8-r1::gentoo
sys-devel/libtool:        2.4.6-r4::gentoo
sys-devel/make:           4.2.1-r1::gentoo
sys-kernel/linux-headers: 4.12::local-repo (virtual/os-headers)
sys-libs/glibc:           2.26::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: git
    sync-uri: git://anongit.gentoo.org/repo/gentoo.git
    sync-user: portage
    priority: -1000
    eclass-overrides: local-repo

local-repo
    location: /usr/local/portage
    masters: gentoo

Installed sets: @local
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-Wall -march=native -O2 -pipe -frecord-gcc-switches"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-Wall -march=native -O2 -pipe -frecord-gcc-switches"
DISTDIR="/var/portage/distfiles"
EMERGE_DEFAULT_OPTS="--color=n --keep-going --oneshot"
FCFLAGS="-Wall -march=native -O2 -pipe -frecord-gcc-switches"
FEATURES="assume-digests binpkg-logs buildpkg collision-protect config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync metadata-transfer multilib-strict news parallel-fetch preserve-libs protect-owned sandbox sfperms split-log strict test-fail-continue unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-Wall -march=native -O2 -pipe -frecord-gcc-switches"
GENTOO_MIRRORS="http://mirrors.163.com/gentoo http://distfiles.gentoo.org"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="V=1 -j5"
PKGDIR="/var/portage/packages"
PORTAGE_BZIP2_COMMAND="lbzip2"
PORTAGE_COMPRESS="xz"
PORTAGE_COMPRESS_FLAGS="-9T0"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="X acl amd64 audit berkdb bzip2 cli cracklib crypt cxx dbus dri egl fortran gdbm gles2 iconv icu ipv6 jpeg modules multilib ncurses nls nptl opengl openmp pam pax_kernel pcre pic png policykit pulseaudio readline seccomp session ssl systemd tcpd unicode vdpau vim-syntax wayland xattr zlib" ABI_X86="64 32 x32" ALSA_CARDS="hda-intel" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2 sse3 sse4_1 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput" KERNEL="linux" L10N="zh-CN" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="zh_CN" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" POSTGRES_TARGETS="postgres9_5" PYTHON_SINGLE_TARGET="python3_6" PYTHON_TARGETS="python2_7 python3_6" RUBY_TARGETS="ruby24" USERLAND="GNU" VIDEO_CARDS="nouveau nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_RSYNC_EXTRA_OPTS

=================================================================
                        Package Settings
=================================================================

sys-devel/flex-2.6.4::gentoo was built with the following:
USE="nls -static -test" ABI_X86="32 64 x32"
Comment 1 iGentoo 2017-08-23 17:39:06 UTC
Created attachment 490324 [details, diff]
workaround patch
Comment 2 Sergei Trofimovich (RETIRED) gentoo-dev 2017-09-09 08:14:13 UTC
It's caused by reallocarray() added to glibc-2.26.
The problem is lack of #define _GNU_SOURCE (or any other
way to pull explicit prototype). Fixed upstream as:

    https://github.com/westes/flex/commit/24fd0551333e7eded87b64dd36062da3df2f6380
Comment 3 Larry the Git Cow gentoo-dev 2017-10-13 20:19:34 UTC
The bug has been closed via the following commit(s):

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

commit aa6c077d00c3a21b75ae646421aefadcad527f80
Author:     Thomas Deutschmann <whissi@gentoo.org>
AuthorDate: 2017-10-13 20:16:10 +0000
Commit:     Thomas Deutschmann <whissi@gentoo.org>
CommitDate: 2017-10-13 20:19:23 +0000

    sys-devel/flex: Rev bump to fix multiple problems
    
    Closes: https://bugs.gentoo.org/628744
    Closes: https://bugs.gentoo.org/625508
    See: https://bugs.gentoo.org/632523
    Package-Manager: Portage-2.3.10, Repoman-2.3.3

 .../flex-2.6.4-fix-build-with-glibc2.6+.patch      | 767 +++++++++++++++++++++
 sys-devel/flex/files/flex-2.6.4-libobjdir.patch    |  26 +
 sys-devel/flex/flex-2.6.4-r1.ebuild                |  85 +++
 3 files changed, 878 insertions(+)
Comment 4 Johannes Markert 2017-10-23 09:48:26 UTC
*** Bug 634984 has been marked as a duplicate of this bug. ***
Comment 5 Larry the Git Cow gentoo-dev 2022-10-25 11:42:38 UTC
The bug has been referenced in the following commit(s):

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

commit bec6a7be57fc3493dccef497b5d4b513c315f5f1
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2022-10-25 11:41:32 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-10-25 11:42:25 +0000

    sys-devel/flex: backport "config.h" fix too
    
    We already have the patch to config.h/configure.ac backported
    but we don't have the fix to actually *use* config.h everywhere,
    and clearly from bug #705800 it wasn't sufficient to just backport
    it (for reasons covered in the bug & upstream bug).
    
    Bug: https://bugs.gentoo.org/628744
    Bug: https://bugs.gentoo.org/705800
    Signed-off-by: Sam James <sam@gentoo.org>

 .../flex/files/flex-2.6.4-implicit-func-decl.patch | 50 ++++++++++++
 sys-devel/flex/flex-2.6.4-r3.ebuild                | 95 ++++++++++++++++++++++
 2 files changed, 145 insertions(+)
Comment 6 Larry the Git Cow gentoo-dev 2022-10-28 01:54:55 UTC
The bug has been referenced in the following commit(s):

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

commit af4a94a1b5b778c0d983fbe6370b5ded4e6b54e1
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2022-10-28 00:35:41 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-10-28 01:54:19 +0000

    sys-devel/flex: backport further macro fixes
    
    The gist is that the original glibc-2.26 patch was incomplete
    and didn't help with cross-compilation or non-glibc environments
    fully.
    
    There were a succession of further upstream commits
    now backported here. Noticed when doing some more Clang 16 work.
    
    This complements bec6a7be57fc3493dccef497b5d4b513c315f5f1 in that
    more effort is taken to ensure all necessary macros are defined
    so needed functions are available.
    
    Bug: https://bugs.gentoo.org/628744
    Bug: https://bugs.gentoo.org/705800
    See: bec6a7be57fc3493dccef497b5d4b513c315f5f1
    See: 4d77781e2db7bb8bef7f390c43efc04ba58ff7bb
    See: aa6c077d00c3a21b75ae646421aefadcad527f80
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-devel/flex/Manifest                            |   2 +-
 .../flex-2.6.4-fix-build-with-glibc2.26.patch      | 219 +++++++++++++++++++++
 .../{flex-2.6.4-r3.ebuild => flex-2.6.4-r4.ebuild} |  20 +-
 3 files changed, 233 insertions(+), 8 deletions(-)