zsh-workers
 help / color / mirror / code / Atom feed
* Weird behavior of conditionals with exclamations (ZSH 5.0.7)
@ 2015-06-14 22:50 Daniel Miranda
  2015-06-15  3:19 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Miranda @ 2015-06-14 22:50 UTC (permalink / raw)
  To: zsh-workers

I've recently encountered a bug in Fedora 22 where I get error
messages when browsing a folder that contains exclamation signs in
it's name in GNOME Terminal with ZSH.

I tracked it down to a profile.d script shipped by the VTE terminal
emulation library. The __vte_urlencode function triggers a "too many
arguments" error in the case I mentioned. You can see the code at the
GNOME miirror in Github [1].

The error happens at line 31:

while [ -n "$str" ]; do

If and only if the value of "$str" is '!', a string containing a
single exclamation. It seems the test command somehow attempts to
parse it as a modifier, instead of an actual string to be tested. The
same *does not* happen in Bash. It seems incorrect, or at least
strange, to me.

Somehow using [[ ]] works correctly. I don't know why that is the case.

Is that expected or have I ran into an issue?

Thanks,
Daniel

[1] https://github.com/GNOME/vte/blob/master/src/vte.sh#L26


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

* Re: Weird behavior of conditionals with exclamations (ZSH 5.0.7)
  2015-06-14 22:50 Weird behavior of conditionals with exclamations (ZSH 5.0.7) Daniel Miranda
@ 2015-06-15  3:19 ` Bart Schaefer
  2015-06-15  8:37   ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2015-06-15  3:19 UTC (permalink / raw)
  To: zsh-workers

On Jun 14,  7:50pm, Daniel Miranda wrote:
}
} while [ -n "$str" ]; do
} 
} If and only if the value of "$str" is '!', a string containing a
} single exclamation. It seems the test command somehow attempts to
} parse it as a modifier, instead of an actual string to be tested.

This has already been fixed in 5.0.8.  I don't know exactly which change
covered it, but:

schaefer[825] zsh-5.0.7 -f
torch% str='!'
torch% while [ -n "$str" ]; do
while> break
while> done
[: too many arguments
torch% 

schaefer[826] zsh-5.0.8 -f
torch% str='!'
torch% while [ -n "$str" ]; do
while> break
while> done
torch% 


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

* Re: Weird behavior of conditionals with exclamations (ZSH 5.0.7)
  2015-06-15  3:19 ` Bart Schaefer
@ 2015-06-15  8:37   ` Peter Stephenson
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Stephenson @ 2015-06-15  8:37 UTC (permalink / raw)
  To: zsh-workers

On Sun, 14 Jun 2015 20:19:21 -0700
Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Jun 14,  7:50pm, Daniel Miranda wrote:
> }
> } while [ -n "$str" ]; do
> } 
> } If and only if the value of "$str" is '!', a string containing a
> } single exclamation. It seems the test command somehow attempts to
> } parse it as a modifier, instead of an actual string to be tested.
> 
> This has already been fixed in 5.0.8.

Fairly late: 35306 / cb596a55d9.

pws


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

end of thread, other threads:[~2015-06-15  8:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-14 22:50 Weird behavior of conditionals with exclamations (ZSH 5.0.7) Daniel Miranda
2015-06-15  3:19 ` Bart Schaefer
2015-06-15  8:37   ` 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).