Message ID | 20121026124232.GB27584@sig21.net |
---|---|
State | Superseded |
Headers | show |
Johannes, All, On Friday 26 October 2012 Johannes Stezenbach wrote: > > > > > On Mon, Oct 15, 2012 at 09:53:55PM +0200, Yann E. MORIN wrote: > > > > > > Here is an alternate implementation of debug-shell, that I was working on > > > > > > following your previous submission. [--SNIP--] > I just ran into an endless loop with today's ct-ng, which was caused > by a patch failing to apply in CT_Patch. The problem is that > the failed command uses stdin redirection. Ah, good catch. [--SNIP--] > The easiest fix for this particular case would be to use "patch -i patch" > instead of "patch <patch" (-i is in POSIX), which would also have the > advantage that the patch filename would show up in the failed command. Yep, let's use "patch -i". I was not happy with the redirection anyway. > But in general I guess the fix might be: > > > --- functions.orig 2012-10-26 14:04:35.767316717 +0200 > +++ functions 2012-10-26 14:19:06.921870258 +0200 > @@ -46,7 +46,7 @@ CT_OnError() { > old_trap="$(trap -p ERR)" > trap -- ERR > ( > - exec >&6 > + exec >&6 2>&7 <&8 > printf "\r \n\nCurrent command" > if [ -n "${cur_cmd}" ]; then > printf ":\n %s\n" "${cur_cmd}" > @@ -131,7 +131,7 @@ set +o hashall > > # Log policy: > # - first of all, save stdout so we can see the live logs: fd #6 > -exec 6>&1 > +exec 6>&1 7>&2 8<&0 > # - then point stdout to the log file > tmp_log_file="${CT_TOP_DIR}/build.log" > rm -f "${tmp_log_file}" Care to send a proper patch with your SoB line, please? > Another issue is that "1 fixed, continue with next build command" > doesn't seem to work since the exit status isn't cleared > and CT_DoExecLog() fails again. Maybe we need something like > "${CT_BUILD_DIR}/repeat" for the "continue" case? I'll double check, but I remember it to work for me... I even added this code to test retry/resume/abort: CT_DoExecLog DEBUG false false-01 CT_DoExecLog DEBUG false false-02 CT_DoExecLog DEBUG false false-03 And I was able to either retry/resume/abort. Regards, Yann E. MORIN.
Hi Yann, On Fri, Oct 26, 2012 at 07:43:37PM +0200, Yann E. MORIN wrote: > On Friday 26 October 2012 Johannes Stezenbach wrote: > > Another issue is that "1 fixed, continue with next build command" > > doesn't seem to work since the exit status isn't cleared > > and CT_DoExecLog() fails again. Maybe we need something like > > "${CT_BUILD_DIR}/repeat" for the "continue" case? > > I'll double check, but I remember it to work for me... > I even added this code to test retry/resume/abort: > CT_DoExecLog DEBUG false false-01 > CT_DoExecLog DEBUG false false-02 > CT_DoExecLog DEBUG false false-03 > > And I was able to either retry/resume/abort. It doesn't seem to work as intended, but I've had no time to debug it yet. Here's output from one build failure where I tried to continue with "exit 1". As you can see, the build stopped a few more times where I also used "exit 1". At one point I decided to give up with "exit 3" which caused a few strange errors and then the build continued to the end!? Maybe you can make sense of it. Here are the two errors from the longer log below: scripts/functions: line 401: stop-: syntax error: operand expected (error token is "-") 399 CT_EndStep() { 400 local stop=$(CT_DoDate +%s%N) 401 local duration=$(printf "%032d" $((stop-${CT_STEP_START[${CT_STEP_COUNT}]})) |sed -r -e 's/([[:digit:]]{2})[[:digit:]]{7}$/\.\1/; s/^0+//; s/^\./0\./;') scripts/functions: line 199: [: -le: unary operator expected 168 CT_DoLog() { ... 199 if [ ${cur_l} -le ${max_level} ]; then Even though it's not fully working yet the debug shell is still very useful for me. Saved me a lot of time. :-) Thanks Johannes (note the build was running on some ancient RedHat machine so the actual build error is not so interesting for you) [INFO ] Installing C library [EXTRA] Configuring C library [EXTRA] Building C library [EXTRA] Installing C library [EXTRA] Building and installing the C library manual [ERROR] make[3]: *** [/tmp/toolchain-eglibc-201210/bld/.build/arm-unknown-linux-gnueabi/build/build-libc-final/manual/libc.pdf] Error 1 [ERROR] make[2]: *** [pdf] Error 2 [ERROR] make[1]: *** [pdf] Error 2 [ERROR] [ERROR] >> [ERROR] >> Build failed in step 'Installing C library' [ERROR] >> called in step '(top-level)' [ERROR] >> [ERROR] >> Error happened in: CT_DoExecLog[scripts/functions@257] [ERROR] >> called from: do_libc_backend_once[scripts/build/libc/glibc-eglibc.sh-common@455] [ERROR] >> called from: do_libc_backend[scripts/build/libc/glibc-eglibc.sh-common@143] [ERROR] >> called from: do_libc[scripts/build/libc/glibc-eglibc.sh-common@65] [ERROR] >> called from: main[scripts/crosstool-NG.sh@609] Current command: 'make' 'pdf' 'html' exited with error code: 2 Please fix it up and finish by exiting the shell with one of these values: 1 fixed, continue with next build command 2 repeat this build command 3 abort build ct-ng:/tmp/toolchain-eglibc-201210/bld/.build/arm-unknown-linux-gnueabi/build/build-libc-final> 'make' 'pdf' 'html' ... (snipped) ct-ng:/tmp/toolchain-eglibc-201210/bld/.build/arm-unknown-linux-gnueabi/build/build-libc-final> exit 1 exit Continuing past the failed command. [ERROR] [ERROR] >> [ERROR] >> Build failed in step 'Installing C library' [ERROR] >> called in step '(top-level)' [ERROR] >> [ERROR] >> Error happened in: CT_DoExecLog[scripts/functions@216] [ERROR] >> called from: do_libc_backend_once[scripts/build/libc/glibc-eglibc.sh-common@455] [ERROR] >> called from: do_libc_backend[scripts/build/libc/glibc-eglibc.sh-common@143] [ERROR] >> called from: do_libc[scripts/build/libc/glibc-eglibc.sh-common@65] [ERROR] >> called from: main[scripts/crosstool-NG.sh@609] / Current command (unknown), exited with error code: 2 Please fix it up and finish by exiting the shell with one of these values: 1 fixed, continue with next build command 3 abort build ct-ng:/tmp/toolchain-eglibc-201210/bld/.build/arm-unknown-linux-gnueabi/build/build-libc-final> exit 1 exit Continuing past the failed command. [ERROR] [ERROR] >> [ERROR] >> Build failed in step '(top-level)' [ERROR] >> [ERROR] >> Error happened in: CT_DoExecLog[scripts/functions@268] [ERROR] >> called from: do_libc_backend_once[scripts/build/libc/glibc-eglibc.sh-common@455] [ERROR] >> called from: do_libc_backend[scripts/build/libc/glibc-eglibc.sh-common@143] [ERROR] >> called from: do_libc[scripts/build/libc/glibc-eglibc.sh-common@65] [ERROR] >> called from: main[scripts/crosstool-NG.sh@609] / Current command (unknown), exited with error code: 1 Please fix it up and finish by exiting the shell with one of these values: 1 fixed, continue with next build command 3 abort build ct-ng:/tmp/toolchain-eglibc-201210/bld/.build/arm-unknown-linux-gnueabi/build/build-libc-final> exit 1 exit Continuing past the failed command. [ERROR] [ERROR] >> [ERROR] >> Build failed in step '(top-level)' [ERROR] >> [ERROR] >> Error happened in: do_libc_backend_once[scripts/build/libc/glibc-eglibc.sh-common@91] [ERROR] >> called from: do_libc_backend[scripts/build/libc/glibc-eglibc.sh-common@143] [ERROR] >> called from: do_libc[scripts/build/libc/glibc-eglibc.sh-common@65] [ERROR] >> called from: main[scripts/crosstool-NG.sh@609] / Current command (unknown), exited with error code: 1 Please fix it up and finish by exiting the shell with one of these values: 1 fixed, continue with next build command 3 abort build ct-ng:/tmp/toolchain-eglibc-201210/bld/.build/arm-unknown-linux-gnueabi/build/build-libc-final> exit 1 exit Continuing past the failed command. [EXTRA] Configuring C library localedef [EXTRA] Building C library localedef [ERROR] glibc/locale/programs/../../intl/l10nflist.c:328: error: 'locale_t' undeclared (first use in this function) [ERROR] glibc/locale/programs/../../intl/l10nflist.c:328: error: (Each undeclared identifier is reported only once [ERROR] glibc/locale/programs/../../intl/l10nflist.c:328: error: for each function it appears in.) [ERROR] glibc/locale/programs/../../intl/l10nflist.c:328: error: expected ';' before 'locale' [ERROR] make[1]: *** [locarchive.o] Error 1 [ERROR] | [ERROR] >> [ERROR] >> Build failed in step '(top-level)' [ERROR] >> [ERROR] >> Error happened in: CT_DoExecLog[scripts/functions@257] [ERROR] >> called from: do_libc_locales[scripts/build/libc/eglibc.sh@153] [ERROR] >> called from: do_libc_backend_once[scripts/build/libc/glibc-eglibc.sh-common@469] [ERROR] >> called from: do_libc_backend[scripts/build/libc/glibc-eglibc.sh-common@143] [ERROR] >> called from: do_libc[scripts/build/libc/glibc-eglibc.sh-common@65] [ERROR] >> called from: main[scripts/crosstool-NG.sh@609] / Current command: 'make' '-j3' exited with error code: 2 Please fix it up and finish by exiting the shell with one of these values: 1 fixed, continue with next build command 2 repeat this build command 3 abort build ct-ng:/tmp/toolchain-eglibc-201210/bld/.build/arm-unknown-linux-gnueabi/build/build-localedef> make ... (snipped) ct-ng:/tmp/toolchain-eglibc-201210/bld/.build/arm-unknown-linux-gnueabi/build/build-localedef> exit 1 exit Continuing past the failed command. [ERROR] [ERROR] >> [ERROR] >> Build failed in step '(top-level)' [ERROR] >> [ERROR] >> Error happened in: CT_DoExecLog[scripts/functions@216] [ERROR] >> called from: do_libc_locales[scripts/build/libc/eglibc.sh@153] [ERROR] >> called from: do_libc_backend_once[scripts/build/libc/glibc-eglibc.sh-common@469] [ERROR] >> called from: do_libc_backend[scripts/build/libc/glibc-eglibc.sh-common@143] [ERROR] >> called from: do_libc[scripts/build/libc/glibc-eglibc.sh-common@65] [ERROR] >> called from: main[scripts/crosstool-NG.sh@609] / Current command (unknown), exited with error code: 2 Please fix it up and finish by exiting the shell with one of these values: 1 fixed, continue with next build command 3 abort build ct-ng:/tmp/toolchain-eglibc-201210/bld/.build/arm-unknown-linux-gnueabi/build/build-localedef> exit 1 exit Continuing past the failed command. [ERROR] [ERROR] >> [ERROR] >> Build failed in step '(top-level)' [ERROR] >> [ERROR] >> Error happened in: CT_DoExecLog[scripts/functions@268] [ERROR] >> called from: do_libc_locales[scripts/build/libc/eglibc.sh@153] [ERROR] >> called from: do_libc_backend_once[scripts/build/libc/glibc-eglibc.sh-common@469] [ERROR] >> called from: do_libc_backend[scripts/build/libc/glibc-eglibc.sh-common@143] [ERROR] >> called from: do_libc[scripts/build/libc/glibc-eglibc.sh-common@65] [ERROR] >> called from: main[scripts/crosstool-NG.sh@609] / Current command (unknown), exited with error code: 1 Please fix it up and finish by exiting the shell with one of these values: 1 fixed, continue with next build command 3 abort build ct-ng:/tmp/toolchain-eglibc-201210/bld/.build/arm-unknown-linux-gnueabi/build/build-localedef> exit 1 exit Continuing past the failed command. [ERROR] [ERROR] >> [ERROR] >> Build failed in step '(top-level)' [ERROR] >> [ERROR] >> Error happened in: do_libc_locales[scripts/build/libc/eglibc.sh@91] [ERROR] >> called from: do_libc_backend_once[scripts/build/libc/glibc-eglibc.sh-common@469] [ERROR] >> called from: do_libc_backend[scripts/build/libc/glibc-eglibc.sh-common@143] [ERROR] >> called from: do_libc[scripts/build/libc/glibc-eglibc.sh-common@65] [ERROR] >> called from: main[scripts/crosstool-NG.sh@609] / Current command (unknown), exited with error code: 1 Please fix it up and finish by exiting the shell with one of these values: 1 fixed, continue with next build command 3 abort build ct-ng:/tmp/toolchain-eglibc-201210/bld/.build/arm-unknown-linux-gnueabi/build/build-localedef> exit 1 exit Continuing past the failed command. [EXTRA] Installing C library locales [111:18] | /tmp/toolchain-eglibc-201210/tools/lib/ct-ng.hg+unknown-20121029.232826/scripts/functions: line 401: stop-: syntax error: operand expected (error token is "-") [ERROR] [ERROR] >> [ERROR] >> Build failed in step '(top-level)' [ERROR] >> [ERROR] >> Error happened in: CT_EndStep[scripts/functions@401] [ERROR] >> called from: do_libc_backend[scripts/build/libc/glibc-eglibc.sh-common@175] [ERROR] >> called from: do_libc[scripts/build/libc/glibc-eglibc.sh-common@65] [ERROR] >> called from: main[scripts/crosstool-NG.sh@609] / Current command (unknown), exited with error code: 1 Please fix it up and finish by exiting the shell with one of these values: 1 fixed, continue with next build command 3 abort build ct-ng:/tmp/toolchain-eglibc-201210/bld> less /tmp/toolchain-eglibc-201210/tools/lib/ct-ng.hg+unknown-20121029.232826/scripts/funct ions ct-ng:/tmp/toolchain-eglibc-201210/bld> exit 3 exit /tmp/toolchain-eglibc-201210/tools/lib/ct-ng.hg+unknown-20121029.232826/scripts/functions: line 199: [: -le: unary operator expect ed [133:35] / /tmp/toolchain-eglibc-201210/tools/lib/ct-ng.hg+unknown-20121029.232826/scripts/functions: line 199: [: -le: unary oper ator expected [133:35] / /tmp/toolchain-eglibc-201210/tools/lib/ct-ng.hg+unknown-20121029.232826/scripts/functions: line 199: [: -le: unary oper ator expected [133:35] / /tmp/toolchain-eglibc-201210/tools/lib/ct-ng.hg+unknown-20121029.232826/scripts/functions: line 199: [: -le: unary oper ator expected [133:35] / /tmp/toolchain-eglibc-201210/tools/lib/ct-ng.hg+unknown-20121029.232826/scripts/functions: line 199: [: -le: unary oper ator expected [133:35] / /tmp/toolchain-eglibc-201210/tools/lib/ct-ng.hg+unknown-20121029.232826/scripts/functions: line 199: [: -le: unary oper ator expected [133:35] / /tmp/toolchain-eglibc-201210/tools/lib/ct-ng.hg+unknown-20121029.232826/scripts/functions: line 199: [: -le: unary oper ator expected [133:35] / /tmp/toolchain-eglibc-201210/tools/lib/ct-ng.hg+unknown-20121029.232826/scripts/functions: line 199: [: -le: unary oper ator expected [INFO ] ================================================================= [INFO ] Installing final compiler [EXTRA] Configuring final compiler [EXTRA] Building final compiler ... [INFO ] Build completed at 20121030.015413 -- For unsubscribe information see http://sourceware.org/lists.html#faq
--- functions.orig 2012-10-26 14:04:35.767316717 +0200 +++ functions 2012-10-26 14:19:06.921870258 +0200 @@ -46,7 +46,7 @@ CT_OnError() { old_trap="$(trap -p ERR)" trap -- ERR ( - exec >&6 + exec >&6 2>&7 <&8 printf "\r \n\nCurrent command" if [ -n "${cur_cmd}" ]; then printf ":\n %s\n" "${cur_cmd}" @@ -131,7 +131,7 @@ set +o hashall # Log policy: # - first of all, save stdout so we can see the live logs: fd #6 -exec 6>&1 +exec 6>&1 7>&2 8<&0 # - then point stdout to the log file tmp_log_file="${CT_TOP_DIR}/build.log" rm -f "${tmp_log_file}"