Subject: bug#12148: 24.1.50; Tramp has problems with Solaris server (test -e)

From: Carsten Bormann <[email-masked]>
Date: Mon, 6 Aug 2012 17:23:26 +0200

Please describe exactly what actions triggered the bug, and
the precise symptoms of the bug.  If you can, give a recipe
starting from `emacs -Q':

-- find a file via tramp on a Solaris 5.11 server (e.g., .bash_history)
-- exit emacs, so that a .emacs.d/tramp is written
-- find the file again

-> Error Couldn't find exit status of `test -e /users/home/cabo/.bash_history'

Solaris /bin/sh does not support test -e.
Worse, there is strange behavior when you use it:

bash$ /bin/sh
$ test -e foo ; echo $?
test: argument expected
$

So anything after the failing test does not get executed, which appears to destroy tramp's
exit status management.

This appears to get circumvented correctly once, but the .emacs.d/tramp
written out from the first emacs says:

  ("file-exists" "test -e")

which is clearly wrong.
So the next incarnation of emacs will no longer work correcly with that
Solaris server.

Workaround: kill emacs, edit ~/.emacs.d/tramp to say

  ("file-exists" "/bin/test -e")

and restart emacs.
(Because of the caching in .emacs.d/tramp and the behavior of writing out the tramp file during kill-emacs, this can be very confusing to debug.  It took me a while to understand that the "works/doesn't work/works/doesn't work" behavior can only be explained by to the tramp file written out with bad information.)

In GNU Emacs 24.1.50.1 (x86_64-apple-darwin, NS apple-appkit-1038.36)
 of 2012-08-04 on bob.porkrind.org
Bzr revision: 109423 [email-masked]
Windowing system distributor `Apple', version 10.3.1187
Configured using:
 `configure '--host=x86_64-apple-darwin' '--build=i686-apple-darwin'
 '--with-ns' 'build_alias=i686-apple-darwin'
 'host_alias=x86_64-apple-darwin' 'CC=gcc -mmacosx-version-min=10.5''

Important settings:
  value of $LC_CTYPE: UTF-8
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Dired by name

Minor modes in effect:
  shell-dirtrack-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
C-x C-f / a : <return> <return> <help-echo> <menu-bar> 
<help-menu> <send-emacs-bug-report>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Tramp: Opening connection for a using scpc...
Tramp: Sending command `exec ssh   -o ControlPath=/var/folders/hy/4kd7dc593jn5wbqln6_hj_940000gn/T/tramp.28882-39.%r@%h:%p -o ControlMaster=yes -e none a'

Tramp: Waiting for prompts from remote shell
Tramp: Sending command `exec ssh   -o ControlPath=/var/folders/hy/4kd7dc593jn5wbqln6_hj_940000gn/T/tramp.28882-39.%r@%h:%p -o ControlMaster=yes -e none a'
Tramp: Found remote shell prompt on `a'
Tramp: Opening connection for a using scpc...done
ls does not support --dired; see `dired-use-ls-dired' for more details.
byte-code: Couldn't find exit status of `test -e /users/home/cabo/.bash_history'

Load-path shadows:
None found.

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 sendmail rfc2047 rfc2045 ietf-drums mail-utils dired
tramp-cache tramp-sh tramp tramp-compat auth-source eieio byte-opt
bytecomp byte-compile cconv macroexp gnus-util mm-util mail-prsvr
password-cache tramp-loaddefs shell pcomplete comint ansi-color ring
format-spec advice help-fns advice-preload time-date tooltip ediff-hook
vc-hooks lisp-float-type mwheel ns-win tool-bar dnd fontset image
regexp-opt fringe tabulated-list newcomment lisp-mode register page
menu-bar rfn-eshadow timer select scroll-bar 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 files text-properties overlay sha1 md5 base64
format env code-pages mule custom widget hashtable-print-readable
backquote make-network-process ns multi-tty emacs)