Carsten Bormann | 6 Aug 2012 17:23
Favicon
Gravatar

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

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.

(Continue reading)

Michael Albinus | 7 Aug 2012 10:51
Picon
Picon
Gravatar

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

Carsten Bormann <cabo <at> tzi.org> writes:

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

Hmm. In `tramp-find-file-exists-command', it is correctly tested for
"test -e", "/bin/test -e" aso. But the cache seems to get the wrong value.

I would need to analyze the cache operations. Would you, please, apply
"M-x tramp-cleanup-all-connections" (this also removes cache settings),
set `tramp-verbose' to 9, and rerun the test? The resulting debug buffer
shall tell us more.

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

Maybe the Tramp info file shall be improved for recipes how to disable
the cache for debugging.

Best regards, Michael.

Carsten Bormann | 7 Aug 2012 18:23
Favicon
Gravatar

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


On Aug 7, 2012, at 10:51, Michael Albinus <michael.albinus <at> gmx.de> wrote:

> Carsten Bormann <cabo <at> tzi.org> writes:
> 
>> 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.
> 
> Hmm. In `tramp-find-file-exists-command', it is correctly tested for
> "test -e", "/bin/test -e" aso. But the cache seems to get the wrong value.
> 
> I would need to analyze the cache operations. Would you, please, apply
> "M-x tramp-cleanup-all-connections" (this also removes cache settings),
> set `tramp-verbose' to 9, and rerun the test? The resulting debug buffer
> shall tell us more.

Interesting.  With tramp-cleanup-all-connections I didn't need the two-step process to trigger the bug.
Again, the problem is that test -e suppresses the rest of the command line in /bin/sh on Solaris, so the first
"test -e" fails right away, but is somehow recovered using another attempt that uses test -d. The attempt
to find-file (open) .bash_history then completely fails on what seems to be the same kind of "test -e"
(hmm, why didn't it do that in my previous tests before I wrote the tramp file).

resulting tramp file as well as debug buffer (slightly sanitized) attached.

(Continue reading)

Michael Albinus | 8 Aug 2012 08:47
Picon
Picon
Gravatar

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

Carsten Bormann <cabo <at> tzi.org> writes:

Hi Carsten,

> Again, the problem is that test -e suppresses the rest of the command
> line in /bin/sh on Solaris, so the first "test -e" fails right away,
> but is somehow recovered using another attempt that uses test -d. The
> attempt to find-file (open) .bash_history then completely fails on
> what seems to be the same kind of "test -e" (hmm, why didn't it do
> that in my previous tests before I wrote the tramp file).

I've hardened the test a little bit. Could you, please, check whether
this works (clean the cache first):

--8<---------------cut here---------------start------------->8---
*** ~/src/tramp/lisp/tramp-sh.el.~2.77~	2012-08-08 08:40:59.692792871 +0200
--- ~/src/tramp/lisp/tramp-sh.el	2012-08-08 08:40:33.696337454 +0200
***************
*** 3559,3584 ****
      ;;                    `/usr/bin/test'.
      ;; `/usr/bin/test -e' In case `/bin/test' does not exist.
      (unless (or
!              (and (setq result (format "%s -e" (tramp-get-test-command vec)))
! 		  (tramp-send-command-and-check
! 		   vec (format "%s %s" result existing))
!                   (not (tramp-send-command-and-check
! 			vec (format "%s %s" result nonexistent))))
!              (and (setq result "/bin/test -e")
! 		  (tramp-send-command-and-check
! 		   vec (format "%s %s" result existing))
(Continue reading)

Carsten Bormann | 8 Aug 2012 09:35
Favicon
Gravatar

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

On Aug 8, 2012, at 08:47, Michael Albinus <michael.albinus <at> gmx.de> wrote:

> I've hardened the test a little bit. Could you, please, check whether
> this works (clean the cache first):

Thanks.

I hope I did this cache-cleaning right by just calling tramp-cleanup-all-connections.

Now, the first find-file (to a directory) leads to an empty buffer (but only in 2 out of 3 attempts?  No idea
what I did different.) or just hangs.
Doing that again (after a quit in case of the hang) appears to work properly, as does editing a file.
When I first tried this, an equivalent to  ("file-exists" "test -e")  was not recorded at all, see below.
On another attempt it does get recorded (see second ~/.emacs.d/tramp below).
In the latter case, we then run into the same problem (byte-code: Couldn't find exit status of `test -e
/users/home/cabo/.bash_history') with the second incarnation of emacs.

I'm afraid this one didn't quite work out.
Also I'd love to know why this appears to be less than deterministic.

Grüße, Carsten

;; -*- emacs-lisp -*- <12/08/08 09:14:43 /Users/cabo/.emacs.d/tramp>
;; Tramp connection history.  Don't change this file.
;; You can delete it, forcing Tramp to reapply the checks.

((["scpc" nil "a" nil nil]
  ("uname" "SunOS 5.11")
  ("test" "test")
  ("remote-path"
(Continue reading)

Michael Albinus | 8 Aug 2012 09:51
Picon
Picon
Gravatar

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

Carsten Bormann <cabo <at> tzi.org> writes:

Hi Carsten,

> I hope I did this cache-cleaning right by just calling tramp-cleanup-all-connections.

It should do the job. However, in order to be on the safe side, please
stop Emacs, remove ~/.emacs.d/tramp, and restart Emacs.

> I'm afraid this one didn't quite work out.
> Also I'd love to know why this appears to be less than deterministic.

Strange. During my local tests of this patch, I did obfuscate the first
check in `tramp-find-file-exists-command', in order to provoke a syntax
error. It works fine here.

Please rerun the test from the beginning. And I need the debug buffer,
also from the beginning of the test, with `tramp-verbose' set to 9.

> Grüße, Carsten

Best regards, Michael.

Michael Albinus | 8 Aug 2012 15:45
Picon
Picon
Gravatar

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

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

> Please rerun the test from the beginning. And I need the debug buffer,
> also from the beginning of the test, with `tramp-verbose' set to 9.

A modified version of the published patch solves the problem, as
confirmed by Carsten off-list. Patch committed, closing the bug.

Best regards, Michael.


Gmane