zsh-workers
 help / color / mirror / code / Atom feed
From: Martijn Dekker <martijn@inlv.org>
To: zsh-workers@zsh.org
Subject: Re: LINENO behaviour in sh mode
Date: Thu, 23 Mar 2017 04:09:30 +0100	[thread overview]
Message-ID: <29695ed3-9436-b066-311a-bec4e237b6fd@inlv.org> (raw)
In-Reply-To: <170322194527.ZM5658@torch.brasslantern.com>

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.


  reply	other threads:[~2017-03-23  3:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-20  2:57 Martijn Dekker
2017-03-20  3:41 ` Martijn Dekker
2017-03-23  2:45 ` Bart Schaefer
2017-03-23  3:09   ` Martijn Dekker [this message]
2017-03-23 16:11     ` Bart Schaefer
2017-03-23 16:23       ` Duplicate messages (was Re: LINENO behaviour in sh mode) Aaron Schrab

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=29695ed3-9436-b066-311a-bec4e237b6fd@inlv.org \
    --to=martijn@inlv.org \
    --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).