Bug 209449

Summary: Buildworld fails because of bad flag in substitute command
Product: Base System Reporter: tschweikle
Component: miscAssignee: Mark Linimon <linimon>
Status: Closed Overcome By Events    
Severity: Affects Some People CC: tschweikle
Priority: ---    
Version: CURRENT   
Hardware: Any   
OS: Any   

Description tschweikle 2016-05-11 10:34:23 UTC
uname -a:
FreeBSD test-sct-bsf12-muc. 11.0-CURRENT FreeBSD 11.0-CURRENT #600 r299234: Mon May  9 00:46:39 CEST 2016     root@test-sct-bsf12-muc:/usr/obj/usr/src/sys/FBSD11  amd64

svn info:
Repository Root: https://svn.freebsd.org/base
Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Revision: 299425
Node Kind: directory
Schedule: normal
Last Changed Author: royger
Last Changed Rev: 299423
Last Changed Date: 2016-05-11 12:10:25 +0200 (Wed, 11 May 2016)


buildworld:
objcopy --only-keep-debug eqn.full eqn.debug
objcopy --strip-debug --add-gnu-debuglink=eqn.debug  eqn.full eqn
Making neqn from /usr/src/gnu/usr.bin/groff/src/preproc/eqn/../../../../../../contrib/groff/src/preproc/eqn/neqn.sh
sed: 1: "s/^[1-9].*$/.&/": bad flag in substitute command: 's'
sed: 1: "s|@g@||g": bad flag in substitute command: 's'
*** Error code 1

Stop.
make[6]: stopped in /usr/src/gnu/usr.bin/groff/src/preproc/eqn
*** Error code 1

Stop.
make[5]: stopped in /usr/src/gnu/usr.bin/groff/src/preproc
*** Error code 1

Stop.
make[4]: stopped in /usr/src/gnu/usr.bin/groff/src
*** Error code 1

Stop.
make[3]: stopped in /usr/src/gnu/usr.bin/groff
*** Error code 1

Stop.
make[2]: stopped in /usr/src
*** Error code 1

Stop.
make[1]: stopped in /usr/src
*** Error code 1

Stop.
make: stopped in /usr/src
Comment 1 tschweikle 2016-05-15 08:17:42 UTC
sed: 1: "s/^[1-9].*$/.&/": bad flag in substitute command: 's'
sed: 1: "s|@g@||g": bad flag in substitute command: 's'

in both cases the command expands:

sed -e 's/@g@/$(g)/g' \
    -f $(SH_DEPS_SED_SCRIPT) \
    -e $(SH_SCRIPT_SED_CMD)

$(g) expands to something like "/s", sed then reads: 's/@g@//s/g' reporting only the first wrong flag after the third '/'.

same for "$(SH_SCRIPT_SED_CMD)": as far as i dug in this expands to 's/<someting>/<something>/s|@g@||g'

for whatever reason the reported "s/^[1-9].*$/.&/" and "s|@g@||g" are not the subtitute commands the error is in!
Comment 2 Antoine Brodin freebsd_committer freebsd_triage 2016-05-15 08:23:20 UTC
sed(1) was broke in base r299279 and this was reverted in base r299294
Comment 3 tschweikle 2016-05-15 08:57:49 UTC
Making neqn from /usr/src/gnu/usr.bin/groff/src/preproc/eqn/../../../../../../contrib/groff/src/preproc/eqn/neqn.sh
rm -f neqn
Execute: 'rm -f neqn'
Applying[.MAKE.EXPORTED] :O to ""
Result[.MAKE.EXPORTED] of :O is ""
Applying[.MAKE.EXPORTED] :u to ""
Result[.MAKE.EXPORTED] of :u is ""
sed -e "s|@BINDIR@|/usr/bin|g"  -e 's|@GROFF_BIN_PATH_SETUP@|GROFF_RUNTIME="${GROFF_BIN_PATH=/usr/bin}:"|g'  -e "s;@FONTDIR@;/usr/share/groff_font;g"  -e "s|@SEP@|:|g"  -e "s|@VERSION@|`cat /usr/src/gnu/usr.bin/groff/src/preproc/eqn/../../../../../../contrib/groff/VERSION``sed -e 's/^0$//' -e 's/^[1-9].*$/.&/' /usr/src/gnu/usr.bin/groff/src/preproc/eqn/../../../../../../contrib/groff/REVISION`|"  -e "s|@g@||g"  /usr/src/gnu/usr.bin/groff/src/preproc/eqn/../../../../../../contrib/groff/src/preproc/eqn/neqn.sh >neqn
Execute: 'sed -e "s|@BINDIR@|/usr/bin|g"  -e 's|@GROFF_BIN_PATH_SETUP@|GROFF_RUNTIME="${GROFF_BIN_PATH=/usr/bin}:"|g'  -e "s;@FONTDIR@;/usr/share/groff_font;g"  -e "s|@SEP@|:|g"  -e "s|@VERSION@|`cat /usr/src/gnu/usr.bin/groff/src/preproc/eqn/../../../../../../contrib/groff/VERSION``sed -e 's/^0$//' -e 's/^[1-9].*$/.&/' /usr/src/gnu/usr.bin/groff/src/preproc/eqn/../../../../../../contrib/groff/REVISION`|"  -e "s|@g@||g"  /usr/src/gnu/usr.bin/groff/src/preproc/eqn/../../../../../../contrib/groff/src/preproc/eqn/neqn.sh >neqn'
Applying[.MAKE.EXPORTED] :O to ""
Result[.MAKE.EXPORTED] of :O is ""
Applying[.MAKE.EXPORTED] :u to ""
Result[.MAKE.EXPORTED] of :u is ""
+ cat /usr/src/gnu/usr.bin/groff/src/preproc/eqn/../../../../../../contrib/groff/VERSION
+ sed -e 's/^0$//' -e 's/^[1-9].*$/.&/' /usr/src/gnu/usr.bin/groff/src/preproc/eqn/../../../../../../contrib/groff/REVISION
sed: 1: "s/^[1-9].*$/.&/": bad flag in substitute command: 's'
+ sed -e 's|@BINDIR@|/usr/bin|g' -e 's|@GROFF_BIN_PATH_SETUP@|GROFF_RUNTIME="${GROFF_BIN_PATH=/usr/bin}:"|g' -e 's;@FONTDIR@;/usr/share/groff_font;g' -e 's|@SEP@|:|g' -e 's|@VERSION@|1.19|' -e 's|@g@||g' /usr/src/gnu/usr.bin/groff/src/preproc/eqn/../../../../../../contrib/groff/src/preproc/eqn/neqn.sh
sed: 1: "s|@g@||g": bad flag in substitute command: 's'

*** Failed target:  neqn
*** Failed command: sed -e "s|@BINDIR@|/usr/bin|g" -e 's|@GROFF_BIN_PATH_SETUP@|GROFF_RUNTIME="${GROFF_BIN_PATH=/usr/bin}:"|g' -e "s;@FONTDIR@;/usr/share/groff_font;g" -e "s|@SEP@|:|g" -e "s|@VERSION@|`cat /usr/src/gnu/usr.bin/groff/src/preproc/eqn/../../../../../../contrib/groff/VERSION``sed -e 's/^0$//' -e 's/^[1-9].*$/.&/' /usr/src/gnu/usr.bin/groff/src/preproc/eqn/../../../../../../contrib/groff/REVISION`|" -e "s|@g@||g" /usr/src/gnu/usr.bin/groff/src/preproc/eqn/../../../../../../contrib/groff/src/preproc/eqn/neqn.sh >neqn
*** Error code 1

