Archive for May, 2019

org2blog git page modified

2019-05-26

By the the power of github, I amended the org2blog usage to include the magical key sequence C-c M-p d to publish your emacs buffer to your blog. Was glad to see that githup has org-mode as an editing mode. Though I see it didn’t understand underscore. [Hmm, seems underscore is not liked here either!]

I’m trying to get myself back into blogging if you hadn’t guessed.

Emacs Tramp failing to load files from Solaris

2019-05-25


While using Emacs (Emacs-app from MacPorts) on macOS to edit files on Solaris system via Tramp I’ve been finding it was unable to edit from some hosts. To open a file using tramp the filename is entered as /protocol:[user@]hostname[#port]:pathname. For example, /scp:solaris:.profile. Tramp does not simply scp the file over. It connects to the remote system using ssh and carries out a number of tests. Emacs hung at this point when access Solaris 11.4 hosts, interuptable with Control-G. This was from MacOS version 10.13/10.14.

Setting Tramp verbosity to 10 (setq tramp-verbose 10) it appeared that Tramp was waiting for output from the remote host.

On the Solaris host I was using truss to watch the exec calls made by the bash shell that was started by tramp. The output of which suggested it had not received the command sent by tramp.

Aware that Solaris 11.4 uses OpenSSH rather than SunSSH I wondered if it was perhaps related to that. I spoke to my colleague Darren Moffat, who reminded me that OpenSSH has multiplexing; which Tramp can use. A quick test to 11.3sru35 with ssh still set to the default SunSSH version, showed the fault still occurred. By process of elimination I found the fault came about in Solaris 11.3sru17, where bash was updated from 4.1.17 to 4.4.11…

I tried switching shells:

(add-to-list 'tramp-connection-properties
             (list ".*" "remote-shell" "/usr/bin/ksh"))

but that I had no effect, it still hung.

Edit: 2020-04-23 Today I found that I do need to specify use of ksh as /bin/sh would exit following SIGSEGV while sending shell function tramp_perl_file_attributes().  Subject for another post.

Darren did suggest trussing the sshd process rather than the shell, with privileges elevated truss of the sshd process showed the tramp command had been received and sent to the shell process….

At this point I was about to expand the truss to show more information other that read,write and exec calls, when I noticed the locale. On the Mac LANG and LC_CTYPE is set to en_GB.UTF-8. Tramp was setting LC_CTYPE on the remote host too, not via ssh – it actually set it as part of the initialization. As I had noticed issues while ssh’ed in, I set the locale:

(add-to-list 'tramp-connection-properties
             (list ".*" "locale" "LC_ALL=C"))

Cleaned up all open connections (tramp-cleanup-all-connections) and hey-presto I’m back in operation.

Somewhat annoyingly this is mentioned on Emacs Wiki, I shall go and add my workaround.

Now obviously it shouldn’t matter what the locale is, it should have worked, but that is for another day.

Emacs 26.2 Tramp 2.3.5.26.2 Solaris 11.3sru17