From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: John Mastro Newsgroups: gmane.emacs.bugs Subject: bug#23590: 25.0.94; Errors in default lgrep command Date: Fri, 22 Jul 2016 19:16:27 -0700 Message-ID: References: <87futcp8wp.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1469240243 7160 80.91.229.3 (23 Jul 2016 02:17:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 23 Jul 2016 02:17:23 +0000 (UTC) Cc: Alex To: 23590@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jul 23 04:17:14 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bQmV7-0006uv-Fd for geb-bug-gnu-emacs@m.gmane.org; Sat, 23 Jul 2016 04:17:13 +0200 Original-Received: from localhost ([::1]:50046 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQmV6-0008Ia-Ay for geb-bug-gnu-emacs@m.gmane.org; Fri, 22 Jul 2016 22:17:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35738) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQmV0-0008IJ-GB for bug-gnu-emacs@gnu.org; Fri, 22 Jul 2016 22:17:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bQmUw-0006UY-8h for bug-gnu-emacs@gnu.org; Fri, 22 Jul 2016 22:17:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:50009) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQmUw-0006UU-5R for bug-gnu-emacs@gnu.org; Fri, 22 Jul 2016 22:17:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bQmUv-0006xR-Ut for bug-gnu-emacs@gnu.org; Fri, 22 Jul 2016 22:17:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: John Mastro Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 23 Jul 2016 02:17:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23590 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 23590-submit@debbugs.gnu.org id=B23590.146924021626729 (code B ref 23590); Sat, 23 Jul 2016 02:17:01 +0000 Original-Received: (at 23590) by debbugs.gnu.org; 23 Jul 2016 02:16:56 +0000 Original-Received: from localhost ([127.0.0.1]:34113 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bQmUq-0006x3-9u for submit@debbugs.gnu.org; Fri, 22 Jul 2016 22:16:56 -0400 Original-Received: from mail-qk0-f178.google.com ([209.85.220.178]:34198) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bQmUm-0006wo-SK for 23590@debbugs.gnu.org; Fri, 22 Jul 2016 22:16:54 -0400 Original-Received: by mail-qk0-f178.google.com with SMTP id o67so116318782qke.1 for <23590@debbugs.gnu.org>; Fri, 22 Jul 2016 19:16:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=0utgQhM84b3a+zOeeQ+o8+qE6zvzicDC+y8e9blplMI=; b=vKZPx/T/XtgV/59n75L65mJpy1CQKIUbzNHNJGBH2uDyH6Kju6myh24krGk0nioUjs w5QWR4/8zB4sBzeSrFq7UE9YFOUdodi5zdv//k6w2QgpgCS8rq9ZoENAvXwSLzCEfvMb nIhxj2d1Gc0ptTT45r1xxrY7pq0xkHnsqVs3s2nUu00/hK8gxbl+bc3jUnN19P/6nT1U DuLpQfVsEiQCR+uERCcrHoCKJpLrIRLmLGIQFJMAJ2KxkPUDzA0g/cEEZg/CJ4T75h89 6cr0Q5fnCqbdQtxmTAqmCh0oqowSGWU02d9vWToY8hDryoHgTADTEXW47+EnoH4uIDQQ WklA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=0utgQhM84b3a+zOeeQ+o8+qE6zvzicDC+y8e9blplMI=; b=gLhqTfZFwW1JNXJBH3UlnWC5u8fAC13cx7l01ahNM6kNcDoNMdnobqTkIgNHPIPfGN i7EouSFIgJHwx7ZEvo/u1iQu/DAueCNDT/RV8Vho5dpBRDvN/PW5vurBJcsaqKta6tJa YGFGEeh2NgA/5S6aT0/Ll1SXoJs/050OJgqPAQVDI6fFZXRCZv5UXujKEkJpUFNHKobc jdMAgbkn36rrjMnJAadF2PsEda8vSMFDrACTNU/eEEXbwFyPeuf5bSJZh72j7bYqqxCd rK3Ok9Yu2jXxBxIexfoNsRURPBM+uR2g9XiHFjiCpaxUmQhvr5N/UV5MLHz2f2dZVQPX 6JuA== X-Gm-Message-State: AEkoouul6pykQEF7KHEarH4X6NBB86GUk4zj/Y76xnHLZxk6AuAvbtLmkNYmQ/E4HPEscYUfj2w8u/V8g3x1EQ== X-Received: by 10.55.108.2 with SMTP id h2mr8408792qkc.202.1469240207318; Fri, 22 Jul 2016 19:16:47 -0700 (PDT) Original-Received: by 10.237.33.46 with HTTP; Fri, 22 Jul 2016 19:16:27 -0700 (PDT) In-Reply-To: <87futcp8wp.fsf@gmail.com> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:121435 Archived-At: Alex wrote: > The default lgrep command (`all' for the FILES argument) gives > off unexpected errors. > > * When there are no hidden (dot) files in the given directory, then I > get the following error: > > zsh:1: no matches found: *. > Grep exited abnormally with code 1 at ... > > By default lgrep uses my default shell (zsh). Should this be the case? > Setting `shell-file-name' to "bash" fixes this error, but it still > produces the next error. Thanks for reporting this. I've seen it too. The problem seems to be caused by a difference in how zsh handles globs that don't match anything, compared to bash. I'm not sure what the right way would be to accommodate it in Emacs. Hopefully someone will be along shortly with ideas for that. However, there are a couple things you can do to work around it in the meantime. First, you could change the command used by `lgrep' to enable zsh's NULL_GLOB option, of which the zsh documentation[1] says: "If a pattern for filename generation has no matches, delete the pattern from the argument list instead of reporting an error". To do that, you could use something like: (with-eval-after-load 'grep (grep-apply-setting 'grep-template "setopt null_glob; grep -n -e ")) Second, you could use advice on `lgrep' so that it invokes grep via bash rather than zsh. That would look like: (defun grep-use-bash (original &rest args) (let ((shell-file-name (executable-find "bash"))) (apply original args))) (with-eval-after-load 'grep (advice-add 'lgrep :around #'grep-use-bash)) I tested both options only briefly; apologies if I missed any issues. > * When there are directories in the given directory (this includes . and > ..) then lgrep produces an error for each directory. For example: > > > grep: .: Is a directory > grep: ..: Is a directory > grep: .emacs.d: Is a directory > > Grep exited abnormally with code 2 at ... GNU Grep has an option (-d ACTION or --directories=ACTION) that can be used to skip over directories (with "skip" as the ACTION), but it's not in POSIX so I doubt we can use it in Emacs. If you know it will be available on your system(s), you could add it to your `grep-template' using the same technique as above. [1] http://www.cs.elte.hu/zsh-manual/zsh_16.html John