zsh-workers
 help / color / mirror / code / Atom feed
* Re: Augmenting a Sticky Emulation Mode
       [not found]           ` <CA+zrezS4X+=rkp42WWqcYC3eFZL95DgPHmKkGaEJj+R6ZB2BNg@mail.gmail.com>
@ 2013-04-29 18:11             ` Bart Schaefer
  2013-04-29 18:47               ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2013-04-29 18:11 UTC (permalink / raw)
  To: Russell Harmon, zsh-workers

[Re-routing to -workers]

On Apr 29, 10:59am, Russell Harmon wrote:
} 
} I'm also seeing the same odd behavior (but not the crash) on Fedora's build
} of ZSH: zsh 5.0.2 (x86_64-redhat-linux-gnu)

Hmm, this may be a real bug.  I don't see exactly this with a fresh
build on MacOS, but I do see something a little funny.

schaefer<501> emulate -R sh -o noshglob -c 'foo() { setopt; }'; foo
interactive
longlistjobs
monitor
shinstdin
zle



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

* Re: Augmenting a Sticky Emulation Mode
  2013-04-29 18:11             ` Augmenting a Sticky Emulation Mode Bart Schaefer
@ 2013-04-29 18:47               ` Bart Schaefer
  2013-04-29 21:17                 ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2013-04-29 18:47 UTC (permalink / raw)
  To: Russell Harmon, zsh-workers

On Apr 29, 11:11am, Bart Schaefer wrote:
} Subject: Re: Augmenting a Sticky Emulation Mode
}
} [Re-routing to -workers]
} 
} Hmm, this may be a real bug.  I don't see exactly this with a fresh
} build on MacOS, but I do see something a little funny.

OK, I found the problem, but I don't know what to do to fix it.

It's the "no" prefix.

macadamia<506> emulate -R sh -o noshglob -c 'foo() { setopt; }'; foo
interactive
longlistjobs
monitor
shinstdin
macadamia<509> emulate -R sh +o shglob -c 'foo() { setopt; }'; foo
interactive
monitor
noshglob
shinstdin

The -o option to emulate doesn't know how to invert an option when the
"no" is put in front of it, and ends up treating it as the positive of
something else, probably garbage in the data structure.


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

* Re: Augmenting a Sticky Emulation Mode
  2013-04-29 18:47               ` Bart Schaefer
@ 2013-04-29 21:17                 ` Bart Schaefer
  2013-04-30  5:34                   ` Russell Harmon
  0 siblings, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2013-04-29 21:17 UTC (permalink / raw)
  To: Russell Harmon, zsh-workers

On Apr 29, 11:47am, Bart Schaefer wrote:
}
} OK, I found the problem, but I don't know what to do to fix it.

This seems to do it.

diff --git a/Src/init.c b/Src/init.c
index 8467a73..49ac124 100644
--- a/Src/init.c
+++ b/Src/init.c
@@ -281,9 +281,10 @@ parseargs(char **argv, char **runscript)
 
 /**/
 static void
-parseopts_insert(LinkList optlist, void *ptr)
+parseopts_insert(LinkList optlist, void *base, int optno)
 {
     LinkNode node;
+    void *ptr = base + (optno < 0 ? -optno : optno);
 
     for (node = firstnode(optlist); node; incnode(node)) {
 	if (ptr < getdata(node)) {
@@ -390,7 +391,7 @@ parseopts(char *nam, char ***argvp, char *new_opts, char **cmdp,
 		    if (dosetopt(optno, action, !nam, new_opts) && nam) {
 			WARN_OPTION("can't change option: %s", *argv);
 		    } else if (optlist) {
-			parseopts_insert(optlist, new_opts+optno);
+			parseopts_insert(optlist, new_opts, optno);
 		    }
 		}
               break;
@@ -415,7 +416,7 @@ parseopts(char *nam, char ***argvp, char *new_opts, char **cmdp,
 		    if (dosetopt(optno, action, !nam, new_opts) && nam) {
 			WARN_OPTION("can't change option: -%c", **argv);
 		    } else if (optlist) {
-			parseopts_insert(optlist, new_opts+optno);
+			parseopts_insert(optlist, new_opts, optno);
 		    }
 		}
 	    }

-- 
Barton E. Schaefer


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

* Re: Augmenting a Sticky Emulation Mode
  2013-04-29 21:17                 ` Bart Schaefer
