From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18278 invoked by alias); 31 May 2017 06:27:45 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 41184 Received: (qmail 20019 invoked from network); 31 May 2017 06:27:45 -0000 X-Qmail-Scanner-Diagnostics: from mail-ua0-f170.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.217.170):SA:0(0.5/5.0):. Processed in 1.245628 secs); 31 May 2017 06:27:45 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.5 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,RCVD_IN_SORBS_SPAM,SPF_PASS, T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.1 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.217.170 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=Uv9R0mSok4IdTJp3IRBi1UpAmVP6P+VEDa869hB28V8=; b=itUEsRJLql2xjysmBqRJ1ezQVdkodBVTFp9Rp3cWRFAIksb0QJO5vaD3h/GRrNB9Pb eu1uEvtofoJHJtLcZyZSfK1UunJlxyjWmvIUMPu+OHqiAYab6TrmtvJsv+XpL2u1QEtm qKKHqghFSWX4m/++Z19X2+6lck8qcH80/ckdQJVm/FjBLPPH2Iy1xPPI9kDlPmmjweeu uZ0ebpSLg60RnT4zP0nFaNNLTgFEAJsa0qnpD5pEJtY0tVV6JppaKfrHDWszM3y6JYap Emc9Ci5GUp+T11Yyo4AZOd/94uuHWjiJIe7RbdJokyUdgl8UrbA4062iwrrb5vS3VwkK ZkEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version; bh=Uv9R0mSok4IdTJp3IRBi1UpAmVP6P+VEDa869hB28V8=; b=oQcnGbbV5VdZqwJ2SsheNqXfWMy1f07xVYsthM1dVpySBOCqV76oGISZsnWo6aDoh/ XL40Jy6i0PyUswoat52uWaY4pdPLmc8rFqr9UBJvqPA0gnexYoCNxeYK3Lw7I16DQg4r /VjvKPuYnvz9zGw5tssad/0MX7S+wcybZx7fugRyeRhAvUFgXivVYMWgn0r07JaOwREr F20Qtt2YTmF5kuht3pWJtsH5L8pduxItScobq5T+v9s9z6eneJBAzg5m7ZCtTBNOL/4b Ui7A5YoDWYqw/wxLLHHjaQlQMxB5MI5s7zfCEyEwKW/LIHYKQZ9cxzWSu7VR99QCEUPJ RKzg== X-Gm-Message-State: AODbwcAUzGFtR1wJBMAgOnS+I1LMtAspVnDmkozIaCS+2vokE6wHxYr+ 4gBFlmf/Uyftrt4k3+Y= X-Received: by 10.176.7.5 with SMTP id h5mr10182791uah.147.1496212057558; Tue, 30 May 2017 23:27:37 -0700 (PDT) From: Bart Schaefer Message-Id: <170530232751.ZM27464@torch.brasslantern.com> Date: Tue, 30 May 2017 23:27:51 -0700 In-Reply-To: <20170530065302.GA6568@chaz.gmail.com> Comments: In reply to Stephane Chazelas "Re: When is STTY ignored?" (May 30, 7:53am) References: <20170529203625.GA7664@chaz.gmail.com> <170529170209.ZM30652@torch.brasslantern.com> <20170530065302.GA6568@chaz.gmail.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Zsh hackers list Subject: Re: When is STTY ignored? MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On May 30, 7:53am, Stephane Chazelas wrote: } } In: } } (STTY=-echo line; STTY=-echo line); line } } the "-echo" is only applied to the 2nd and 3rd "line" } invocations (instead of 1st and 2nd). So, this is a little odd. The "stty" command is run only when isatty(0) and the process is the group leader, i.e., the foreground job. In the construct (command1; command2) the group leader is the subshell, so STTY is ignored for command1; but then command2 is optimized to an "exec" so it assumes the group leadership and "stty" is run. However, that exec means the subshell is gone and there is never an opportunity to undo the setting change, so it remains in effect after command2 exits, and that's why it appears to have been applied to the 3rd command in your example. This means we ought to treat having STTY in the environment as a reason to skip the optimization. However, I'm not sure we look for STTY early enough in the call chain to handle this. For example, jobtab[thisjob].stty_in_env is only assigned after the decision is made and the child has been forked.