Stop.
make[6]: stopped in /usr/src/gnu/usr.bin/groff/src/preproc/eqn
Global:.ERROR_TARGET = neqn
Applying[MAKE_PRINT_VAR_ON_ERROR] :@ to ""
Modifier pattern: "v"
Modifier pattern: "$v='${$v}'
"
Global:delete v (not found)
Result[MAKE_PRINT_VAR_ON_ERROR] of :@ is ""

*** Failed target:  all_subdir_gnu/usr.bin/groff/src/preproc/eqn
*** Failed command: target=all; dir=eqn; if test -d /usr/src/gnu/usr.bin/groff/src/preproc/${dir}.amd64; then dir=${dir}.amd64; fi; echo "===> gnu/usr.bin/groff/src/preproc/${dir} (${target})"; cd /usr/src/gnu/usr.bin/groff/src/preproc/${dir}; make ${target} DIRPRFX=gnu/usr.bin/groff/src/preproc/${dir}/;
*** Error code 1

Stop.
make[5]: stopped in /usr/src/gnu/usr.bin/groff/src/preproc
Global:.ERROR_TARGET = all_subdir_gnu/usr.bin/groff/src/preproc/eqn
Applying[MAKE_PRINT_VAR_ON_ERROR] :@ to ""
Modifier pattern: "v"
Modifier pattern: "$v='${$v}'
"
Global:delete v (not found)
Result[MAKE_PRINT_VAR_ON_ERROR] of :@ is ""

*** Failed target:  all_subdir_gnu/usr.bin/groff/src/preproc
*** Failed command: target=all; dir=preproc; if test -d /usr/src/gnu/usr.bin/groff/src/${dir}.amd64; then dir=${dir}.amd64; fi; echo "===> gnu/usr.bin/groff/src/${dir} (${target})"; cd /usr/src/gnu/usr.bin/groff/src/${dir}; make ${target} DIRPRFX=gnu/usr.bin/groff/src/${dir}/;
*** Error code 1

Stop.
make[4]: stopped in /usr/src/gnu/usr.bin/groff/src
Global:.ERROR_TARGET = all_subdir_gnu/usr.bin/groff/src/preproc
Applying[MAKE_PRINT_VAR_ON_ERROR] :@ to ""
Modifier pattern: "v"
Modifier pattern: "$v='${$v}'
"
Global:delete v (not found)
Result[MAKE_PRINT_VAR_ON_ERROR] of :@ is ""

*** Failed target:  all_subdir_gnu/usr.bin/groff/src
*** Failed command: target=all; dir=src; if test -d /usr/src/gnu/usr.bin/groff/${dir}.amd64; then dir=${dir}.amd64; fi; echo "===> gnu/usr.bin/groff/${dir} (${target})"; cd /usr/src/gnu/usr.bin/groff/${dir}; make ${target} DIRPRFX=gnu/usr.bin/groff/${dir}/;
*** Error code 1

Stop.
make[3]: stopped in /usr/src/gnu/usr.bin/groff
Global:.ERROR_TARGET = all_subdir_gnu/usr.bin/groff/src
Applying[MAKE_PRINT_VAR_ON_ERROR] :@ to ""
Modifier pattern: "v"
Modifier pattern: "$v='${$v}'
"
Global:delete v (not found)
Result[MAKE_PRINT_VAR_ON_ERROR] of :@ is ""

*** Failed target:  _bootstrap-tools-gnu/usr.bin/groff
*** Failed command: echo "===> gnu/usr.bin/groff (obj,all,install)"; cd /usr/src/gnu/usr.bin/groff; make DIRPRFX=gnu/usr.bin/groff/ obj; make DIRPRFX=gnu/usr.bin/groff/ all; make DIRPRFX=gnu/usr.bin/groff/ DESTDIR=/usr/obj/usr/src/tmp/legacy install
*** Error code 1

