Description of problem: When running tps-srpmtest for devtoolset-2-elfutils under devtoolset, the rebuild of the source package fails with the following error: nm.c: In function 'show_symbols_sysv': nm.c:773:27: error: argument to 'sizeof' in '__builtin___snprintf_chk' call is the same expression as the destination; did you mean to provide an explicit length? [-Werror=sizeof-pointer-memaccess] snprintf (name, sizeof name, "[invalid sh_name %#" PRIx32 "]", ^ cc1: all warnings being treated as errors Version-Release number of selected component (if applicable): devtoolset-2-elfutils-0.155-7.el5 How reproducible: always Steps to Reproduce: 1. install devtoolset-2 2. scl enable devtoolset-2 bash 3. run tps-srpmtest Actual results: tps-srpmtest fails due to error mentioned above Expected results: successful rebuild, no failures Additional info: This issue appears on both rhel5 and rhel6, on both architectures, i386 and x86_64.
A particular example of rebuild command used by tps-srpmtest is here: rpmbuild --rebuild --define "dist .el5" --define '_topdir /usr/src/redhat' --target=i386 --rcfile /tmp/tps_rpmrc_T18959:/usr/lib/rpm/rpmrc:/usr/lib/rpm/redhat/rpmrc /mnt/redhat/brewroot/packages/devtoolset-2-elfutils/0.155/7.el5/src/devtoolset-2-elfutils-0.155-7.el5.src.rpm
This issue was exposed by the latest gcc (included in DTS). The elfutils package in DTS is compiled with the system gcc which didn't detect this issue. The upstream fix is: commit 57bd66cabf6e6b9ecf622cdbf350804897a8df58 Author: Roland McGrath <roland.com> Date: Tue Dec 11 09:42:07 2012 -0800 nm: Fix size passed to snprintf for invalid sh_name case. Signed-off-by: Roland McGrath <roland.com> with the followup: commit 7df3d2cd70932cd70515dbeb75e4db66fd27f192 Author: Mark Wielaard <mjw> Date: Tue Dec 11 22:27:05 2012 +0100 Add missing semicolon in show_symbols_sysv Signed-off-by: Mark Wielaard <mjw> patch against elfutils source: diff --git a/src/nm.c b/src/nm.c index f50da0b..7aae84b 100644 --- a/src/nm.c +++ b/src/nm.c @@ -769,8 +769,9 @@ show_symbols_sysv (Ebl *ebl, GElf_Word strndx, const char *fullname, gelf_getshdr (scn, &shdr_mem)->sh_name); if (unlikely (name == NULL)) { - name = alloca (sizeof "[invalid sh_name 0x12345678]"); - snprintf (name, sizeof name, "[invalid sh_name %#" PRIx32 "]", + const size_t bufsz = sizeof "[invalid sh_name 0x12345678]"; + name = alloca (bufsz); + snprintf (name, bufsz, "[invalid sh_name %#" PRIx32 "]", gelf_getshdr (scn, &shdr_mem)->sh_name); } scnnames[elf_ndxscn (scn)] = name;
Verified for devtoolset-2-elfutils-0.157-2.el5.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHEA-2014-0271.html