projectile icon indicating copy to clipboard operation
projectile copied to clipboard

grep and ack search options return error for 'more complex' search-term (GNU/linux)

Open dalanicolai opened this issue 5 years ago • 4 comments

On GNU/linux (Fedora 32, ack version 3.3.1), when trying to replace the string xpath=//ul[@id="input-internetpinnen_prefix_subscriptions"]//div[contains(text(), "KLM")][last()] using projectile-replace, the grep and ack options in the projectile-files-with-string function return the following errors.

(The 'ag' option works fine)

Expected behavior

Succesful replacement of text (like when using the ag option in the projectile-files-with-string function)

Actual behavior

The grep function returns the following error:

("/home/dalanicolai/.emacs.d/elpa/26.3/develop/grep: Invalid range end")

The ack function returns the error:

("/home/dalanicolai/.emacs.d/elpa/26.3/develop/ack: Options '--heading' and '-l' can't be used together.")

Steps to reproduce the problem

  • make sure "the silver searcher" is not installed (i.e. there is no executable "ag" in your path)
  • evaluate (projectile-files-with-string "xpath=//ul[@id=\"input-internetpinnen_prefix_subscriptions\"]//div[contains(text(), \"KLM\")][last()]" directory), replacing directory with some valid directory path on your system OR run projectile-replace trying to replace xpath=//ul[@id=\"input-internetpinnen_prefix_subscriptions\"]//div[contains(text(), \"KLM\")][last()]

Environment & Version information

ack version 3.3.1

Projectile version information

Projectile 20200616.1659

Emacs version

26.3

Operating system

GNU/linux (Fedora 32)

dalanicolai avatar Jun 27 '20 16:06 dalanicolai

Ack version 2.2.1 seems to work fine at the moment (current version of ack on Ubuntu 18.04). For ack version 3.3.1 removing the --noheading flag fixes the issue as the -l flag automatically adds/implies the --noheading flag. Because a new LTS release of Ubuntu (20.04) is already available and ships ack version 3.3.1, I guess the --noheading flag can be removed immediately or otherwise very soon

dalanicolai avatar Jun 27 '20 17:06 dalanicolai

make sure "the silver searcher" is not installed (i.e. there is no executable "ag" in your path)

I've been using only ag for years now. :-)

I'll have to check what's up with grep - last time I checked this was working fine, but I was on macOS back then. Now I'm also on Ubuntu 20.04.

guess the --noheading flag can be removed immediately or otherwise very soon

I was under the impression I removed support for ack a while back. Perhaps you're using some extension for this?

bbatsov avatar Aug 01 '20 14:08 bbatsov

I am using ag's "competitor" ripgrep. But that option was not yet implemented, so that I found this issue. Although grep is still the basic linux search utility for many, ag or ripgrep can be quickly installed so that this issue does not appear to be very urgent.

The ack support is right here on line 3595

dalanicolai avatar Aug 02 '20 08:08 dalanicolai

Oh, sorry. I had misread the description. I'll remove the --noheading option for ack.

bbatsov avatar Aug 02 '20 12:08 bbatsov