Genivia / ugrep

NEW ugrep 6.5: a more powerful, ultra fast, user-friendly, compatible grep. Includes a TUI, Google-like Boolean search with AND/OR/NOT, fuzzy search, hexdumps, searches (nested) archives (zip, 7z, tar, pax, cpio), compressed files (gz, Z, bz2, lzma, xz, lz4, zstd, brotli), pdfs, docs, and more
https://ugrep.com
BSD 3-Clause "New" or "Revised" License
2.56k stars 109 forks source link

Symlink against `ug` does not pick up the configuration file #353

Closed stdedos closed 6 months ago

stdedos commented 6 months ago

I was wondering - do you support the .installs/bin/grep -> /usr/bin/ug scenario to load the configuration file?

I know what it is "coded" the grep argv0 to enable the grep-compatibility mode. I am not sure though, how does auto-config work.

Given that it's a different executable, is it an actual code difference? Or just an argv0 check?

genivia-inc commented 6 months ago

See #315.

Bash doesn't pass symlink ug as argv[0] but passes the target ugrep instead. This happens when ug is installed on a bin path. Perhaps an optimization that bash uses that has this unintended consequence.

Honestly, I was unpleasantly surprised by this bash problem. It doesn't happen when you just create a symlink in your home dir to execute, but it happens when installing the symlink in a bin path dir. I don't see a solution to this, unless bash fixes this problem as a bug (I think it is).