Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 424137 - sys-apps/mawk segfaults when building grub-2
Summary: sys-apps/mawk segfaults when building grub-2
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
Keywords: InVCS
Depends on:
Blocks: 418473
  Show dependency tree
Reported: 2012-06-29 17:01 UTC by Justin Lecher
Modified: 2012-10-18 12:42 UTC (History)
2 users (show)

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

grub-9999:20120629-165950.log.xz (grub-9999:20120629-165950.log.xz,35.76 KB, application/octet-stream)
2012-06-29 17:04 UTC, Justin Lecher
build.log (grub-2.00-r1:20121018-120907.log.xz,41.36 KB, application/octet-stream)
2012-10-18 12:13 UTC, Justin Lecher

Note You need to log in before you can comment on or make changes to this bug.
Description Justin Lecher gentoo-dev 2012-06-29 17:01:47 UTC
if test x = xyes; then   x86_64-pc-linux-gnu-strip  -o kernel.img.bin kernel.exec;    -felf64 -nr:_grub_mod_init:grub_mod_init -nr:_grub_mod_fini:grub_mod_fini -ed2022 -wd1106 -nu -nd kernel.img.bin kernel.img; else x86_64-pc-linux-gnu-strip  -R .rel.dyn -R .reginfo -R .note -R .comment -R --strip-unneeded -K start -R .note -R .comment -R  -o kernel.img kernel.exec; fi
mv syminfo.lst
cat syminfo.lst | sort | awk -f /var/tmp/portage/sys-boot/grub-9999/work/grub-9999/grub-core/genmoddep.awk > moddep.lst || (rm -f moddep.lst; exit 1)
/bin/sh: line 1: 30426 Done                    cat syminfo.lst
     30427 Broken pipe             | sort
     30428 Segmentation fault      (core dumped) | awk -f /var/tmp/portage/sys-boot/grub-9999/work/grub-9999/grub-core/genmoddep.awk > moddep.lst
