GNU bug report logs - #18805
24.3; tramp adds /dev/null, breaks M-x grep

Previous Next

Package: emacs;

Reported by: trentbuck <at> gmail.com (Trent W. Buck)

Date: Thu, 23 Oct 2014 07:45:02 UTC

Severity: normal

Tags: notabug

Found in version 24.3

Done: Michael Albinus <michael.albinus <at> gmx.de>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 18805 in the body.
You can then email your comments to 18805 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#18805; Package emacs. (Thu, 23 Oct 2014 07:45:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to trentbuck <at> gmail.com (Trent W. Buck):
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 23 Oct 2014 07:45:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: trentbuck <at> gmail.com (Trent W. Buck)
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3; tramp adds /dev/null, breaks M-x grep
Date: Thu, 23 Oct 2014 18:43:16 +1100
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.

IMO it's daft of tramp to assume appending /dev/null will DTRT,
since that only holds for trivial commands.
If TRAMP is running each command in a sh -c '...' (IIRC it doesn't),
prepending "exec </dev/null; \n" (or <&-) should be more reliable.

I would patch this away in my .emacs,
but I can't understand where tramp is doing this.
I suspect it's this, but that's a wild-ass guess.
    tramp-sh.el.gz:2820: (setq input "/dev/null")


In GNU Emacs 24.3.1 (x86_64-pc-linux-gnu)
 of 2014-06-07 on barber, modified by Debian
System Description:	Debian GNU/Linux testing (jessie)

Configured using:
 `configure '--build' 'x86_64-linux-gnu' '--build' 'x86_64-linux-gnu'
 '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib'
 '--localstatedir=/var/lib' '--infodir=/usr/share/info'
 '--mandir=/usr/share/man' '--with-pop=yes'
 '--enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.3/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.3/site-lisp:/usr/share/emacs/site-lisp'
 '--with-crt-dir=/usr/lib/x86_64-linux-gnu' '--with-x=no'
 '--without-gconf' '--without-gsettings' 'build_alias=x86_64-linux-gnu'
 'CFLAGS=-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat
 -Werror=format-security -Wall' 'LDFLAGS=-Wl,-z,relro'
 'CPPFLAGS=-D_FORTIFY_SOURCE=2''

Important settings:
  value of $LC_COLLATE: C
  value of $LANG: en_AU.utf8
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Fundamental

Minor modes in effect:
  shell-dirtrack-mode: t
  xterm-mouse-mode: t
  ido-everywhere: t
  savehist-mode: t
  icomplete-mode: t
  show-paren-mode: t
  delete-selection-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
ESC x r e p o r t SPC C-g C-x b * s c RET ESC x r e 
p o r t SPC e m a c s SPC b u g RET

Recent messages:
Tramp: Found remote shell prompt on `login'
Tramp: Opening connection for login using scp...done
Tramp: Opening connection for login using scp...
Tramp: Sending command `exec ssh -q   -e none login'

Tramp: Waiting for prompts from remote shell
Tramp: Sending command `exec ssh -q   -e none login'
Tramp: Found remote shell prompt on `login'
Tramp: Opening connection for login using scp...done
Grep finished (matches found)
Quit

Load-path shadows:
/usr/share/emacs/24.3/site-lisp/debian-startup hides /usr/share/emacs/site-lisp/debian-startup
/usr/share/emacs/site-lisp/rst hides /usr/share/emacs/24.3/lisp/textmodes/rst
/usr/share/emacs24/site-lisp/dictionaries-common/ispell hides /usr/share/emacs/24.3/lisp/textmodes/ispell
/usr/share/emacs24/site-lisp/dictionaries-common/flyspell hides /usr/share/emacs/24.3/lisp/textmodes/flyspell

Features:
(shadow sort mail-extr emacsbug message rfc822 mml easymenu mml-sec
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader grep dired tramp-cache tramp-sh tramp tramp-compat
auth-source eieio byte-opt bytecomp byte-compile cconv gnus-util
password-cache tramp-loaddefs shell pcomplete format-spec advice
help-fns cl-lib advice-preload sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils jka-compr edmacro kmacro disp-table
xt-mouse ido savehist icomplete time-date paren delsel saveplace
debian-el debian-el-loaddefs w3m-load pylint compile comint regexp-opt
ansi-color ring tool-bar 50magit emacs-goodies-el emacs-goodies-custom
emacs-goodies-loaddefs easy-mmode dpkg-dev-el dpkg-dev-el-loaddefs
ediff-hook vc-hooks lisp-float-type tabulated-list newcomment lisp-mode
register page menu-bar rfn-eshadow timer select mouse jit-lock font-lock
syntax facemenu font-core frame cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote make-network-process dbusbind multi-tty emacs)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18805; Package emacs. (Thu, 23 Oct 2014 08:07:02 GMT) Full text and rfc822 format available.

Message #8 received at 18805 <at> debbugs.gnu.org (full text, mbox):

From: "Trent W. Buck" <trentbuck <at> gmail.com>
To: 18805 <at> debbugs.gnu.org
Subject: Re: bug#18805: 24.3; tramp adds /dev/null, breaks M-x grep
Date: Thu, 23 Oct 2014 19:05:49 +1100
[Message part 1 (text/plain, inline)]
Straight after I hit submit, spacebat of #emacs pointed out
grep-use-null-device inside grep-host-defaults-alist which is
populated by grep-compute-defaults in grep.el:548.

From my understanding of that code, it's trying
    grep -nH ^English /usr/share/emacs/24.3/etc/HELLO
on the remote host, which fails because emacs is not installed there,
though GNU grep is and grep does support -H.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18805; Package emacs. (Sun, 09 Nov 2014 10:59:02 GMT) Full text and rfc822 format available.

Message #11 received at 18805 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: trentbuck <at> gmail.com (Trent W. Buck)
Cc: 18805 <at> debbugs.gnu.org
Subject: Re: bug#18805: 24.3; tramp adds /dev/null, breaks M-x grep
Date: Sun, 09 Nov 2014 11:58:27 +0100
trentbuck <at> gmail.com (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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18805; Package emacs. (Sun, 09 Nov 2014 11:37:02 GMT) Full text and rfc822 format available.

Message #14 received at 18805 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: trentbuck <at> gmail.com (Trent W. Buck)
Cc: 18805 <at> debbugs.gnu.org
Subject: Re: bug#18805: 24.3; tramp adds /dev/null, breaks M-x grep
Date: Sun, 09 Nov 2014 12:36:29 +0100
Michael Albinus <michael.albinus <at> gmx.de> writes:

>> 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.

PS: If you use

    M-x compile RET git grep -nH foo

there's no problem.

Best regards, Michael.




Added tag(s) notabug. Request was from Michael Albinus <michael.albinus <at> gmx.de> to control <at> debbugs.gnu.org. (Sun, 23 Nov 2014 09:32:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 18805 <at> debbugs.gnu.org and trentbuck <at> gmail.com (Trent W. Buck) Request was from Michael Albinus <michael.albinus <at> gmx.de> to control <at> debbugs.gnu.org. (Sun, 23 Nov 2014 09:32:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 21 Dec 2014 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 241 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.