zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: zsh-workers@zsh.org
Subject: Re: Bug related to stdin/always/jobcontrol
Date: Fri, 23 Sep 2016 06:06:24 +0000	[thread overview]
Message-ID: <20160923060624.GA2843@fujitsu.shahaf.local2> (raw)
In-Reply-To: <160922181847.ZM22524@torch.brasslantern.com>

Bart Schaefer wrote on Thu, Sep 22, 2016 at 18:18:47 -0700:
> However, in attempting to figure it out, I found some sixteen-year-old
> code that is clearly wrong:
> 
> diff --git a/Src/exec.c b/Src/exec.c
> index d924148..bf97b5c 100644
> --- a/Src/exec.c
> +++ b/Src/exec.c
> @@ -1702,7 +1702,7 @@ execpline(Estate state, wordcode slcode, int how, int last1)
>  			    jobtab[list_pipe_job].other = newjob;
>  			    jobtab[list_pipe_job].stat |= STAT_SUPERJOB;
>  			    jn->stat |= STAT_SUBJOB | STAT_NOPRINT;
> -			    jn->other = pid;
> +			    jn->other = list_pipe_job;
>  			    jn->gleader = jobtab[list_pipe_job].gleader;
>  			}
>  			if ((list_pipe || last1) && hasprocs(list_pipe_job))
> 
> jn->other is a job table index, not a process ID.  However, (a) I don't
> know if list_pip_job is the right value (although a few lines earlier
> list_pipe_pid = pid is assigned, so it would seem to makes sense) and
> (b) that this has never caused a wild pointer dereference in all this
> time seems to indicate that this code is never actually reached.

The code does get reached: if you do
.
    % f() vim
    % f
    ^Z
.
at a new shell, it executes the line you changed.  Perhaps nothing reads
the value assigned to jn->other, though?

> I don't have any more time to look at this now; hoping this information
> is helpful to PWS if he has a chance to look when he wakes up on Friday.
> 


  reply	other threads:[~2016-09-23  6:07 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-02 18:39 Christian Neukirchen
2016-09-05 15:04 ` Christian Neukirchen
2016-09-05 15:42 ` Peter Stephenson
     [not found]   ` <CGME20160914173110eucas1p1f0567e319ae439b975b19f4e55676fed@eucas1p1.samsung.com>
2016-09-14 17:31     ` Peter Stephenson
2016-09-14 21:35       ` Peter Stephenson
2016-09-15  3:24         ` Bart Schaefer
2016-09-15  8:27           ` Peter Stephenson
2016-09-15 10:33             ` Peter Stephenson
2016-09-15 17:40               ` Peter Stephenson
2016-09-16  1:08                 ` Bart Schaefer
2016-09-16 12:02                   ` Peter Stephenson
2016-09-22 11:59         ` Daniel Shahaf
2016-09-22 16:38           ` Bart Schaefer
2016-09-23  1:18             ` Bart Schaefer
2016-09-23  6:06               ` Daniel Shahaf [this message]
2016-09-25 14:39               ` Peter Stephenson
2016-09-25 22:54                 ` struct job.other (was Re: Bug related to stdin/always/jobcontrol) Bart Schaefer
2016-09-26 11:20                   ` Peter Stephenson
2016-09-26 16:33                     ` Bart Schaefer
2016-09-25 15:16           ` Bug related to stdin/always/jobcontrol Peter Stephenson

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=20160923060624.GA2843@fujitsu.shahaf.local2 \
    --to=d.s@daniel.shahaf.name \
    --cc=zsh-workers@zsh.org \
    /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).