make[3]: *** [moddep.lst] Error 1
make[3]: Leaving directory `/var/tmp/portage/sys-boot/grub-9999/work/build-efi-64/grub-core'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/var/tmp/portage/sys-boot/grub-9999/work/build-efi-64/grub-core'
make[1]: *** [all-recursive] Error 1

$ einfo grub:2
Portage 2.2.0_alpha114 (default/linux/amd64/10.0, gcc-4.7.1-asneeded, glibc-2.15-r2, 3.4.4-lh-iommu x86_64)
                        System Settings
System uname: Linux-3.4.4-lh-iommu-x86_64-Intel-R-_Core-TM-_i7-2600_CPU_@_3.40GHz-with-gentoo-2.1
Timestamp of tree: Fri, 29 Jun 2012 16:00:01 +0000
distcc[30555] (dcc_set_trace_from_env) ERROR: failed to open logfile /var/log/distcc.log: Permission denied [disabled]
ccache version 3.1.7 [enabled]
app-shells/bash:          4.2_p29
dev-java/java-config:     2.1.12
dev-lang/python:          2.6.8, 2.7.3-r2, 3.1.5, 3.2.3-r1
dev-util/ccache:          3.1.7
dev-util/cmake:           2.8.8-r3
dev-util/pkgconfig:       0.26
sys-apps/baselayout:      2.1-r1
sys-apps/openrc:          0.10.3
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.9.6-r3, 1.10.3, 1.11.5, 1.12.1
sys-devel/binutils:       2.22-r1
sys-devel/gcc:            4.4.7, 4.5.3-r2, 4.6.3, 4.7.0, 4.7.1
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4.2
sys-devel/make:           3.82-r3
sys-kernel/linux-headers: 3.4 (virtual/os-headers)
sys-libs/glibc:           2.15-r2
Repositories: gentoo sunrise bicatali betagarden dummy neurogeek science last-hope g-ctan
ACCEPT_KEYWORDS="amd64 ~amd64"
CFLAGS="-O2 -pipe -ftracer -march=corei7-avx -mtune=corei7-avx -mcx16 -msahf -mno-movbe -maes -mpclmul -mpopcnt -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-bmi2 -mno-tbm -mavx -mno-avx2 -msse4.2 -msse4.1 -mno-lzcnt --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=8192 -frecord-gcc-switches -g -Wimplicit-function-declaration"
CONFIG_PROTECT="/etc /usr/share/eselect/ /usr/share/gnupg/qualified.txt /usr/share/nano/ /usr/share/openvpn/easy-rsa /var/lib/hsqldb"
CONFIG_PROTECT_MASK="${EPREFIX}/etc/gconf /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="-O2 -pipe -ftracer -march=corei7-avx -mtune=corei7-avx -mcx16 -msahf -mno-movbe -maes -mpclmul -mpopcnt -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-bmi2 -mno-tbm -mavx -mno-avx2 -msse4.2 -msse4.1 -mno-lzcnt --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=8192 -frecord-gcc-switches -g -Wenum-compare"
EMERGE_DEFAULT_OPTS="--jobs=4 --load-average=12 -t --keep-going --autounmask-write --autounmask --quiet-build=n"
FCFLAGS="-O2 -pipe -ftracer -march=corei7-avx -mtune=corei7-avx -mcx16 -msahf -mno-movbe -maes -mpclmul -mpopcnt -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-bmi2 -mno-tbm -mavx -mno-avx2 -msse4.2 -msse4.1 -mno-lzcnt --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=8192 -frecord-gcc-switches -g"
FEATURES="assume-digests binpkg-logs buildsyspkg ccache collision-protect distlocks ebuild-locks fixlafiles metadata-transfer multilib-strict news noinfo parallel-fetch parallel-install parse-eapi-ebuild-head preserve-libs protect-owned sandbox sfperms sign split-log splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"
FFLAGS="-O2 -pipe -ftracer -march=corei7-avx -mtune=corei7-avx -mcx16 -msahf -mno-movbe -maes -mpclmul -mpopcnt -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-bmi2 -mno-tbm -mavx -mno-avx2 -msse4.2 -msse4.1 -mno-lzcnt --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=8192 -frecord-gcc-switches -g"
GENTOO_MIRRORS=" /mnt/tmpfs/"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,-O1 -Wl,--hash-style=gnu -Wl,--sort-common"
MAKEOPTS="-j16 -l12"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTDIR_OVERLAY="/local/overlays/sunrise-reviewed /local/overlays/bicatali /local/overlays/betagarden /local/overlays/dummy /local/overlays/neurogeek /local/overlays/sci /local/overlays/lh/ebuilds /local/overlays/g-ctan"
USE="X acl alsa amd64 avx bash-completion berkdb branding bzip2 cairo caps cli cracklib crypt cups cxx dbus dri fortran gdbm gif gmp gnome gnome-keyring gpm gstreamer gtk iconv icu ipv6 jpeg jpeg2k mmx mmxext modules mudflap multilib ncurses network-cron nls nptl nsplugin numa opengl openmp pam pcre png pppd pulseaudio qt3support raw readline session smp sse sse2 sse3 sse4 sse4_1 sse4a ssl startup-notification tcpd threads tiff truetype unicode vaapi vdpau xinerama xorg zlib" ALSA_CARDS="hda-intel" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="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" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" DRACUT_MODULES="plymouth" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en" PYTHON_TARGETS="pypy1_9 python3_1 python3_2 python2_6 python2_7" QEMU_SOFTMMU_TARGETS="i386 x86_64" QEMU_USER_TARGETS="i386 x86_64" RUBY_TARGETS="ruby19" USERLAND="GNU" VIDEO_CARDS="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"
USE_PYTHON="2.6 2.7 3.1 3.2 2.7-pypy-1.9"

                        Package Settings

sys-boot/grub-9999 was built with the following:
USE="(multilib) nls truetype -custom-cflags -debug -device-mapper -efiemu -libzfs -mount -sdl -static" GRUB_PLATFORMS="efi-64 -coreboot -efi-32 -emu -ieee1275 -multiboot -pc -qemu -qemu-mips -yeeloong"
Comment 1 Justin Lecher gentoo-dev 2012-06-29 17:04:09 UTC
Created attachment 316629 [details]

Comment 2 Justin Lecher gentoo-dev 2012-06-29 17:05:14 UTC
Please make sure the buildsystem calls gawk directly if needed and doesn't rely on the symlink to be correct
Comment 3 Mike Gilbert gentoo-dev 2012-06-29 17:25:20 UTC
Seems strange that mawk would segfault.
Comment 4 SpanKY gentoo-dev 2012-06-29 17:53:07 UTC
yes, ignoring segfaults by forcing gawk isn't the right fix here.  the awk code looks fairly straight forward and not gawk specific.
Comment 5 Justin Lecher gentoo-dev 2012-06-29 18:43:24 UTC
So with gawk it works fine.
Comment 6 SpanKY gentoo-dev 2012-06-29 20:07:55 UTC
(In reply to comment #5)

so you've confirmed gawk is not buggy, but mawk is :)

what version of mawk are you using exactly ?  mawk-1.3.4_p20120627 was added to the tree yesterday.  if that crashes, you probably want to take the issue to the mawk mailing lists.
Comment 7 Justin Lecher gentoo-dev 2012-06-30 10:31:48 UTC
So latest version of mawk is the only one which makes it segf.
Comment 8 Christoph Junghans gentoo-dev 2012-10-12 07:48:41 UTC
Reported upstream.
Comment 9 Christoph Junghans gentoo-dev 2012-10-12 17:08:56 UTC
Reported and fixed hardcoded awk in grub:

So building of grub will work as long as gawk is installed and even if mawk is eselected.
Comment 10 Christoph Junghans gentoo-dev 2012-10-16 10:43:18 UTC
(In reply to comment #9)
> Reported and fixed hardcoded awk in grub:
> <>
> So building of grub will work as long as gawk is installed and even if mawk
> is eselected.
Fix got merged upstream, so grub will use gawk instead of awk.

Bug in mawk is reported, but will not harm us anymore.
Comment 11 Justin Lecher gentoo-dev 2012-10-18 12:13:02 UTC
Still valid with grub-2.00-r1

v syminfo.lst
cat syminfo.lst | sort | awk -f /var/tmp/portage/sys-boot/grub-2.00-r1/work/grub-2.00/grub-core/genmoddep.awk > moddep.lst || (rm -f moddep.lst; exit 1)
/bin/sh: line 1: 27257 Done                    cat syminfo.lst
     27258 Broken pipe             | sort
     27259 Segmentation fault      (core dumped) | awk -f /var/tmp/portage/sys-boot/grub-2.00-r1/work/grub-2.00/grub-core/genmoddep.awk > moddep.lst
make[3]: *** [moddep.lst] Error 1
make[3]: Leaving directory `/var/tmp/portage/sys-boot/grub-2.00-r1/work/build-pc/grub-core'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/var/tmp/portage/sys-boot/grub-2.00-r1/work/build-pc/grub-core'
Comment 12 Justin Lecher gentoo-dev 2012-10-18 12:13:35 UTC
Created attachment 326834 [details]
Comment 13 Christoph Junghans gentoo-dev 2012-10-18 12:42:29 UTC
Fixed in 2.00-r1 as well.