Subject: bug#18805: 24.3; tramp adds /dev/null, breaks M-x grep

From: Michael Albinus <[email-masked]>
Date: Sun, 09 Nov 2014 11:58:27 +0100

[email-masked] (Trent W. Buck) writes:

> I routinely do M-x grep, but don't always run grep itself.
> For example, I might type in
>     find /usr/share/emacs/24.3/lisp/ -name \*.el.gz -exec zgrep -nH -e /dev/null {} +
> like I did to investigate this issue.
>
> The problem I'm having is when *in tramp* I do
>     M-x grep RET git grep -nH foo
> tramp helpfully appends " /dev/null" to the command, breaking it:
>     fatal: '/dev/null' is outside repository
>
> If I change it to
>     M-x grep RET git grep -nH foo #
> then I get the behaviour I want.
>
> This issue *DOES NOT* occur in local directories, only over tramp.

But this is neither a bug of Tramp nor of the grep command. The error
message "fatal: '/dev/null' is outside repository" comes from git.

As you have said the other message, /dev/null is added due to the
setting of grep-use-null-device. This is computed according to the needs
of grep, and not of git.

So I wouldn't regard this as an error.

Best regards, Michael.