This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.

See crosstool-NG for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 0 of 1] Alternative debug-shell implementation


Hi Yann,

On Wed, Oct 17, 2012 at 01:38:38PM +0200, Yann E. MORIN wrote:
> On Wednesday 17 October 2012 12:15:21 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.
> 
> > My patch had this test:
> > 
> > +       if [ -t 0 -a -t 6 -a -t 2 ]; then
> > +              ...
> > +       else
> > +               CT_DoLog WARN "CT_DEBUG_CT_FIXUP_SHELL disabled due to I/O redirection"
> > +       fi
> > 
> > I haven't tested what happens if you run "c-ng build |& tee log" and
> > then try to run an interactive shell, but I guess it can't work?
> 
> Right, I'll see what I can do to add ths check.

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.

  [INFO ]  Extracting and patching toolchain components
  [EXTRA]    Extracting 'eglibc-2_16'
  [EXTRA]    Patching 'eglibc-2_16'
  [ERROR]
  [ERROR]  >>
  [ERROR]  >>  Build failed in step 'Extracting and patching toolchain components'
  [ERROR]  >>        called in step '(top-level)'
  [ERROR]  >>
  [ERROR]  >>  Error happened in: CT_DoExecLog[scripts/functions@257]
  [ERROR]  >>        called from: CT_Patch[scripts/functions@1054]
  [ERROR]  >>        called from: do_libc_extract[scripts/build/libc/glibc-eglibc.sh-common@10]
  [ERROR]  >>        called from: main[scripts/crosstool-NG.sh@580]
  
  
  Current command:
    'patch' '--no-backup-if-mismatch' '-g0' '-F1' '-p1' '-f'
  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
      2  repeat this build command
      3  abort build
  
  ct-ng:~/toolchain/eglibc/build/.build/src/eglibc-2_16> exit
  
  Please exit with one of these values:
  (... repeat ...)


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.
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}"


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?


Thanks
Johannes

--
For unsubscribe information see http://sourceware.org/lists.html#faq


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]