unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#18805: 24.3; tramp adds /dev/null, breaks M-x grep
@ 2014-10-23  7:43 Trent W. Buck
       [not found] ` <handler.18805.B.14140502429734.ack@debbugs.gnu.org>
  2014-11-09 10:58 ` Michael Albinus
  0 siblings, 2 replies; 4+ messages in thread
From: Trent W. Buck @ 2014-10-23  7:43 UTC (permalink / raw)
  To: 18805

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)





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#18805: 24.3; tramp adds /dev/null, breaks M-x grep
       [not found] ` <handler.18805.B.14140502429734.ack@debbugs.gnu.org>
@ 2014-10-23  8:05   ` Trent W. Buck
  0 siblings, 0 replies; 4+ messages in thread
From: Trent W. Buck @ 2014-10-23  8:05 UTC (permalink / raw)
  To: 18805

[-- Attachment #1: Type: text/plain, Size: 399 bytes --]

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.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#18805: 24.3; tramp adds /dev/null, breaks M-x grep
  2014-10-23  7:43 bug#18805: 24.3; tramp adds /dev/null, breaks M-x grep Trent W. Buck
       [not found] ` <handler.18805.B.14140502429734.ack@debbugs.gnu.org>
@ 2014-11-09 10:58 ` Michael Albinus
  2014-11-09 11:36   ` Michael Albinus
  1 sibling, 1 reply; 4+ messages in thread
From: Michael Albinus @ 2014-11-09 10:58 UTC (permalink / raw)
  To: Trent W. Buck; +Cc: 18805

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





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#18805: 24.3; tramp adds /dev/null, breaks M-x grep
  2014-11-09 10:58 ` Michael Albinus
@ 2014-11-09 11:36   ` Michael Albinus
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Albinus @ 2014-11-09 11:36 UTC (permalink / raw)
  To: Trent W. Buck; +Cc: 18805

Michael Albinus <michael.albinus@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.





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-11-09 11:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-23  7:43 bug#18805: 24.3; tramp adds /dev/null, breaks M-x grep Trent W. Buck
     [not found] ` <handler.18805.B.14140502429734.ack@debbugs.gnu.org>
2014-10-23  8:05   ` Trent W. Buck
2014-11-09 10:58 ` Michael Albinus
2014-11-09 11:36   ` Michael Albinus

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).