zsh-workers
 help / color / mirror / code / Atom feed
From: "Rocky Bernstein" <rocky.bernstein@gmail.com>
To: "Peter Stephenson" <pws@csr.com>
Cc: "Zsh hackers list" <zsh-workers@sunsite.dk>
Subject: Re: Help me track down a tough bug? (probably funcfiletrace, subshells and possibly I/O redirection)
Date: Tue, 30 Sep 2008 13:59:43 -0400	[thread overview]
Message-ID: <6cd6de210809301059o64216c18wfb69491c5ff7b049@mail.gmail.com> (raw)
In-Reply-To: <20080930175300.2e93fabf@news01>

My mistake. You are correct. This bug was introduced in paring down
the program and removing an initial truncate output (leaving the
subsequent append outputs). And I now see the answer to why output was
disappearing in the subshell which was my initial concern.

Thanks for all the help!

Any thoughts on marking subshell level inside one of the stack traces
or having return inside trap DEBUG with a negative number cause an
immediate return?

Thanks again.



On Tue, Sep 30, 2008 at 12:53 PM, Peter Stephenson <pws@csr.com> wrote:
> On Mon, 29 Sep 2008 20:18:52 -0400
> "Rocky Bernstein" <rocky.bernstein@gmail.com> wrote:
>> zshdb<3> p ${funcfiletrace[@]}
>>
>> ./command/eval.sh:11 ./command/eval.sh:27 ./lib/processor.sh:96
>> ./lib/processor.sh:44 ./zshdb2.sh:9 ./testing.sh:3 ./zshdb2.sh:34
>> ./command/eval.sh:11 ./command/eval.sh:27 ./lib/processor.sh:96
>> ./lib/processor.sh:44 ./zshdb2.sh:9 ./testing.sh:3 ./zshdb2.sh:34
>> ./zshdb2.sh:9 ./testing.sh:3 ./zshdb2.sh:34
>> # Were did that double set of lines come from?
>
> Hmmm... I'm not convinced this has got anything directly to do with the
> shell rather than the debugger.  Here's what I get when I simply ask for
> the PID repeated times:
>
> ---------------
> ./zshdb2.sh:7 ./zshdb2.sh:34
> ===============
> (./zshdb2.sh:34):
> . ./testing.sh
> ./zshdb2.sh:9 ./zshdb2.sh:34
> zshdb<1> p $$
> 711
> ./zshdb2.sh:9 ./zshdb2.sh:34
> zshdb<2> p $$
> 711
> 711
> ./zshdb2.sh:9 ./zshdb2.sh:34
> zshdb<3> p $$
> 711
> 711
> 711
> ./zshdb2.sh:9 ./zshdb2.sh:34
> zshdb<4>
>
> It looks like something is odd with whatever is holding the command to be
> executed.  You know better than me how that works.

Sorry you are correct. This bug was introduced in paring down the
program. Line 6 of lib/eval.sh should be:

  print "$@" > $_Dbg_evalfile

rather than

print "$@" >> $_Dbg_evalfile

However after this is fixed we have the disappearing output when in
that 2nd set of subshells which is the problem that motivated all of
this. What you want to print or eval is written to _Dbg_evalfile along
with some other commands to try to simulate the environment you were
in before entering the debugger. Then that file is sourced via:

   if [[ -t $_Dbg_fdi  ]] ; then
       _Dbg_set_dol_q $_Dbg_debugged_exit_code
       . $_Dbg_evalfile >&${_Dbg_fdi}
   else
       _Dbg_set_dol_q $_Dbg_debugged_exit_code
       . $_Dbg_evalfile
   fi

Somehow in that context no output appears even though output may be
explicitly written to a terminal file descriptor in the first branch.
I've also have tried using just the "else" branch above and still no
output. Finally, you can remove the call to _Dbg_set_dol_q which is
just setting $? before source'ing the file and that still doesn't
cause output to reappear.

So there seems to be something funky with I/O inside a backtick
subshell. I don't get that problem inside a () subshell, even if
output has been redirected on that, e.g.

( x=1)>/dev/null
because the debugger output goes to _Dbg_fdi.
> --
> Peter Stephenson <pws@csr.com>                  Software Engineer
> CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
> Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070
>


  reply	other threads:[~2008-09-30 18:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <6cd6de210809281219i4bf1ed18mefa45b967fa835a6@mail.gmail.com>
     [not found] ` <20080928221651.6ee7f671@pws-pc>
2008-09-29  2:32   ` Rocky Bernstein
2008-09-29  8:52     ` Peter Stephenson
2008-09-29 11:11       ` Rocky Bernstein
2008-09-29 11:25         ` Peter Stephenson
2008-09-29 14:11           ` Rocky Bernstein
2008-09-29 14:25             ` Peter Stephenson
2008-09-29 21:42               ` Peter Stephenson
2008-09-30  0:18                 ` Rocky Bernstein
2008-09-30 16:53                   ` Peter Stephenson
2008-09-30 17:59                     ` Rocky Bernstein [this message]
2008-09-30 18:01                       ` Rocky Bernstein
2008-10-01 11:31                       ` Peter Stephenson
2008-10-01 15:45                         ` Rocky Bernstein

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6cd6de210809301059o64216c18wfb69491c5ff7b049@mail.gmail.com \
    --to=rocky.bernstein@gmail.com \
    --cc=pws@csr.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).