Subject: 24.5; tramp-get-remote-path fails with some shells if tramp-own-remote-path is used
From: Joel Ray Holveck <[email-masked]>
To: [email-masked]
Date: Fri, 08 Jul 2016 01:57:28 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

On FreeBSD, if tramp-own-remote-path is a member of, then using tramp's
sudo method raises an error similar to:

    byte-code: `/bin/sh -l -c 'echo 9905dea968fdd4a549d307a722e8109b \"$PATH\"'' returns with error

On FreeBSD, /bin/sh does not accept the -l flag.  bash, dash, and ksh
do, but that's not part of the POSIX shell requirements (see 
http://pubs.opengroup.org/onlinepubs/009695399/utilities/sh.html), and
historically the Bourne shell doesn't.

This can be traced to tramp-get-remote-path, where it sends the command
"%s -l %s 'echo %s \\\"$PATH\\\"'", where the first %s is the shell.

I typically remove the -l flag in that function to make my Emacs work.

Again, this only applies if tramp-own-remote-path is a member of
tramp-remote-path; otherwise, that part of the code isn't invoked.  It's
not there by default, but it's very useful.

In GNU Emacs 24.5.1 (i386-portbld-freebsd10.3, X toolkit, Xaw scroll bars)
 of 2016-06-01 on thor.piquan.org
Configured using:
 `configure --localstatedir=/var --with-dbus --without-file-notification
 --with-gconf --with-gif --with-gnutls --with-gsettings --with-jpeg
 --with-m17n-flt --with-imagemagick --with-libotf --with-png
 --with-toolkit-scroll-bars --with-rsvg --with-tiff --with-x --with-xft
 --with-xim --with-xml2 --with-xpm --with-x-toolkit=athena
 --without-xaw3d --with-sound=oss --x-libraries=/usr/local/lib
 --x-includes=/usr/local/include --prefix=/usr/local
 --mandir=/usr/local/man --infodir=/usr/local/share/emacs/info/
 --build=i386-portbld-freebsd10.3 'CFLAGS=-O2 -pipe -O2
 -fno-strict-aliasing -pipe -march=athlon64 -isystem /usr/local/include
 -fstack-protector' 'CPPFLAGS=-isystem /usr/local/include' 'LDFLAGS=
 -ltinfo -L/usr/local/lib -Wl,-rpath=/usr/local/lib -fstack-protector''

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Emacs-Lisp

Minor modes in effect:
  diff-auto-refine-mode: t
  eldoc-mode: t
  minibuffer-electric-default-mode: t
  mail-abbrevs-mode: t
  iswitchb-mode: t
  desktop-save-mode: t
  savehist-mode: t
  which-function-mode: t
  auto-insert-mode: t
  show-paren-mode: t
  display-time-mode: t
  recentf-mode: t
  msb-mode: t
  shell-dirtrack-mode: t
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-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
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
x is undefined
i is undefined
t is undefined
s is undefined
Quit
Back to top level.
Mark saved where search started
Mark set
Mark saved where search started [2 times]
Abbrev mode enabled

Load-path shadows:
/usr/local/share/emacs/24.5/site-lisp/site-start hides /usr/local/share/emacs/site-lisp/site-start
~/src/elisp/dict hides /usr/local/share/emacs/site-lisp/dict
/usr/local/share/emacs/24.5/site-lisp/flim/md4 hides /usr/local/share/emacs/24.5/lisp/md4
/usr/local/share/emacs/24.5/site-lisp/flim/hex-util hides /usr/local/share/emacs/24.5/lisp/hex-util
/usr/local/share/emacs/24.5/site-lisp/flim/sasl hides /usr/local/share/emacs/24.5/lisp/net/sasl
/usr/local/share/emacs/24.5/site-lisp/flim/sasl-ntlm hides /usr/local/share/emacs/24.5/lisp/net/sasl-ntlm
/usr/local/share/emacs/24.5/site-lisp/flim/sasl-digest hides /usr/local/share/emacs/24.5/lisp/net/sasl-digest
/usr/local/share/emacs/24.5/site-lisp/flim/sasl-cram hides /usr/local/share/emacs/24.5/lisp/net/sasl-cram
/usr/local/share/emacs/24.5/site-lisp/flim/ntlm hides /usr/local/share/emacs/24.5/lisp/net/ntlm
/usr/local/share/emacs/24.5/site-lisp/flim/hmac-md5 hides /usr/local/share/emacs/24.5/lisp/net/hmac-md5
/usr/local/share/emacs/24.5/site-lisp/flim/hmac-def hides /usr/local/share/emacs/24.5/lisp/net/hmac-def
/usr/local/share/emacs/24.5/site-lisp/semi/smime hides /usr/local/share/emacs/24.5/lisp/gnus/smime
/usr/local/share/emacs/24.5/site-lisp/semi/pgg hides /usr/local/share/emacs/24.5/lisp/obsolete/pgg
/usr/local/share/emacs/24.5/site-lisp/semi/pgg-pgp5 hides /usr/local/share/emacs/24.5/lisp/obsolete/pgg-pgp5
/usr/local/share/emacs/24.5/site-lisp/semi/pgg-pgp hides /usr/local/share/emacs/24.5/lisp/obsolete/pgg-pgp
/usr/local/share/emacs/24.5/site-lisp/semi/pgg-parse hides /usr/local/share/emacs/24.5/lisp/obsolete/pgg-parse
/usr/local/share/emacs/24.5/site-lisp/semi/pgg-gpg hides /usr/local/share/emacs/24.5/lisp/obsolete/pgg-gpg
/usr/local/share/emacs/24.5/site-lisp/semi/pgg-def hides /usr/local/share/emacs/24.5/lisp/obsolete/pgg-def

Features:
(kmacro edebug grep compile ispell cl-indent pp shadow sort mail-extr
warnings emacsbug message idna rfc822 mml mml-sec mm-decode mm-bodies
mm-encode mail-parse rfc2231 gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mail-utils debug eieio-opt speedbar sb-image ezimage
dframe find-func help-mode misearch multi-isearch diff-mode easy-mmode
vc-bzr vc-sccs vc-svn vc-cvs vc-rcs vc vc-dispatcher dired-aux dired-x
dired add-log vc-git tramp-cmds xterm eldoc jka-compr minibuf-eldef
mailabbrev iswitchb icomplete desktop frameset cus-start cus-load
savehist vcursor disp-table derived which-func imenu slime-autoloads
autoinsert cl-macs paren time server cl gv tramp-cache tramp-sh recentf
tree-widget wid-edit msb tramp tramp-compat auth-source eieio byte-opt
bytecomp byte-compile cl-extra cl-loaddefs cl-lib cconv eieio-core
gnus-util mm-util mail-prsvr password-cache tramp-loaddefs trampver
shell pcomplete comint ansi-color ring format-spec advice help-fns
easymenu printing ps-print ps-def lpr midnight time-date tooltip
electric uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment
lisp-mode prog-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 nadvice 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 dynamic-setting system-font-setting font-render-setting
x-toolkit x multi-tty emacs)

Memory information:
((conses 8 229927 39585)
 (symbols 24 29501 23)
 (miscs 20 699 1170)
 (strings 16 46836 4950)
 (string-bytes 1 1343106)
 (vectors 8 19069)
 (vector-slots 4 483571 17204)
 (floats 8 400 479)
 (intervals 28 12307 319)
 (buffers 512 30))

-- 
Joel Ray Holveck - [email-masked]
   Fourth law of programming:
   Anything that can go wrong wi
sendmail: segmentation violation - core dumped