Date: Tue, 3 Aug 1999 16:21:53 -0700 (PDT) From: Archie Cobbs <archie@whistle.com> To: archie@whistle.com (Archie Cobbs) Cc: dwmalone@maths.tcd.ie (David Malone), grog@lemis.com, current@FreeBSD.ORG, bde@FreeBSD.ORG Subject: Re: Panic plus advice needed Message-ID: <199908032321.QAA80191@bubba.whistle.com> In-Reply-To: <199908032131.OAA76026@bubba.whistle.com> from Archie Cobbs at "Aug 3, 1999 02:31:36 pm"
next in thread | previous in thread | raw e-mail | index | archive | help
Archie Cobbs writes: > > One reason adding -g doesn't work at times is if the kernel is > > recompiled by a person with a different length username. vers.c > > is produced with a string which is a different length which screws > > up the offsets. > > > > Maybe newvers.sh should pad usernames to the legal max? Maybe we should > > warn people to touch vers.c after editing the Makefile? > > That would be really helpful to us actually and I imagine lots of people. > In fact, you don't need to pad the username, just add the right number of > zeroes to the end of the string, eg. Any objections to the patch below? And a related question: why not define ostype[], et.al. as "const" ? -Archie ___________________________________________________________________________ Archie Cobbs * Whistle Communications, Inc. * http://www.whistle.com Index: newvers.sh =================================================================== RCS file: /home/ncvs/src/sys/conf/newvers.sh,v retrieving revision 1.42 diff -u -r1.42 newvers.sh --- newvers.sh 1999/01/21 03:07:33 1.42 +++ newvers.sh 1999/08/03 23:20:32 @@ -34,6 +34,13 @@ # @(#)newvers.sh 8.1 (Berkeley) 4/20/94 # $Id: newvers.sh,v 1.42 1999/01/21 03:07:33 jkh Exp $ +# We use fixed size buffers so that the symbol table will remain the same +# no matter who does the build. These should be big enough to hold the +# corresponding strings, plus NUL. +TYPE_MAXBUF="8" +RELEASE_MAXBUF="32" +VERSION_MAXBUF="256" + TYPE="FreeBSD" REVISION="4.0" BRANCH="CURRENT" @@ -44,6 +51,20 @@ fi VERSION="${TYPE} ${RELEASE}" +# Check for overflow of fixed size string buffers +if [ ${#TYPE} -ge ${TYPE_MAXBUF} ]; then + echo "Error: increase TYPE_MAXBUF" + exit 1 +fi +if [ ${#RELEASE} -ge ${RELEASE_MAXBUF} ]; then + echo "Error: increase RELEASE_MAXBUF" + exit 1 +fi +if [ ${#VERSION} -ge ${VERSION_MAXBUF} ]; then + echo "Error: increase VERSION_MAXBUF" + exit 1 +fi + if [ "X${PARAMFILE}" != "X" ]; then RELDATE=$(awk '/__FreeBSD_version.*propagated to newvers/ {print $3}' \ ${PARAMFILE}) @@ -91,11 +112,11 @@ touch version v=`cat version` u=${USER-root} d=`pwd` h=`hostname` t=`date` echo "$COPYRIGHT" > vers.c -echo "char ostype[] = \"${TYPE}\";" >> vers.c -echo "char osrelease[] = \"${RELEASE}\";" >> vers.c +echo "char ostype[${TYPE_MAXBUF}] = \"${TYPE}\";" >> vers.c +echo "char osrelease[${RELEASE_MAXBUF}] = \"${RELEASE}\";" >> vers.c echo "int osreldate = ${RELDATE};" >> vers.c echo "char sccs[4] = { '@', '(', '#', ')' };" >>vers.c -echo "char version[] = \ +echo "char version[${VERSION_MAXBUF}] = \ \"${VERSION} #${v}: ${t}\\n ${u}@${h}:${d}\\n\";" >>vers.c echo `expr ${v} + 1` > version To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199908032321.QAA80191>