zsh-workers
 help / color / mirror / code / Atom feed
* Proposed patch for options.yo (was: Re: bug in single_command)
@ 2009-02-11 20:13 Richard Hartmann
  2009-02-11 23:53 ` Richard Hartmann
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Hartmann @ 2009-02-11 20:13 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Zsh hackers list

First of all, sorry for the subject of the email. I wanted to change it
after I found out what the actual issue was but forgot. The body of the
mail changed quite substantially. Duh..

On Wed, Feb 11, 2009 at 19:13, Bart Schaefer <schaefer@brasslantern.com> wrote:

> I suggest changing "the command line" here to something like "in the
> flags supplied at invocation of the shell" to match terminology that
> is used elsewhere, e.g., the manual section "Invocation".

Very good point. I'll check against the docs that my terminology is
correct.


> It's true that "the command line" used elsewhere in the manual often
> refers to the equivalent of the ZLE input buffer.  On the other hand,
> it seems so obvious that "setopt single_command" would cause the shell
> to immediately exit (after all, it has now executed a single command!)
> that I hardly believe thsi is a source of significant confusion.

Hardly significant, agreed. But when reading docs, I go into pedantic
prick mode, looking for stuff to improve :p
Liberal in what you require, strict in what you provide and all that.


> A better question might be why these options are not mentioned in the
> "Invocation" section, since that's the only context in which they make
> sense, rather than being relegated to the "Single Letter Options".

I'll see where that fits and work it into the patch.


> Without looking, I'd suspect that the reason is that dosetopt() may at
> times be called from a context where emitting an error message is not
> appropriate.

No idea about appropriate (did not dig too deeply), but it _is_ used
without any checking of return values etc. Namely in

Src/builtin.c 540 & 541:

    dosetopt(VERBOSE, 0, 0);
    dosetopt(XTRACE, 0, 0);

All occurences in Src/init.c

Src/options.c 506:

static void
setoption(HashNode hn, int value)
{
    dosetopt(((Optname) hn)->optno, value, 0);
}


> In general it's bad programming to spew to the standard
> error stream at too low a level because it takes control away from the
> caller.

Agreed, but I didn't know it's too low when I wrote this (and I don't
think it's my place to decide those matters, anyway). That said, I
should have checked all places it is used in before suggesting direct
printing. Return values? Or passing back an actual string?


Richard


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Proposed patch for options.yo (was: Re: bug in single_command)
  2009-02-11 20:13 Proposed patch for options.yo (was: Re: bug in single_command) Richard Hartmann
@ 2009-02-11 23:53 ` Richard Hartmann
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Hartmann @ 2009-02-11 23:53 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Zsh hackers list

On Wed, Feb 11, 2009 at 21:13, Richard Hartmann
<richih.mailinglist@gmail.com> wrote:

> Very good point. I'll check against the docs that my terminology is
> correct.

First part, second will come tomorrow. Note that this is against trunk,
not my inital patch.


diff --git a/Doc/Zsh/options.yo b/Doc/Zsh/options.yo
index 2cd02bf..c6b4c5d 100644
--- a/Doc/Zsh/options.yo
+++ b/Doc/Zsh/options.yo
@@ -1837,7 +1837,9 @@ the standard input is a tty and commands are
being read from standard input.
 (See the discussion of tt(SHIN_STDIN).)
 This heuristic may be overridden by specifying a state for this option
 on the command line.
-The value of this option cannot be changed anywhere other than the
command line.
+The value of this option can only be changed via flags supplied at
+invocation of the shell.
+It cannot be changed once zsh is running.
 )
 pindex(LOGIN)
 pindex(NO_LOGIN)
@@ -1891,8 +1893,9 @@ Note that setting or unsetting this option on
the command line does not
 necessarily affect the state the option will have while the shell is
 running - that is purely an indicator of whether on not commands are
 em(actually) being read from standard input.
-The value of this option cannot be changed anywhere other
-than the command line.
+The value of this option can only be changed via flags supplied at
+invocation of the shell.
+It cannot be changed once zsh is running.
 )
 pindex(SINGLE_COMMAND)
 pindex(NO_SINGLE_COMMAND)
@@ -1904,7 +1907,9 @@ item(tt(SINGLE_COMMAND) (tt(-t), ksh: tt(-t)))(
 If the shell is reading from standard input, it exits after a single command
 has been executed.  This also makes the shell non-interactive, unless the
 tt(INTERACTIVE) option is explicitly set on the command line.
-The value of this option cannot be changed anywhere other than the
command line.
+The value of this option can only be changed via flags supplied at
+invocation of the shell.
+It cannot be changed once zsh is running.
 )
 enditem()


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-02-11 23:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-11 20:13 Proposed patch for options.yo (was: Re: bug in single_command) Richard Hartmann
2009-02-11 23:53 ` Richard Hartmann

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).