Issue #243 closed

options not recognized with zsh

Daniele Faraglia
created an issue

Hi, i've a lot of problems with virtualevnwrapper.sh and oh-my-zsh, i can't use mkvirtualenv, mkproject and all commands that parse args like this line: https://bitbucket.org/dhellmann/virtualenvwrapper/src/bde7ba80196f8d407e8329d7eb5cdec9e4f284d2/virtualenvwrapper.sh?at=master#cl-407

if i remove the condition dedicated to zsh, the bash one works.

➜  ~  zsh --version
zsh --version
zsh 5.0.2 (x86_64-pc-linux-gnu)
➜  ~  pip freeze | grep virtualenv
virtualenv==1.11.6
virtualenvwrapper==4.3.1

Comments (5)

  1. Doug Hellmann

    The tests pass under that version of zsh for me. Perhaps there is some other setting in your zshrc that causes argument parsing to be handled differently? I'm not that familiar with zsh, but usually when someone reports a problem it turns out to be something like that.

  2. Andrew Andrew

    Yeah, zsh has some KSH_ARRAY* options that affect how array indexing works, and zero-indexing in particular. Setting those could break this option parsing.

    You can defend against it with emulate -L to locally restore portability-affecting options to known values within a function call. E.g. doing

    if [ -n "$ZSH_VERSION" ]
    then
        emulate -L zsh
    fi
    

    will get you back to default zsh behavior (which you're testing under), or you could use emulate -L sh instead to get Bourne-like behavior. Could eliminate the need for some special cases, like this 0-vs-1-indexing thing. There are so many zsh options with significant effects that I've taken to doing this in most zsh functions intended for reuse.

  3. Log in to comment