@ 2013-04-30  5:34                   ` Russell Harmon
  0 siblings, 0 replies; 4+ messages in thread
From: Russell Harmon @ 2013-04-30  5:34 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-workers

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

It seems as though my crash is also related to this bug. According to the
docs, BRACE_EXPAND is an alias for NO_IGNORE_BRACES.

emulate -R sh +o ignorebraces -c 'foo() { setopt; }'

works and doesn't crash the shell

--
Russell Harmon


On Mon, Apr 29, 2013 at 2:17 PM, Bart Schaefer <schaefer@brasslantern.com>wrote:

> On Apr 29, 11:47am, Bart Schaefer wrote:
> }
> } OK, I found the problem, but I don't know what to do to fix it.
>
> This seems to do it.
>
> diff --git a/Src/init.c b/Src/init.c
> index 8467a73..49ac124 100644
> --- a/Src/init.c
> +++ b/Src/init.c
> @@ -281,9 +281,10 @@ parseargs(char **argv, char **runscript)
>
>  /**/
>  static void
> -parseopts_insert(LinkList optlist, void *ptr)
> +parseopts_insert(LinkList optlist, void *base, int optno)
>  {
>      LinkNode node;
> +    void *ptr = base + (optno < 0 ? -optno : optno);
>
>      for (node = firstnode(optlist); node; incnode(node)) {
>         if (ptr < getdata(node)) {
> @@ -390,7 +391,7 @@ parseopts(char *nam, char ***argvp, char *new_opts,
> char **cmdp,
>                     if (dosetopt(optno, action, !nam, new_opts) && nam) {
>                         WARN_OPTION("can't change option: %s", *argv);
>                     } else if (optlist) {
> -                       parseopts_insert(optlist, new_opts+optno);
> +                       parseopts_insert(optlist, new_opts, optno);
>                     }
>                 }
>                break;
> @@ -415,7 +416,7 @@ parseopts(char *nam, char ***argvp, char *new_opts,
> char **cmdp,
>                     if (dosetopt(optno, action, !nam, new_opts) && nam) {
>                         WARN_OPTION("can't change option: -%c", **argv);
>                     } else if (optlist) {
> -                       parseopts_insert(optlist, new_opts+optno);
> +                       parseopts_insert(optlist, new_opts, optno);
>                     }
>                 }
>             }
>
> --
> Barton E. Schaefer
>

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

end of thread, other threads:[~2013-04-30  5:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CA+zrezRfVDfTHYMMj2HpeyrUJvyuTQ=p+PL0tV6u3hcZ1nOfAw@mail.gmail.com>
     [not found] ` <130426180127.ZM18989@torch.brasslantern.com>
     [not found]   ` <CA+zrezROkjsD5mum5TCZ02h5Z+MTWiHC59cyuAyt1J0xpgUG+g@mail.gmail.com>
     [not found]     ` <CA+zrezTCVO58URokScwT45VHa_MkgpvnEuNbvzB+Uk97+WpQRQ@mail.gmail.com>
     [not found]       ` <20130429094700.6c8db4a9@pwslap01u.europe.root.pri>
     [not found]         ` <CA+zrezT4Xn6sUPciVd=6m2M=gfTavnA8MzcjL11AzxmAGUfowA@mail.gmail.com>
     [not found]           ` <CA+zrezS4X+=rkp42WWqcYC3eFZL95DgPHmKkGaEJj+R6ZB2BNg@mail.gmail.com>
2013-04-29 18:11             ` Augmenting a Sticky Emulation Mode Bart Schaefer
2013-04-29 18:47               ` Bart Schaefer
2013-04-29 21:17                 ` Bart Schaefer
2013-04-30  5:34                   ` Russell Harmon

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