zsh-workers
 help / color / mirror / code / Atom feed
* Strange parsing bug(?)
@ 2008-10-01  0:56 Richard Hartmann
  2008-10-01  1:05 ` Richard Hartmann
  2008-10-01  6:06 ` Bart Schaefer
  0 siblings, 2 replies; 4+ messages in thread
From: Richard Hartmann @ 2008-10-01  0:56 UTC (permalink / raw)
  To: Zsh hackers list

Hi all,

I have stumbled upon a really weird bug. Due to it being late & me
being ill, I thought I did something wrong, but I pruned a rather
long & complex part of my zshrc down do this:

  echo "!"

The evil part is that a warning was part of a really deep & broad
boolean expression which made me assume I did something wrong
when the interactive parser failed to do what I wanted.

Frustrating when you find the actual cause after several hours :p

I suspect it's history access/modification gone awry because of
the exclamation mark and the fact that only interactive use is
affected, but I am not sure. Stuff in <brackets> are key presses,
the # is an 'inline' comment:

richih@roadwarrior ~ % zsh -f
roadwarrior% echo 'echo "!"' > temp
roadwarrior% source temp
!
roadwarrior% echo "!"
dquote> <Enter>
dquote> <CTRL-C>
roadwarrior% <UP>
roadwarrior% echo "
<CTRL-C> # there is a blank line, here. Cursor is at the left
roadwarrior% echo "!""

roadwarrior%


Of course, I might have stumbled onto a hidden feature, but if that
is the case, I would argue that this is extremely against the
expectation of most users.


Richard


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

* Re: Strange parsing bug(?)
  2008-10-01  0:56 Strange parsing bug(?) Richard Hartmann
@ 2008-10-01  1:05 ` Richard Hartmann
  2008-10-01  6:06 ` Bart Schaefer
  1 sibling, 0 replies; 4+ messages in thread
From: Richard Hartmann @ 2008-10-01  1:05 UTC (permalink / raw)
  To: Zsh hackers list

On Wed, Oct 1, 2008 at 02:56, Richard Hartmann
<richih.mailinglist@gmail.com> wrote:

> [crap]

Of course, the second I hit enter, I realize what the actual issue is.
I.e. the second I mentally step back from the problem, I realize it's
not actually a string I want to echo, any more. This _is_ an
interactive session, after all. The shell _has_ to act the way it does.

I blame my cold & headache ;)


Sorry for the noise,
Richard

PS: Of course, the man page was there to tell me about it, all
along

PPS: Whoever chose !" in the mists of time made a rather
annoying mistake. It's not as if an exclamation mark followed
by a string delimiter is rare..

PPPS: Is there any sane way to write code including !" that
will behave the same way in interactive & batch mode? And no,
using ! " does not count ;)


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

* Re: Strange parsing bug(?)
  2008-10-01  0:56 Strange parsing bug(?) Richard Hartmann
  2008-10-01  1:05 ` Richard Hartmann
@ 2008-10-01  6:06 ` Bart Schaefer
  2008-10-01  7:36   ` Richard Hartmann
  1 sibling, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2008-10-01  6:06 UTC (permalink / raw)
  To: Richard Hartmann, Zsh hackers list

On Oct 1,  2:56am, Richard Hartmann wrote:
}
} Of course, I might have stumbled onto a hidden feature, but if that
} is the case, I would argue that this is extremely against the
} expectation of most users.

It's not a hidden feature, but it is a feature.  Doc says:

   If the shell encounters the character sequence `!"' in the input,
   the history mechanism is temporarily disabled until the current list
   (see *Note Shell Grammar::) is fully parsed. The `!"' is removed
   from the input, and any subsequent `!' characters have no special
   significance.

If you don't want ! to be a history character, setopt nobanghist.  If
you do want it to be a history character, then ... get used to using
single quotes instead of double, I guess, because history doesn't
expand in single quotes.

(Aside:  I think it's actually the first character of $histchars and
then a double quote that has this effect, so the doc could be better.)


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

* Re: Strange parsing bug(?)
  2008-10-01  6:06 ` Bart Schaefer
@ 2008-10-01  7:36   ` Richard Hartmann
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Hartmann @ 2008-10-01  7:36 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Zsh hackers list

On Wed, Oct 1, 2008 at 08:06, Bart Schaefer <schaefer@brasslantern.com> wrote:

> It's not a hidden feature, but it is a feature.  Doc says:

Yah, I realized that pretty much the second I sent of the initial
email..

Stupid me.


Richard


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

end of thread, other threads:[~2008-10-01  7:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-01  0:56 Strange parsing bug(?) Richard Hartmann
2008-10-01  1:05 ` Richard Hartmann
2008-10-01  6:06 ` Bart Schaefer
2008-10-01  7:36   ` 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).