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

Ugrep search throws error -z option not available in new Homebrew ugrep v5.1.2 #380

Closed
ciscohack opened this issue Apr 4, 2024 · 16 comments
Labels
problem Something isn't working due to a (minor) problem

Comments

@ciscohack
Copy link

Hello Expert,

I did ugrep upgrade to 5.1.2 and while search getting the below error due to which not able to search.. it was working few min back before upgrade

image
@ciscohack
Copy link
Author

ciscohack commented Apr 4, 2024

I have ugrep config file with decompress search option enabled ..it seems broken code to me

image

@genivia-inc
Copy link
Member

genivia-inc commented Apr 4, 2024

What does ugrep --version say? It looks like it may have been built without libz linkage. Without libz it won't decompress anything. Since libz is available pretty much anywhere, I don't know what caused this. Did you built ugrep with ./build.sh?

@genivia-inc
Copy link
Member

The CI test of 5.1.2 passes and includes all compression libraries, like all machines we test on our end before releasing an update:

image

@ciscohack
Copy link
Author

The CI test of 5.1.2 passes and includes all compression libraries, like all machines we test on our end before releasing an update:

image

Thanks for quick response then why i am having mentioned error ... it wasn't there one release before with same config

@genivia-inc
Copy link
Member

The error only occurs when ugrep was not built with libz, there is no other cause:

#ifndef HAVE_LIBZ
  // -z: but we don't have libz
  if (flag_decompress)
    usage("option -z is not available in this build configuration of ugrep");
#endif

The configure scripts have only minor changes and some restructuring, one change is to use pkg-config to detect libraries. That is a pretty standard way these days to detect libraries. If the libraries cannot be found at the usual locations, then it is still possible to specify custom locations with ./build.sh, which calls ./configure.

When you run ./build.sh it should show something like this:

checking for libpcre2-8... yes
checking for zlib... yes
checking for library containing BZ2_bzRead... -lbz2
checking for bzlib.h... yes
checking for liblzma... yes
checking for liblz4... yes
checking for libzstd... yes
checking for libbrotlidec... yes
checking for --disable-7zip... no

The second line in the above sets HAVE_LIBZ to 1 in config.h. Then make produces ugrep linked with libz and the error is not there, for sure.

@ciscohack
Copy link
Author

The error only occurs when ugrep was not built with libz, there is no other cause:

#ifndef HAVE_LIBZ
  // -z: but we don't have libz
  if (flag_decompress)
    usage("option -z is not available in this build configuration of ugrep");
#endif

The configure scripts have only minor changes and some restructuring, one change is to use pkg-config to detect libraries. That is a pretty standard way these days to detect libraries. If the libraries cannot be found at the usual locations, then it is still possible to specify custom locations with ./build.sh, which calls ./configure.

When you run ./build.sh it should show something like this:

checking for libpcre2-8... yes
checking for zlib... yes
checking for library containing BZ2_bzRead... -lbz2
checking for bzlib.h... yes
checking for liblzma... yes
checking for liblz4... yes
checking for libzstd... yes
checking for libbrotlidec... yes
checking for --disable-7zip... no

The second line in the above sets HAVE_LIBZ to 1 in config.h. Then make produces ugrep linked with libz and the error is not there, for sure.

I installed via brew ..should I reinstall the tool ..will it solve the problem

@ciscohack
Copy link
Author

ciscohack commented Apr 4, 2024

is there any command to re-generate .ugrep config file .. I tried ug --config option but not working for me ..can you please help me with exact command syntax to generate new .ugrep file

@ciscohack
Copy link
Author

@genivia-inc I did a reinstall but the same error and ./build.sh seems I will get only when I close and recompile but as I said I am using brew to install on my macOS 14.3... request you to please me to get rid of this problem..

or help me to install old version if we can't fix this issue

@ciscohack
Copy link
Author

@genivia-inc Here is the code fix missing in 5.1.2 and causing a broken -z option... request you please fix and ugrep is now missing major feature I used most -z option

https://github.com/Genivia/ugrep-indexer/releases/tag/v0.9.6

@genivia-inc
Copy link
Member

Looks like brew install is broken?

$ ugrep --version
ugrep 5.1.2 aarch64-apple-darwin21.6.0 +neon/AArch64

shows no -P and -z!

@ciscohack
Copy link
Author

ciscohack commented Apr 4, 2024

Looks like brew install is broken?

$ ugrep --version
ugrep 5.1.2 aarch64-apple-darwin21.6.0 +neon/AArch64

shows no -P and -z!

yes look like brew install is broken for sure -z and --decompress option is I tried and broken and most likely other options could also have problem..

here is my output

ugrep --version
ugrep 5.1.2 aarch64-apple-darwin23.4.0 +neon/AArch64
License: BSD-3-Clause; ugrep user manual: https://ugrep.com
Written by Robert van Engelen and others: https://github.com/Genivia/ugrep
Ugrep utilizes the RE/flex regex library: https://github.com/Genivia/RE-flex

@genivia-inc
Copy link
Member

I will revert the configure script to the one I've used with 5.1.1 that worked for Homebrew, but with a few minor changes to include additions. Then update 5.1.3 should work for homebrew again as it had worked before.

@ciscohack
Copy link
Author

I will revert the configure script to the one I've used with 5.1.1 that worked for Homebrew, but with a few minor changes to include additions. Then update 5.1.3 should work for homebrew again as it had worked before.

thank you so much

@genivia-inc
Copy link
Member

genivia-inc commented Apr 4, 2024

I've committed and released 5.1.3 that reverts the configure script changes (those where suggested by others #339, I should have known better) that affect compression libraries and PCRE2 detection.

It may take a couple of hours for Homebrew ugrep to update to 5.1.3.

Hopefully the problem is fixed. If not, I will need to investigate and go through the Homebrew formula instructions and verify things to figure out what goes wrong. That will take much more time. So keep fingers crossed!

@genivia-inc
Copy link
Member

I checked Homebrew ugrep 5.1.3 and it looks like it picked up the proper library dependences again:

$ brew install ugrep
...
==> Downloading https://ghcr.io/v2/homebrew/core/ugrep/manifests/5.1.3
...
$ /opt/homebrew/bin/ugrep --version
ugrep 5.1.3 aarch64-apple-darwin21.6.0 +neon/AArch64; -P:pcre2jit; -z:zlib,bzip2,lzma,lz4,zstd,brotli

@genivia-inc genivia-inc added the problem Something isn't working due to a (minor) problem label Apr 4, 2024
@genivia-inc genivia-inc pinned this issue Apr 4, 2024
@genivia-inc genivia-inc changed the title Ugrep search throw error -z option not able with new 5.1.2 build Ugrep search throws error -z option not available in new Homebrew ugrep v5.1.2 Apr 4, 2024
@ciscohack
Copy link
Author

@genivia-inc you are awesome my friend working fine now thanks

@genivia-inc genivia-inc unpinned this issue Apr 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
problem Something isn't working due to a (minor) problem
Projects
None yet
Development

No branches or pull requests

2 participants