Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 561938 - media-gfx/fontforge encoding.c:(.text+0x6c3d): undefined reference to `__warn_memset_zero_len'
Summary: media-gfx/fontforge encoding.c:(.text+0x6c3d): undefined reference to `__warn...
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Fonts Team
URL: https://github.com/fontforge/fontforg...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-01 01:08 UTC by cristiano04
Modified: 2020-05-13 23:49 UTC (History)
3 users (show)

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


Attachments
build.log (build.log,454.32 KB, text/plain)
2015-10-09 02:11 UTC, Ian Stakenvicius (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description cristiano04 2015-10-01 01:08:15 UTC
It fails every single time.
Impossible to upgrade to Plasma without solving this dependency.

Reproducible: Always

Steps to Reproduce:
1. emerge media-gfx/fontforge
2. Fails




emerge --info
Portage 2.2.20.1 (python 2.7.10-final-0, default/linux/amd64/13.0/desktop/plasma, gcc-4.8.5, glibc-2.22, 3.18.20 x86_64)
=================================================================
System uname: Linux-3.18.20-x86_64-Intel-R-_Core-TM-_i5-4570_CPU_@_3.20GHz-with-gentoo-15
KiB Mem:     8108176 total,   1018964 free
KiB Swap:    8108028 total,   8107952 free
Timestamp of repository gentoo: Wed, 30 Sep 2015 18:30:01 +0000
sh bash 4.3_p39
ld GNU ld (Gentoo 2.25.1 p1.1) 2.25.1
app-shells/bash:          4.3_p39::gentoo
dev-lang/perl:            5.20.2::gentoo
dev-lang/python:          2.7.10::gentoo, 3.4.3::gentoo
dev-util/cmake:           3.3.2::gentoo
dev-util/pkgconfig:       0.28-r2::gentoo
sys-apps/baselayout:      2.2::gentoo
sys-apps/openrc:          0.17::gentoo
sys-apps/sandbox:         2.6-r1::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69::gentoo
sys-devel/automake:       1.10.3-r1::gentoo, 1.11.6-r1::gentoo, 1.13.4::gentoo, 1.14.1::gentoo, 1.15::gentoo
sys-devel/binutils:       2.25.1-r1::gentoo
sys-devel/gcc:            4.8.5::gentoo, 5.2.0::gentoo
sys-devel/gcc-config:     1.7.3::gentoo
sys-devel/libtool:        2.4.6::gentoo
sys-devel/make:           4.1-r1::gentoo
sys-kernel/linux-headers: 3.18::gentoo (virtual/os-headers)
sys-libs/glibc:           2.22::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.europe.gentoo.org/gentoo-portage
    priority: -1000

distros
    location: /var/lib/layman/distros
    masters: gentoo
    priority: 0

kde
    location: /var/lib/layman/kde
    masters: gentoo
    priority: 2

gentoo-zh
    location: /var/lib/layman/gentoo-zh
    masters: gentoo
    priority: 3

jorgicio
    location: /var/lib/layman/jorgicio
    masters: gentoo
    priority: 4

soft
    location: /var/lib/layman/soft
    masters: gentoo
    priority: 5

Installed sets: @custom
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=core-avx-i  -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/themes/oxygen-gtk/gtk-2.0 /usr/share/themes/oxygen-gtk/gtk-3.0"
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/splash /etc/terminfo"
CXXFLAGS="-O2 -march=core-avx-i  -pipe"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="-j5"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs buildpkg config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j5"
PKGDIR="/home/cris/pkg/"
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"
PORTAGE_TMPDIR="/var/tmp"
USE="X a52 aac acpi alsa amd64 aspell avx avx_2 bazaar berkdb branding bzip2 cairo caps cdda cdr cjk cli consolekit cracklib crypt cups custom-cflags cvs cxx darcs dbus declarative dri dts dvd dvdr emacs emacs-syntax emboss encode exif fam ffmpeg firefox flac fontconfig fortran gdbm gif git glamor gpg gpm gtk hardened iconv idn infinality ipv6 ithreads jbig jpeg jpeg2k kde kipi lcms ldap libnotify lzma lzo mad mem-scramble mercurial mmx mmxext mng modules mp3 mp4 mpeg multilib ncurses nls nptl ogg opencl openexr opengl openmp otr pam pango pcre pdf phonon plasma png polarssl policykit ppds qml qt3support qt4 qt5 readline sasl sdl seccomp semantic-desktop session socks socks5 spell sse sse2 sse3 sse4 sse4_1 sse4_2 ssl ssse3 subversion svg tcpd theora threads tiff truetype tsx tta udev udisks unicode upower usb vorbis wavpack widgets wxwidgets x264 xcb xcomposite xetex xft xinerama xml xscreensaver xv xvid xz zlib" ABI_X86="64 32" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" 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" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2" 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 ublox ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4" RUBY_TARGETS="ruby20 ruby21" USERLAND="GNU" VIDEO_CARDS="radeon radeonsi" 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_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON


___


BUILD.LOG (where it failed)

.libs/libfontforge_la-encoding.o: In function `EncMapFromEncoding':
encoding.c:(.text+0x6c3d): undefined reference to `__warn_memset_zero_len'
collect2: error: ld returned 1 exit status
Makefile:1444: recipe for target 'libfontforge.la' failed
make[2]: *** [libfontforge.la] Error 1
make[2]: Leaving directory '/var/tmp/portage/media-gfx/fontforge-20150430/work/fontforge-20150430/fontforge'
Makefile:1491: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/var/tmp/portage/media-gfx/fontforge-20150430/work/fontforge-20150430'
Makefile:1328: recipe for target 'all' failed
make: *** [all] Error 2
 * ERROR: media-gfx/fontforge-20150430::gentoo failed (compile phase):
 *   emake failed
 * 
 * If you need support, post the output of `emerge --info '=media-gfx/fontforge-20150430::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=media-gfx/fontforge-20150430::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/media-gfx/fontforge-20150430/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/media-gfx/fontforge-20150430/temp/environment'.
 * Working directory: '/var/tmp/portage/media-gfx/fontforge-20150430/work/fontforge-20150430'
 * S: '/var/tmp/portage/media-gfx/fontforge-20150430/work/fontforge-20150430'
Comment 1 Rafał Mużyło 2015-10-01 09:20:02 UTC
The snippet is inconclusive - attach the whole log.
Comment 2 cristiano04 2015-10-01 13:09:00 UTC
(In reply to Rafał Mużyło from comment #1)
> The snippet is inconclusive - attach the whole log.

As you wish.


... for some reason the 'add an attachment' option isn't working so: http://s000.tinyupload.com/download.php?file_id=03073235506804015775&t=0307323550680401577560547
Comment 3 Ian Stakenvicius (RETIRED) gentoo-dev 2015-10-09 02:11:59 UTC
Created attachment 414170 [details]
build.log
Comment 4 Mike Gilbert gentoo-dev 2015-10-09 09:37:33 UTC
toolchain: Any idea what is happening here?
Comment 5 SpanKY gentoo-dev 2015-10-09 12:27:47 UTC
this is WAI.  fontforge has bad code and thus glibc forces it to fail.  the log:
In file included from /usr/include/string.h:635:0,
                 from ../lib/string.h:41,
                 from fontforge.h:35,
                 from fontforgevw.h:30,
                 from encoding.c:28:
In function ‘memset’,
    inlined from ‘EncMapFromEncoding’ at encoding.c:1868:11:
/usr/include/bits/string3.h:86:30: warning: call to ‘__warn_memset_zero_len’ declared with attribute warning: memset used with constant zero length parameter; this could be due to transposed parameters [enabled by default]
       __warn_memset_zero_len ();
                              ^

the solution: don't call memset with len=0.  it's pointless and most likely a bug in the code.
Comment 6 Mike Gilbert gentoo-dev 2015-10-09 18:33:44 UTC
Line 1868 of fontforge/encoding.c is this:

memset(encoded,-1,base*sizeof(int32));

The warning states it is being called with a constant zero parameter -- which clearly is not true. The 'base' parameter may be zero, but it is not always and the code seems correct to me.

Also, I am unable to reproduce this failure with glibc-2.21 and gcc-4.8.5 or gcc-5.2.0.

Can you take a closer look? This seems like something weird, possibly relayed to glibc-2.22.
Comment 7 SpanKY gentoo-dev 2015-10-09 19:13:04 UTC
(In reply to Mike Gilbert from comment #6)

the code is being called with a constant param.  look up a few lines to see where base is set to constants.  the first if statement:
    if ( enc->is_original )
        base = 0;

it doesn't fail with gcc-5+ because glibc includes this fortification checking only for <=gcc-4.9.  it doesn't need it with gcc-5+ because the compiler itself will take care of warning for you.

the code looks suspicious to me in general because it does:
  base = 0;
  encoded = malloc(base*sizeof(int32));  <-- this may return NULL
  memset(encoded,-1,base*sizeof(int32));
then based on other parameters, it'll write to the encoded pointer later on.  i'm not familiar with the codebase though to say whether it's possible to pass in arguments such that you'll deref the NULL pointer.

at any rate, you can workaround it by adding a sanity check like:
  if (base)
    memset(encoded,-1,base*sizeof(int32));

i can't see glibc or gcc changing here.
Comment 8 Mike Gilbert gentoo-dev 2015-10-09 20:57:21 UTC
I guess I'm still a bit mystified as to why I a unable to reproduce the warning with either gcc 4.8.5 or 5.2.0. I have -Wall in CFLAGS but I still don't see it.
Comment 9 SpanKY gentoo-dev 2015-10-09 21:53:26 UTC
(In reply to Mike Gilbert from comment #8)

reproduced fine for me w/gcc-4.8 and gcc-4.9.  it makes sense that you won't hit it with gcc-5+ because glibc specifically disables the code for those versions.
Comment 10 Mike Gilbert gentoo-dev 2015-10-09 23:02:07 UTC
Are you on glibc 2.22?  I'm still using 2.21. 

Also, if gcc5 has the warning built in, I should be seeing that, no?
Comment 11 SpanKY gentoo-dev 2015-10-10 00:48:44 UTC
(In reply to Mike Gilbert from comment #10)

yes, i'm using glibc-2.22

gcc-5 not warning is most likely due to different heuristics in use by gcc.  i would have to read its source to figure out in what scenarios exactly it would issue the warning.  but does that really matter here ?
Comment 12 Mike Gilbert gentoo-dev 2017-01-25 17:11:40 UTC
I reported the issue upstream. If someone wants to submit a patch, please do.
Comment 13 Andreas K. Hüttel archtester gentoo-dev 2017-10-03 17:25:29 UTC
Not really a toolchain problem, also noone has filed duplicates... -> ?