From owner-freebsd-current Wed Oct 31 21:49:34 2001 Delivered-To: freebsd-current@freebsd.org Received: from bunrab.catwhisker.org (adsl-63-193-123-122.dsl.snfc21.pacbell.net [63.193.123.122]) by hub.freebsd.org (Postfix) with ESMTP id 7A9DD37B407; Wed, 31 Oct 2001 21:49:28 -0800 (PST) Received: (from david@localhost) by bunrab.catwhisker.org (8.11.6/8.11.6) id fA15nPG47227; Wed, 31 Oct 2001 21:49:25 -0800 (PST) (envelope-from david) Date: Wed, 31 Oct 2001 21:49:25 -0800 (PST) From: David Wolfskill Message-Id: <200111010549.fA15nPG47227@bunrab.catwhisker.org> To: current@FreeBSD.ORG, obrien@FreeBSD.ORG Subject: Re: buildworld breakage during "make depend" at usr.bin/kdump In-Reply-To: <200110312159.f9VLx1I45943@bunrab.catwhisker.org> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG OK; I was finally able to complete the buildworld/buildkernel/ installkernel/installworld/mergemaster cycle. In the process, I found 3 awk scripts that required modification; I will append the changes I made after another paragraph of my deathless prose. :-} Before I get to the patches, I will temper the good news of being able to build & install both the world and the kernel by admitting that I was unable to actually boot the resulting system: The machine (laptop; I have no monitor on the "build" machine) would prompt for the boot slice, and whether I pressed the default selection (for the newly-built world), pressed Enter, or let the selection default by timeout, the screen would go blank, then show the BIOS splash screen and re-prompt for a boot slice selection. The novelty wore off after a few iterations, and so I switched to booting -STABLE. :-} Here are the patches; I'll comment about them below: Index: usr.bin/kdump/mkioctls =================================================================== RCS file: /cvs/freebsd/src/usr.bin/kdump/mkioctls,v retrieving revision 1.23 diff -u -r1.23 mkioctls --- usr.bin/kdump/mkioctls 24 May 2001 08:47:57 -0000 1.23 +++ usr.bin/kdump/mkioctls 31 Oct 2001 21:27:35 -0000 @@ -25,10 +25,10 @@ egrep -v '^(netns)/' | xargs egrep -l \ '^#[ ]*define[ ]+[A-Za-z_][A-Za-z0-9_]*[ ]+_IO[^a-z0-9_]' | - sed -e 's/^/#include /' + awk '{printf("#include <%s>\\\\n", $1)}' ` -echo "$ioctl_includes" | +awk -v x="$ioctl_includes" 'BEGIN {print x}' | gcc -E -I$1 -dM - | awk -v ioctl_includes="$ioctl_includes" -v use_switch="$use_switch" ' BEGIN { Index: gnu/lib/libregex/doc/Makefile =================================================================== RCS file: /cvs/freebsd/src/gnu/lib/libregex/doc/Makefile,v retrieving revision 1.4 diff -u -r1.4 Makefile --- gnu/lib/libregex/doc/Makefile 11 Jan 1997 03:19:32 -0000 1.4 +++ gnu/lib/libregex/doc/Makefile 31 Oct 2001 23:39:13 -0000 @@ -5,7 +5,7 @@ CLEANFILES += regex.texi regex.texi: xregex.texi ../regex.h - awk -f ${.CURDIR}/include.awk -vsource=${.CURDIR}/../regex.h \ + awk -f ${.CURDIR}/include.awk -v source=${.CURDIR}/../regex.h \ < ${.CURDIR}/xregex.texi \ | expand >$@ Index: sys/boot/common/merge_help.awk =================================================================== RCS file: /cvs/freebsd/src/sys/boot/common/merge_help.awk,v retrieving revision 1.2 diff -u -r1.2 merge_help.awk --- sys/boot/common/merge_help.awk 28 Aug 1999 00:39:50 -0000 1.2 +++ sys/boot/common/merge_help.awk 1 Nov 2001 03:50:24 -0000 @@ -8,7 +8,7 @@ BEGIN \ { state = 0; - first = 0; + first = -1; ind = 0; } @@ -20,13 +20,13 @@ } # entry header -/^# T[[:graph:]]+ (S[[:graph:]]+ )*D[[:graph:]][[:print:]]*$/ && (state == 1) \ +/^# T[\x21-\x7e]+ (S[\x21-\x7e]+ )*D[\x21-\x7e][\x20-\x7e]*$/ && (state == 1) \ { - match($0, " T[[:graph:]]+"); + match($0, " T[\x21-\x7e]+"); T = substr($0, RSTART + 2, RLENGTH - 2); - match($0, " S[[:graph:]]+"); + match($0, " S[\x21-\x7e]+"); S = (RLENGTH == -1) ? "" : substr($0, RSTART + 2, RLENGTH - 2); - match($0, " D[[:graph:]][[:print:]]*$"); + match($0, " D[\x21-\x7e][\x20-\x7e]*$"); D = substr($0, RSTART + 2); # find a suitable place to store this one... David O'Brien has suggested another (better, I think) approach for the mkioctls patch. I'm reporting what I (had already) used. For the regex/doc/Makefile, it seems that gawk allows the value for -v to be adjacent to the -v itself, while the -CURRENT awk works better if there is whitespace separating them. I cannot quote documentation to support this, but appeal to empirical evidence. Of the three, I think the merge_help.awk patch is the most troublesome. First, the mode of failure appeared to be an endless output loop, each cycle of which was very short. I've previously confessed my relative lack of experience with awk, so I hope that folks will be charitable. But in debugging the script, I found two things that (IMO) warranted attention: * It seems that while gawk supports the POSIX "bracket expressions" (POSIXese for "character classes", basically), the awk we are now using in -CURRENT does not appear to do so. (Again, I cite empirical evidence, vs. documentation.) As a result of this, none of the input lines were recognized in the "state 1" expression on line 23. Thus, the "help" array was empty when the script reached the end of the input. * Since no lines matched, the "first" variable remained set at 0, and since the help array was empty, the loop termination condition in the END block could never be reached. I believe this to be suboptimal. I found that by changing the intial value of "first" to -1, that made the default condition for END loop *met* be default. Thus, with this change, the mode of failure became slightly less obnoxious. (Ideally, it would, in this case, output no lines at all, and possibly end with a non-zero status code. I chose to defer that for a subsequent exercise, should it be perceived to be desireable.) Unfortunately, with the mode of failure of the boot process, I don't really get much chance to figure out what is going on. I'll try again in the morning. Cheers, david -- David H. Wolfskill david@catwhisker.org As a computing professional, I believe it would be unethical for me to advise, recommend, or support the use (save possibly for personal amusement) of any product that is or depends on any Microsoft product. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message