zsh-workers
 help / color / mirror / code / Atom feed
* bug in single_command
@ 2009-02-11 17:52 Richard Hartmann
  2009-02-11 18:13 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Hartmann @ 2009-02-11 17:52 UTC (permalink / raw)
  To: Zsh hackers list

[-- Attachment #1: Type: text/plain, Size: 2428 bytes --]

Quoting Doc/Zsh/options.yo for single_command:

The value of this option cannot be changed anywhere other than the command line.
My personal interpretation is that I can

  setopt single_command

which is obviously not correct. The -t command line switch works as
expected. Thus I suggest the attached patch.
Also, wouldn't it make sense to move errors into dosetopt() so the error
messages could be more explicit about _why_ a setopt went wrong?


Richard

>From 8eb5a7a88d94bffb3a5810f9a80e7d76d5f9d3a1 Mon Sep 17 00:00:00 2001
From: Richard Hartmann <richih@net.in.tum.de>
Date: Wed, 11 Feb 2009 18:45:16 +0100
Subject: [PATCH] Make explanation of 'permanent' options explicit

---
 Doc/Zsh/options.yo |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/Doc/Zsh/options.yo b/Doc/Zsh/options.yo
index 2cd02bf..b5ce813 100644
--- a/Doc/Zsh/options.yo
+++ b/Doc/Zsh/options.yo
@@ -1837,7 +1837,8 @@ 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 with command line parameters.
+It cannot be changed once zsh is running.
 )
 pindex(LOGIN)
 pindex(NO_LOGIN)
@@ -1891,8 +1892,8 @@ 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 with command line parameters.
+It cannot be changed once zsh is running.
 )
 pindex(SINGLE_COMMAND)
 pindex(NO_SINGLE_COMMAND)
@@ -1904,7 +1905,8 @@ 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 with command line parameters.
+It cannot be changed once zsh is running.
 )
 enditem()

-- 
1.5.6.5

[-- Attachment #2: 0001-Make-explanation-of-permanent-options-explicit.patch --]
[-- Type: text/x-diff, Size: 1972 bytes --]

From 8eb5a7a88d94bffb3a5810f9a80e7d76d5f9d3a1 Mon Sep 17 00:00:00 2001
From: Richard Hartmann <richih@net.in.tum.de>
Date: Wed, 11 Feb 2009 18:45:16 +0100
Subject: [PATCH] Make explanation of 'permanent' options explicit

---
 Doc/Zsh/options.yo |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/Doc/Zsh/options.yo b/Doc/Zsh/options.yo
index 2cd02bf..b5ce813 100644
--- a/Doc/Zsh/options.yo
+++ b/Doc/Zsh/options.yo
@@ -1837,7 +1837,8 @@ 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 with command line parameters.
+It cannot be changed once zsh is running.
 )
 pindex(LOGIN)
 pindex(NO_LOGIN)
@@ -1891,8 +1892,8 @@ 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 with command line parameters.
+It cannot be changed once zsh is running.
 )
 pindex(SINGLE_COMMAND)
 pindex(NO_SINGLE_COMMAND)
@@ -1904,7 +1905,8 @@ 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 with command line parameters.
+It cannot be changed once zsh is running.
 )
 enditem()
 
-- 
1.5.6.5


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

* Re: bug in single_command
  2009-02-11 17:52 bug in single_command Richard Hartmann
@ 2009-02-11 18:13 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2009-02-11 18:13 UTC (permalink / raw)
  To: Zsh hackers list

On Feb 11,  6:52pm, Richard Hartmann wrote:
}
} Quoting Doc/Zsh/options.yo for single_command:
} 
} The value of this option cannot be changed anywhere other than the
} command line.

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

} My personal interpretation is that I can
} 
}   setopt single_command
} 
} which is obviously not 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.

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

} Also, wouldn't it make sense to move errors into dosetopt() so the error
} messages could be more explicit about _why_ a setopt went wrong?

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


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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-11 17:52 bug in single_command Richard Hartmann
2009-02-11 18:13 ` Bart Schaefer

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