Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

Bad ZSH Compile #19499

Closed
eatnumber1 opened this issue Apr 29, 2013 · 7 comments
Closed

Bad ZSH Compile #19499

eatnumber1 opened this issue Apr 29, 2013 · 7 comments

Comments

@eatnumber1
Copy link

The following crashes ZSH

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

I emailed the zsh-users mailing list about it and was told that it's due to an incorrect compile of ZSH. Re-installing ZSH didn't help, so I assume it's a problem with the package.

Sorry I haven't had time to look into it further.

@adamv
Copy link
Contributor

adamv commented Apr 29, 2013

Please link to the mailing list.

@eatnumber1
Copy link
Author

@mistydemeo
Copy link
Member

Can you post your brew --config?

@eatnumber1
Copy link
Author

HOMEBREW_VERSION: 0.9.4
ORIGIN: http://github.com/mxcl/homebrew.git
HEAD: 672af665e8e1b0eee627da47eb92b85b95ceba57
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: dual-core 64-bit penryn
OS X: 10.8.3-x86_64
Xcode: 4.6.1
CLT: 4.4.0.0.1.1249367152
LLVM-GCC: build 2336
Clang: 4.0 build 421
X11: 2.7.4 => /opt/X11
System Ruby: 1.8.7-358
Perl: /usr/bin/perl
Python: /usr/bin/python
Ruby: /usr/local/var/rbenv/shims/ruby

@eatnumber1
Copy link
Author

This is actually probably related to a ZSH bug which was found (same thread as I posted above). I'll leave this bug open pending a response on the mailing list.

@adamv
Copy link
Contributor

adamv commented May 4, 2013

Any new information on the mailing list or bug tracker?

@eatnumber1
Copy link
Author

Yep, the following patch was applied to master which fixes the crash. Note that you may have trouble if you try to apply this patch directly as ZSH source uses a mixture of tabs and spaces and github seems to turn the tabs in the patch into spaces.

--- zsh-5.0.2/Src/init.c    2012-11-09 13:53:12.000000000 -0800
+++ zsh-5.0.2.new/Src/init.c    2013-05-04 11:40:02.000000000 -0700
@@ -281,9 +281,10 @@

 /**/
 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 @@
            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 @@
            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);
            }
        }
        }

@Homebrew Homebrew locked and limited conversation to collaborators Feb 16, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants