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 [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message