Bug 345651

Summary: rebuilt m4 dies with: %n in writable segment detected
Product: [Fedora] Fedora Reporter: Doug Chapman <dchapman>
Component: m4Assignee: Vitezslav Crhonek <vcrhonek>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: high    
Version: rawhide   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-12-20 11:57:11 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 163350    

Description Doug Chapman 2007-10-22 18:14:41 UTC
Description of problem:
I realize m4 has not changed but I still think this is a bug in m4...

If m4 is built from .src.rpm under F8T3 I then get errors during autoreconf of
other packages built using it:

*** %n in writable segment detected ***

sh: line 1:  7373 Aborted                 /usr/bin/m4 --nesting-limit=1024
--include=/usr/share/autoconf --debug=aflq --fatal-warning
--debugfile=autom4te.cache/traces.0t --trace=AC_ --trace=AC_DEFUN
--trace=AC_DEFUN_ONCE --trace=AC_LIB_APPENDTOVAR --trace=AC_LIB_ARG_WITH
--trace=AC_LIB_HAVE_LINKFLAGS --trace=AC_LIB_LINKFLAGS
--trace=AC_LIB_LINKFLAGS_BODY --trace=AC_LIB_LINKFLAGS_FROM_LIBS
--trace=AC_LIB_PREFIX --trace=AC_LIB_PREPARE_MULTILIB
--trace=AC_LIB_PREPARE_PREFIX --trace=AC_LIB_PROG_LD --trace=AC_LIB_PROG_LD_GNU
--trace=AC_LIB_RPATH --trace=AC_LIB_WITH_FINAL_PREFIX --trace=AC_TYPE_SOCKLEN_T
--trace=AC_TYPE_SSIZE_T --trace=AM_ICONV --trace=AM_ICONV_LINK
--trace=AM_ICONV_LINKFLAGS_BODY --trace=AU_DEFUN --trace=_AM_AUTOCONF_VERSION
--trace=_m4_warn --trace=include --trace=m4_include --trace=m4_pattern_allow
--trace=m4_pattern_forbid
--reload-state=/usr/share/autoconf/autoconf/autoconf.m4f
/usr/share/aclocal/iconv.m4 /usr/share/aclocal/lib-ld.m4
/usr/share/aclocal/lib-link.m4 /usr/share/aclocal/lib-prefix.m4 configure.in >
autom4te.cache/output.0t

autom4te: /usr/bin/m4 failed with exit status: 134



This was seen as I was building Fedora 8 for ia64 but I have reproduced it on
x86_64.  Evidently something in the build environment has changed to be more
strict with respect to using the %n format.  I believe this strict checking was
added to improve security.

This is easily reproduced on x86_64 (and I assume any other arch) using the
procedure below.  It has not been a big problem for existing arches yet since m4
has not needed to be rebuilt but it is blocking the bringup of Fedora on ia64
and other arches and will break on existing arches as soon as m4 needs to be
rebuilt.


Version-Release number of selected component (if applicable):
m4-1.4.10-1.fc8 - as rebuilt undr Fedora 8 Test 3

How reproducible:
100%

Steps to Reproduce:
1. Install or update to Fedora 8 Test 3
2. rpmbuild --rebuild -bb m4-1.4.10-1.fc8.src.rpm
3. rpm -e --nodeps m4
4. rpm -ivh <your newly built m4 rpm>
5. rpmbuild --rebuild -bb tcsh-6.15-1.fc8.src.rpm

Note that it is far from just tcsh that fails to build, many packages will fail
during the configure stage with the new m4.

  
Actual results:
*** %n in writable segment detected ***

sh: line 1:  7373 Aborted                 /usr/bin/m4 --nesting-limit=1024
--include=/usr/share/autoconf --debug=aflq --fatal-warning
--debugfile=autom4te.cache/traces.0t --trace=AC_ --trace=AC_DEFUN
--trace=AC_DEFUN_ONCE --trace=AC_LIB_APPENDTOVAR --trace=AC_LIB_ARG_WITH
--trace=AC_LIB_HAVE_LINKFLAGS --trace=AC_LIB_LINKFLAGS
--trace=AC_LIB_LINKFLAGS_BODY --trace=AC_LIB_LINKFLAGS_FROM_LIBS
--trace=AC_LIB_PREFIX --trace=AC_LIB_PREPARE_MULTILIB
--trace=AC_LIB_PREPARE_PREFIX --trace=AC_LIB_PROG_LD --trace=AC_LIB_PROG_LD_GNU
--trace=AC_LIB_RPATH --trace=AC_LIB_WITH_FINAL_PREFIX --trace=AC_TYPE_SOCKLEN_T
--trace=AC_TYPE_SSIZE_T --trace=AM_ICONV --trace=AM_ICONV_LINK
--trace=AM_ICONV_LINKFLAGS_BODY --trace=AU_DEFUN --trace=_AM_AUTOCONF_VERSION
--trace=_m4_warn --trace=include --trace=m4_include --trace=m4_pattern_allow
--trace=m4_pattern_forbid
--reload-state=/usr/share/autoconf/autoconf/autoconf.m4f
/usr/share/aclocal/iconv.m4 /usr/share/aclocal/lib-ld.m4
/usr/share/aclocal/lib-link.m4 /usr/share/aclocal/lib-prefix.m4 configure.in >
autom4te.cache/output.0t

autom4te: /usr/bin/m4 failed with exit status: 134

aclocal: autom4te failed with exit status: 134

autoreconf: aclocal failed with exit status: 134

error: Bad exit status from /var/tmp/rpm-tmp.9066 (%build)



Expected results:


Additional info:

Comment 1 Doug Chapman 2007-10-22 18:20:15 UTC
There is some discussion about this issue here:

http://www.nabble.com/vasnprintf's-%22-n-in-writable-segment%22-chokes-with-_FORTIFY_SOURCE-%3D%3D-2-t4645780.html