From owner-freebsd-current Tue Aug 3 16:22:43 1999 Delivered-To: freebsd-current@freebsd.org Received: from bubba.whistle.com (bubba.whistle.com [207.76.205.7]) by hub.freebsd.org (Postfix) with ESMTP id 455F014F7D; Tue, 3 Aug 1999 16:22:40 -0700 (PDT) (envelope-from archie@whistle.com) Received: (from archie@localhost) by bubba.whistle.com (8.9.2/8.9.2) id QAA80191; Tue, 3 Aug 1999 16:21:53 -0700 (PDT) From: Archie Cobbs Message-Id: <199908032321.QAA80191@bubba.whistle.com> Subject: Re: Panic plus advice needed In-Reply-To: <199908032131.OAA76026@bubba.whistle.com> from Archie Cobbs at "Aug 3, 1999 02:31:36 pm" To: archie@whistle.com (Archie Cobbs) Date: Tue, 3 Aug 1999 16:21:53 -0700 (PDT) Cc: dwmalone@maths.tcd.ie (David Malone), grog@lemis.com, current@FreeBSD.ORG, bde@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL54 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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