* "set -o foo" does not fail / does not abort the shell
@ 2007-12-11 12:54 Vincent Lefevre
2007-12-11 13:56 ` Peter Stephenson
0 siblings, 1 reply; 4+ messages in thread
From: Vincent Lefevre @ 2007-12-11 12:54 UTC (permalink / raw)
To: zsh-workers
I've tried the following with zsh-4.3.4-dev-4:
$ Src/zsh -f -c 'emulate sh; set -o foo; echo "Didn''t abort ($?)"'
set: no such option: foo
Didn't abort (0)
This is incorrect. The shell should abort as 'set' is a special
builtin[*]:
$ ksh93 -c 'set -o foo; echo "Didn''t abort ($?)"'
ksh93[1]: set: foo: bad option(s)
Usage: set [-sabefhkmnprtuvxBCGH] [-A name] [-o[option]] [arg ...]
zsh: exit 2 ksh93 -c 'set -o foo; echo "Didn't abort ($?)"'
[*] http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_08_01
http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_14
See also the discussion on:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=452972
And in an interactive shell, "set -o foo" should return with a
non-zero exit status.
Please check the other special builtins:
http://www.opengroup.org/onlinepubs/009695399/idx/sbi.html
--
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: "set -o foo" does not fail / does not abort the shell
2007-12-11 12:54 "set -o foo" does not fail / does not abort the shell Vincent Lefevre
@ 2007-12-11 13:56 ` Peter Stephenson
2007-12-11 16:35 ` Bart Schaefer
0 siblings, 1 reply; 4+ messages in thread
From: Peter Stephenson @ 2007-12-11 13:56 UTC (permalink / raw)
To: zsh-workers
Vincent Lefevre wrote:
> I've tried the following with zsh-4.3.4-dev-4:
>
> $ Src/zsh -f -c 'emulate sh; set -o foo; echo "Didn''t abort ($?)"'
> set: no such option: foo
> Didn't abort (0)
>
> This is incorrect. The shell should abort as 'set' is a special
> builtin[*]:
This is easy.
> Please check the other special builtins:
>
> http://www.opengroup.org/onlinepubs/009695399/idx/sbi.html
This is a big job. Someone will have to volunteer for this.
Index: Src/builtin.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/builtin.c,v
retrieving revision 1.181
diff -u -r1.181 builtin.c
--- Src/builtin.c 6 Nov 2007 11:04:35 -0000 1.181
+++ Src/builtin.c 11 Dec 2007 13:08:10 -0000
@@ -567,9 +567,9 @@
return 0;
}
if(!(optno = optlookup(*args)))
- zwarnnam(nam, "no such option: %s", *args);
+ zerrnam(nam, "no such option: %s", *args);
else if(dosetopt(optno, action, 0))
- zwarnnam(nam, "can't change option: %s", *args);
+ zerrnam(nam, "can't change option: %s", *args);
break;
} else if(**args == 'A') {
if(!*++*args)
@@ -588,13 +588,15 @@
sort = action ? 1 : -1;
else {
if (!(optno = optlookupc(**args)))
- zwarnnam(nam, "bad option: -%c", **args);
+ zerrnam(nam, "bad option: -%c", **args);
else if(dosetopt(optno, action, 0))
- zwarnnam(nam, "can't change option: -%c", **args);
+ zerrnam(nam, "can't change option: -%c", **args);
}
}
args++;
}
+ if (errflag)
+ return 1;
doneoptions:
inittyptab();
--
Peter Stephenson <pws@csr.com> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: "set -o foo" does not fail / does not abort the shell
2007-12-11 13:56 ` Peter Stephenson
@ 2007-12-11 16:35 ` Bart Schaefer
2007-12-11 16:39 ` Peter Stephenson
0 siblings, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2007-12-11 16:35 UTC (permalink / raw)
To: zsh-workers
On Dec 11, 1:56pm, Peter Stephenson wrote:
}
} Vincent Lefevre wrote:
} > I've tried the following with zsh-4.3.4-dev-4:
} >
} > $ Src/zsh -f -c 'emulate sh; set -o foo; echo "Didn''t abort ($?)"'
} > set: no such option: foo
} > Didn't abort (0)
} >
} > This is incorrect. The shell should abort as 'set' is a special
} > builtin[*]:
}
} This is easy.
I'm left wondering if this shouldn't be a POSIX-mode thing, i.e. whether
zsh in "native mode" should continue as it has.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: "set -o foo" does not fail / does not abort the shell
2007-12-11 16:35 ` Bart Schaefer
@ 2007-12-11 16:39 ` Peter Stephenson
0 siblings, 0 replies; 4+ messages in thread
From: Peter Stephenson @ 2007-12-11 16:39 UTC (permalink / raw)
To: zsh-workers
Bart Schaefer wrote:
> On Dec 11, 1:56pm, Peter Stephenson wrote:
> }
> } Vincent Lefevre wrote:
> } > I've tried the following with zsh-4.3.4-dev-4:
> } >
> } > $ Src/zsh -f -c 'emulate sh; set -o foo; echo "Didn''t abort ($?)"'
> } > set: no such option: foo
> } > Didn't abort (0)
> } >
> } > This is incorrect. The shell should abort as 'set' is a special
> } > builtin[*]:
> }
> } This is easy.
>
> I'm left wondering if this shouldn't be a POSIX-mode thing, i.e. whether
> zsh in "native mode" should continue as it has.
I'd be more impressed with that if zsh as it was even returned a
non-zero status in this case, but it doesn't. So some kind of change
definitely seems warranted.
--
Peter Stephenson <pws@csr.com> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-12-11 16:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-11 12:54 "set -o foo" does not fail / does not abort the shell Vincent Lefevre
2007-12-11 13:56 ` Peter Stephenson
2007-12-11 16:35 ` Bart Schaefer
2007-12-11 16:39 ` Peter Stephenson
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).