Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-regex-match not available for regex #227

Closed
wolph opened this issue Feb 27, 2011 · 12 comments
Closed

-regex-match not available for regex #227

wolph opened this issue Feb 27, 2011 · 12 comments

Comments

@wolph
Copy link

wolph commented Feb 27, 2011

It seems that the FreeBSD version of ZSH compiles slightly different. I do have the ZSH_PCRE flag enabled but I still keep getting these errors:

title:3: failed to load module: zsh/regex
title:3: -regex-match not available for regex

I know I can disable it in title, but it looks like these regexes are integrated through the entire system so I'm not sure if that would help much.

I'm running:

  • Zsh 4.3.10_4
  • FreeBSD 7.2
@sorin-ionescu
Copy link
Contributor

You must be using an old version of oh-my-zsh or a plugin for I grep’ed for ‘regex-match’ and I cannot find it. title uses the built-in =~ operator. That said, -regex-match is for extended regular expressions and -pcre-match is for PCRE.

@wolph
Copy link
Author

wolph commented Feb 28, 2011

I just executed this command as specified by the readme:

wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh

Here's the install log:

--2011-02-28 00:23:51--  https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh
Resolving github.com... 207.97.227.239
Connecting to github.com|207.97.227.239|:443... connected.
WARNING: cannot verify github.com's certificate, issued by `/C=US/ST=Arizona/L=Scottsdale/O=GoDaddy.com, Inc./OU=http://certificates.godaddy.com/repository/CN=Go Daddy Secure Certification Authority/serialNumber=07969287':
  Self-signed certificate encountered.
WARNING: certificate common name `*.github.com' doesn't match requested host name `github.com'.
HTTP request sent, awaiting response... 200 OK
Length: 1186 (1.2K) [text/plain]
Saving to: `STDOUT'

100%[=============================================================================================================================================================================================================================>] 1,186       --.-K/s   in 0s      

2011-02-28 00:23:52 (368 MB/s) - written to stdout [1186/1186]

Cloning Oh My Zsh...
Cloning into /home/user/.oh-my-zsh...
remote: Counting objects: 1564, done.
remote: Compressing objects: 100% (783/783), done.
remote: Total 1564 (delta 957), reused 1302 (delta 730)
Receiving objects: 100% (1564/1564), 183.78 KiB, done.
Resolving deltas: 100% (957/957), done.
Looking for an existing zsh config...
Found ~/.zshrc. Backing up to ~/.zshrc.pre-oh-my-zsh
Using the Oh My Zsh template file and adding it to ~/.zshrc
Copying your current PATH and adding it to the end of ~/.zshrc for you.
Time to change your default shell to zsh!
chsh: /usr/bin/env zsh: non-standard shell
         __                                     __  
  ____  / /_     ____ ___  __  __   ____  _____/ /_ 
 / __ \/ __ \   / __ `__ \/ / / /  /_  / / ___/ __ \ 
/ /_/ / / / /  / / / / / / /_/ /    / /_(__  ) / / / 
\____/_/ /_/  /_/ /_/ /_/\__, /    /___/____/_/ /_/  
                        /____/
\n\n ....is now installed.
source: not found

After that I just execute zsh to enable the new settings and I get:

title:3: failed to load module: zsh/regex
title:3: -regex-match not available for regex

It seems that the =~ operator is not available in my zsh installation.

@sorin-ionescu
Copy link
Contributor

This is not a bug in ZSH. My advice to you is to recompile your ZSH. =~ is essential and used often by many scripts.

@wolph
Copy link
Author

wolph commented Feb 28, 2011

That's the first thing I tried before creating this ticket. Perhaps it's something in my environment, I'll try it on a different machine with a clean profile aswell.

@sorin-ionescu
Copy link
Contributor

You need to pass flags to configure to enable regex like —enable-regex and —enable-pcre. Google for how to compile it properly.

@wolph
Copy link
Author

wolph commented Mar 2, 2011

I have just tried to install it on a different (newer, FreeBSD 8.2 instead of 7.2) machine and that worked mostly fine.

Passing a flag like --enable-regex to the configure command is not as easy as you might think. Because I want to keep my software at the standard FreeBSD ports collection, passing manual arguments to the compilation progress would be tedious.

There are some small bugs/issues in the install though...

  • The default install does a git clone git://github.com/robbyrussell/oh-my-zsh.git, since my firewall is pretty closed up that doesn't work.
    Using git clone https://github.com/robbyrussell/oh-my-zsh.git works just about anywhere and only has the downside of being a tiny bit slower.

  • Than it tries to change the shell to /usr/bin/env zsh which is a non-standard shell so it won't work.

    chsh: /usr/bin/env zsh: non-standard shell

This does work:

chsh -s `which zsh`
  • At the end of install.sh there's a source ~/.zshrc which is executed from sh since the command was executed by sh instead of zsh and obviously won't work.

If the command would be changed to this, it would work:

wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh

It seems silly though, since the install script has these lines at the bottom:

/usr/bin/env zsh
source ~/.zshrc

Should I assume that the /usr/bin/env zsh is meant to directly activate the shell? If so, than what is the source ~/.zshrc for? That won't do any good since sh can't parse it and simply sourcing the .zshrc in a session that will exit immediately after seems futile too.

  • Running uninstall_oh_my_zsh gives errors too:
Removing ~/.oh-my-zsh
[[: not found
Looking for an existing zsh config...
Switching back to bash
chsh: /bin/bash: non-standard shell
source: not found
Thanks for trying out Oh My Zsh. It's been uninstalled.

Not sure what 's causing the [[: not found, but switching to /bin/bash doesn't work on many Unix systems. bash is only installed in /bin/ on Linux systems (not sure how Mac does it though). That should be something like:

chsh -s `which bash`

Or even better, it should remember the previous shell ;)
Using $SHELL should work in most cases.

@sorin-ionescu
Copy link
Contributor

Make the changes yourself then make a pull request. Don’t depend on wget. It’s not available on all systems. Check for both wget and curl.

@wolph
Copy link
Author

wolph commented Mar 3, 2011

wget isn't my idea, that line was copied straight from the manual: https://github.com/robbyrussell/oh-my-zsh/blob/master/README.textile

But I agree, there should be examples for wget, curl and fetch.

@jerome-diver
Copy link

build_left_prompt:9: failed to load module `zsh/regex': Cannot open "/usr/local/lib/zsh/5.6.2/zsh/regex.so"                                                                                                          
build_left_prompt:9: -regex-match not available for regex
build_right_prompt:9: failed to load module `zsh/regex': Cannot open "/usr/local/lib/zsh/5.6.2/zsh/regex.so"
build_right_prompt:9: -regex-match not available for regex

this is happening on FreeBSD-12.1 when Synth try to use zsh for nextcloud
I miss-understand what i can do for fix the problem.

@y2kbadbug
Copy link

@jerome-diver and for anyone else using FreeBSD that see this. Remove the STATIC use flag to fix this issue.

@jerome-diver
Copy link

@y2kbadbug thank you for your help. What is the "STATIC" use flag ? Where is this flag to remove from ?

@y2kbadbug
Copy link

@y2kbadbug thank you for your help. What is the "STATIC" use flag ? Where is this flag to remove from ?

Sorry for not being specific. It's the make options flag which would require you to build the port if the pre-built package doesn't have it.

nguymin4 pushed a commit to nguymin4/oh-my-zsh that referenced this issue Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants