zsh-workers
 help / color / mirror / code / Atom feed
* Bug in syntax check
@ 2016-06-04  5:13 Felipe Contreras
  2016-06-04  6:46 ` Bart Schaefer
  2016-06-04  6:50 ` Bart Schaefer
  0 siblings, 2 replies; 6+ messages in thread
From: Felipe Contreras @ 2016-06-04  5:13 UTC (permalink / raw)
  To: zsh-workers

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

Hi,

The following script works fine, but when run with 'zsh -n' the syntax
checker returns an error:

6: no such user or named directory: tmp

Ideally the checker should know that the named directory was set in the
same script (it doesn't check the ones in the environment either), but at
the very least it shouldn't check the named directories at all.

It's better to not check anything that throw bad errors.

Cheers.

---

#!/bin/zsh

emulate sh

hash -d tmp=/tmp
hash -d test=~tmp/test

echo ~test
-- 
Felipe Contreras

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

* Re: Bug in syntax check
  2016-06-04  5:13 Bug in syntax check Felipe Contreras
@ 2016-06-04  6:46 ` Bart Schaefer
  2016-06-04  6:50 ` Bart Schaefer
  1 sibling, 0 replies; 6+ messages in thread
From: Bart Schaefer @ 2016-06-04  6:46 UTC (permalink / raw)
  To: zsh-workers

On Jun 4,  5:13am, Felipe Contreras wrote:
} 
} The following script works fine, but when run with 'zsh -n' the syntax
} checker returns an error:
} 
} 6: no such user or named directory: tmp


diff --git a/Src/subst.c b/Src/subst.c
index 4e13ce1..8e704b1 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -691,7 +691,7 @@ filesubstr(char **namptr, int assign)
 		return 0;
 	    *ptr = 0;
 	    if (!(hom = getnameddir(++str))) {
-		if (isset(NOMATCH))
+		if (isset(NOMATCH) && isset(EXECOPT))
 		    zerr("no such user or named directory: %s", str);
 		*ptr = save;
 		return 0;


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

* Re: Bug in syntax check
  2016-06-04  5:13 Bug in syntax check Felipe Contreras
  2016-06-04  6:46 ` Bart Schaefer
@ 2016-06-04  6:50 ` Bart Schaefer
  2016-06-04  8:38   ` Felipe Contreras
  2016-06-04 10:36   ` Mikael Magnusson
  1 sibling, 2 replies; 6+ messages in thread
From: Bart Schaefer @ 2016-06-04  6:50 UTC (permalink / raw)
  To: zsh-workers

On Jun 4,  5:13am, Felipe Contreras wrote:
}
} It's better to not check anything that throw bad errors.

Incidentally, how are you managing to get NOMATCH and NOEXEC set at
the same time?  NOMATCH is not a default option and NOEXEC should be
preventing any setopt calls from changing that.


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

* Re: Bug in syntax check
  2016-06-04  6:50 ` Bart Schaefer
@ 2016-06-04  8:38   ` Felipe Contreras
  2016-06-04 16:54     ` Bart Schaefer
  2016-06-04 10:36   ` Mikael Magnusson
  1 sibling, 1 reply; 6+ messages in thread
From: Felipe Contreras @ 2016-06-04  8:38 UTC (permalink / raw)
  To: Bart Schaefer, zsh-workers

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

On Sat, Jun 4, 2016 at 1:50 AM Bart Schaefer <schaefer@brasslantern.com>
wrote:

> On Jun 4,  5:13am, Felipe Contreras wrote:
> }
> } It's better to not check anything that throw bad errors.
>
> Incidentally, how are you managing to get NOMATCH and NOEXEC set at
> the same time?  NOMATCH is not a default option and NOEXEC should be
> preventing any setopt calls from changing that.
>

I don't know what you are talking about.

BTW.  The 'emulate sh' is irrelevant, I added it for debugging purposes and
forgot to remove it.

Cheers.
-- 
Felipe Contreras

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

* Re: Bug in syntax check
  2016-06-04  6:50 ` Bart Schaefer
  2016-06-04  8:38   ` Felipe Contreras
@ 2016-06-04 10:36   ` Mikael Magnusson
  1 sibling, 0 replies; 6+ messages in thread
From: Mikael Magnusson @ 2016-06-04 10:36 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-workers

On Sat, Jun 4, 2016 at 8:50 AM, Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Jun 4,  5:13am, Felipe Contreras wrote:
> }
> } It's better to not check anything that throw bad errors.
>
> Incidentally, how are you managing to get NOMATCH and NOEXEC set at
> the same time?  NOMATCH is not a default option and NOEXEC should be
> preventing any setopt calls from changing that.

% zsh -fc 'echo $options[nomatch]'
on

-- 
Mikael Magnusson


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

* Re: Bug in syntax check
  2016-06-04  8:38   ` Felipe Contreras
@ 2016-06-04 16:54     ` Bart Schaefer
  0 siblings, 0 replies; 6+ messages in thread
From: Bart Schaefer @ 2016-06-04 16:54 UTC (permalink / raw)
  To: zsh-workers

On Jun 4,  8:38am, Felipe Contreras wrote:
}
} I don't know what you are talking about.

Sorry, the actual question should be how I managed to get it turned off.
I blame jet lag (the same reason I was awake (though plainly not all that
alert) and fiddling with this at such a strange hour).


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

end of thread, other threads:[~2016-06-04 16:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-04  5:13 Bug in syntax check Felipe Contreras
2016-06-04  6:46 ` Bart Schaefer
2016-06-04  6:50 ` Bart Schaefer
2016-06-04  8:38   ` Felipe Contreras
2016-06-04 16:54     ` Bart Schaefer
2016-06-04 10:36   ` Mikael Magnusson

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