From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10292 invoked by alias); 23 Mar 2017 03:09:23 -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: 40883 Received: (qmail 20470 invoked from network); 23 Mar 2017 03:09:23 -0000 X-Qmail-Scanner-Diagnostics: from kahlil.inlv.org 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(37.59.109.123):SA:0(-0.0/5.0):. Processed in 3.116429 secs); 23 Mar 2017 03:09:23 -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.0 required=5.0 tests=RP_MATCHES_RCVD autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: martijn@inlv.org X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at inlv.org does not designate permitted sender hosts) Subject: Re: LINENO behaviour in sh mode To: zsh-workers@zsh.org References: <170322194527.ZM5658@torch.brasslantern.com> From: Martijn Dekker Message-ID: <29695ed3-9436-b066-311a-bec4e237b6fd@inlv.org> Date: Thu, 23 Mar 2017 04:09:30 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <170322194527.ZM5658@torch.brasslantern.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Op 23-03-17 om 03:45 schreef Bart Schaefer: > On Mar 20, 3:57am, Martijn Dekker wrote: > } > } Output on various shells: > } bash: 1 2 5 6 7 6 (?!) > > Clearly bash is incrementing LINENO through the parse of the eval and > then continuing to increment it through the execution. Yes. http://lists.gnu.org/archive/html/bug-bash/2017-03/msg00128.html > I'm mildly surprised that no shell prints "1 2 3 4 5 6". Well, I can see how that would be non-trivial to pull off. > } zsh (sh): 1 2 3 3 3 6 (like ksh88) > } > } Since ksh88 is dead and buried (even Solaris now has ksh93 as their > } /bin/sh), it looks like zsh's "sh" mode is not emulating any current sh. > } Maybe 'emulate sh' should no longer turn off the EVAL_LINENO option. > > You're forgetting about the second effect of this, which is to print > "(eval)" in xtrace output instead of the script or function name. Try > your test again with "set -x" ... Yes, but how is that a problem? Seems like logical behaviour to me. If zsh is launched as sh, by default it prints neither of those anyway. > Do we need a separate option? Something this minor hardly seems worth a separate option, IMHO. In any case, for some reason my message took three days to get through to the list and meanwhile there's an update: mksh has just been patched to fix the bug where LINENO is always zero for eval or alias expansion. The only simple way to patch it was to make it act like ksh88, so as of the next mksh release there will once again be a current shell with a LINENO that acts like ksh88. (BTW, Bart, all your messages have been coming through zwh-workers in duplicate for quite some time now, the second copy always about 2K larger than the first due to extra routing headers.) Thanks, - M.