Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [BUG]builtin echo error doing arguments parsing
- X-seq: zsh-workers 42381
- From: Peter Stephenson <p.stephenson@xxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: [BUG]builtin echo error doing arguments parsing
- Date: Thu, 22 Feb 2018 10:32:01 +0000
- Cms-type: 201P
- Dkim-filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20180222103206euoutp02674a42b0fb2b87a7b1b17ac55ccb31e6~Vnzs___0S1253312533euoutp024
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1519295526; bh=IYLc+BlMixjI+0xXG9enZbvf4OPBSf1ZRB937+8WV20=; h=Date:From:To:Subject:In-reply-to:References:From; b=RYDR81iI0NUJY2Yq87v85qBM4hCrnvAyQsUo/eRT0F6P0WQOVij2wklQ/LHUkSvcj yxIf/w53AuS8JPlFFmN7NQlaFjrowfwPK0Hvh+UKvGSTUx7tNkEcTO0ynXRmYXJ1ld txei9Ed06K8YWxlH5e9Gv/xg/RLqTR+sa/XjdimY=
- In-reply-to: <20180222093711.0777e602@pwslap01u.europe.root.pri>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- Organization: Samsung Cambridge Solution Centre
- References: <CGME20180222072350epcas2p3185ca17f5f0e3ad69b0a41dbf743f145@epcas2p3.samsung.com> <CAGobuLee=R-FsgX=8XBg9Q2XHm17yLU6q3QzPWCiryCeTX7Kfg@mail.gmail.com> <20180222093711.0777e602@pwslap01u.europe.root.pri>
On Thu, 22 Feb 2018 09:37:11 +0000
Peter Stephenson <p.stephenson@xxxxxxxxxxx> wrote:
> On Wed, 21 Feb 2018 23:23:09 -0800
> wumingxwk@xxxxxxxxx wrote:
> > if there is only a '-' as argument,builtin echo won't print it
>
> You might have thought it should at least be turned off in some or most
> of the emulation modes...
Would look something like this. Probably a good idea if there aren't
subtleties?
pws
diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo
index 6c7ec4b..098b989 100644
--- a/Doc/Zsh/builtins.yo
+++ b/Doc/Zsh/builtins.yo
@@ -61,7 +61,9 @@ arguments, but is otherwise ignored. This is useful in cases where
arguments to the command may begin with `tt(-)'. For historical
reasons, most builtin commands also recognize a single `tt(-)' in a
separate word for this purpose; note that this is less standard and
-use of `tt(-)tt(-)' is recommended.
+use of `tt(-)tt(-)' is recommended. Use of a single `tt(-)' to
+terminate option processing is turned off if the option
+tt(POSIX_BUILTINS) is set.
startitem()
prefix(-)
diff --git a/Doc/Zsh/options.yo b/Doc/Zsh/options.yo
index 25b3d57..5217e62 100644
--- a/Doc/Zsh/options.yo
+++ b/Doc/Zsh/options.yo
@@ -2183,6 +2183,9 @@ Furthermore, the tt(getopts) builtin behaves in a POSIX-compatible
fashion in that the associated variable tt(OPTIND) is not made
local to functions.
+In addition, a single dash (`tt(-)') does not cause the termination of option
+processing: a double dash (`tt(-)tt(-)') is required.
+
Moreover, the warning and special exit code from
tt([[ -o )var(non_existent_option)tt( ]]) are suppressed.
)
diff --git a/Src/builtin.c b/Src/builtin.c
index fb59738..d2c6ec4 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -304,7 +304,8 @@ execbuiltin(LinkList args, LinkList assigns, Builtin bn)
if (!(flags & BINF_KEEPNUM) && idigit(arg[1]))
break;
/* For cd and friends, a single dash is not an option. */
- if ((flags & BINF_SKIPDASH) && !arg[1])
+ if (((flags & BINF_SKIPDASH) || isset(POSIXBUILTINS)) &&
+ !arg[1])
break;
if ((flags & BINF_DASHDASHVALID) && !strcmp(arg, "--")) {
/*
Messages sorted by:
Reverse Date,
Date,
Thread,
Author