Stop.
make[2]: stopped in /usr/src
Global:.ERROR_TARGET = _bootstrap-tools-gnu/usr.bin/groff
Applying[MAKE_PRINT_VAR_ON_ERROR] :@ to ""
Modifier pattern: "v"
Modifier pattern: "$v='${$v}'
"
Global:delete v (not found)
Result[MAKE_PRINT_VAR_ON_ERROR] of :@ is ""

*** Failed target:  _bootstrap-tools
*** Failed command: cd /usr/src; MAKEOBJDIRPREFIX=/usr/obj/usr/src/tmp INSTALL="sh /usr/src/tools/install.sh" TOOLS_PREFIX=/usr/obj/usr/src/tmp PATH=/usr/obj/usr/src/tmp/legacy/usr/sbin:/usr/obj/usr/src/tmp/legacy/usr/bin:/usr/obj/usr/src/tmp/legacy/bin:/sbin:/bin:/usr/sbin:/usr/bin WORLDTMP=/usr/obj/usr/src/tmp MAKEFLAGS="-m /usr/src/tools/build/mk -d A -m /usr/src/share/mk" make -f Makefile.inc1 DESTDIR= BOOTSTRAPPING=1100107 SSP_CFLAGS= MK_HTML=no NO_LINT=yes MK_MAN=no -DNO_PIC MK_PROFILE=no -DNO_SHARED -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no MK_CLANG_EXTRAS=no MK_CLANG_FULL=no MK_LLDB=no MK_TESTS=no MK_INCLUDES=yes bootstrap-tools
*** Error code 1

Stop.
make[1]: stopped in /usr/src
Global:.ERROR_TARGET = _bootstrap-tools
Applying[MAKE_PRINT_VAR_ON_ERROR] :@ to ""
Modifier pattern: "v"
Modifier pattern: "$v='${$v}'
"
Global:delete v (not found)
Result[MAKE_PRINT_VAR_ON_ERROR] of :@ is ""

*** Failed target:  buildworld
*** Failed command: cd /usr/src; PATH=/sbin:/bin:/usr/sbin:/usr/bin make -m /usr/src/share/mk -f Makefile.inc1 TARGET=amd64 TARGET_ARCH=amd64 buildworld
*** Error code 1

Stop.
make: stopped in /usr/src
Global:.ERROR_TARGET = buildworld
Applying[MAKE_PRINT_VAR_ON_ERROR] :@ to ""
Modifier pattern: "v"
Modifier pattern: "$v='${$v}'
"
Global:delete v (not found)
Result[MAKE_PRINT_VAR_ON_ERROR] of :@ is ""
++ exit 1
++ exit 1
Comment 4 tschweikle 2016-05-29 09:38:47 UTC
Pops up on 10-STABLE some times too. For 11-CURRENT it is impossible to build world.

Working Copy Root Path: /usr/src
URL: https://svn.freebsd.org/base/head
Relative URL: ^/head
Repository Root: https://svn.freebsd.org/base
Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Revision: 300951
Node Kind: directory
Schedule: normal
Last Changed Author: mmel
Last Changed Rev: 300951
Last Changed Date: 2016-05-29 09:39:56 +0200 (Sun, 29 May 2016)
Comment 5 tschweikle 2016-05-29 10:09:37 UTC
If sed was broken in base r299279 and reverted in base r299294. Shouldn't sed be rebuild with:

chflags -R noschg /usr/obj/*
rm -rf /usr/obj
cd /usr/src
make cleandir
make cleandir
svn up
make buildworld
make buildkernel KERNCONF=FBSD
make installkernel KERNCONF=FBSD

thus installkernel using the corrected sed? I've found a newly build sed in ./usr.bin/sed/sed seems copied to ./rescue/rescue/usr/src/usr.bin/sed but this sed seemed to have the bug too.
Comment 6 Mark Linimon freebsd_committer freebsd_triage 2018-08-05 04:59:00 UTC
After 2 years, surely this problem has been solved by now?