GNU bug report logs - #23914
24.5; tramp-get-remote-path fails with some shells if tramp-own-remote-path is used

Previous Next

Package: emacs;

Reported by: Joel Ray Holveck <joelh <at> piquan.org>

Date: Fri, 8 Jul 2016 08:58:02 UTC

Severity: normal

Found in version 24.5

Fixed in version 26.1

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

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 23914 in the body.
You can then email your comments to 23914 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#23914; Package emacs. (Fri, 08 Jul 2016 08:58:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Joel Ray Holveck <joelh <at> piquan.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 08 Jul 2016 08:58:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Joel Ray Holveck <joelh <at> piquan.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.5;
 tramp-get-remote-path fails with some shells if tramp-own-remote-path
 is used
Date: Fri, 08 Jul 2016 01:57:28 -0700


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 - joelh <at> piquan.org
   Fourth law of programming:
   Anything that can go wrong wi
sendmail: segmentation violation - core dumped




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23914; Package emacs. (Sat, 09 Jul 2016 11:39:02 GMT) Full text and rfc822 format available.

Message #8 received at 23914 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Joel Ray Holveck <joelh <at> piquan.org>
Cc: 23914 <at> debbugs.gnu.org
Subject: Re: bug#23914: 24.5;
 tramp-get-remote-path fails with some shells if tramp-own-remote-path
 is used
Date: Sat, 09 Jul 2016 13:38:28 +0200
Joel Ray Holveck <joelh <at> piquan.org> writes:

Hi Joel,

> 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

Well, meanwhile Tramp doesn't raise an error anymore. It simply ignores
it, what's not a solution, I know.

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

Unfortunately, Posix does not specify how to force a login shell,
evaluating its ~/.profile and friends. If somebody knows a portable way,
how one could determine the $PATH settings of a login shell, I'll add it
to Tramp happily.

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23914; Package emacs. (Sat, 09 Jul 2016 12:24:01 GMT) Full text and rfc822 format available.

Message #11 received at 23914 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: Joel Ray Holveck <joelh <at> piquan.org>, 23914 <at> debbugs.gnu.org
Subject: Re: bug#23914: 24.5;
 tramp-get-remote-path fails with some shells if tramp-own-remote-path
 is used
Date: Sat, 09 Jul 2016 14:23:02 +0200
Michael Albinus <michael.albinus <at> gmx.de> writes:

> Unfortunately, Posix does not specify how to force a login shell,

That's outside the scope of POSIX.

> evaluating its ~/.profile and friends. If somebody knows a portable way,
> how one could determine the $PATH settings of a login shell, I'll add it
> to Tramp happily.

Traditionally, the bourne shell acts as a login shell if argv[0] starts
with '-', and that's how login(1) does it.  Unfortunately, Emacs does
not provide a way to alter the value of argv[0] passed to the inferior.

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23914; Package emacs. (Sun, 10 Jul 2016 15:08:02 GMT) Full text and rfc822 format available.

Message #14 received at 23914 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: Joel Ray Holveck <joelh <at> piquan.org>, 23914 <at> debbugs.gnu.org
Subject: Re: bug#23914: 24.5;
 tramp-get-remote-path fails with some shells if tramp-own-remote-path
 is used
Date: Sun, 10 Jul 2016 17:07:24 +0200
Andreas Schwab <schwab <at> linux-m68k.org> writes:

>> evaluating its ~/.profile and friends. If somebody knows a portable way,
>> how one could determine the $PATH settings of a login shell, I'll add it
>> to Tramp happily.
>
> Traditionally, the bourne shell acts as a login shell if argv[0] starts
> with '-', and that's how login(1) does it.  Unfortunately, Emacs does
> not provide a way to alter the value of argv[0] passed to the inferior.

This wouldn't help. Tramp needs to invoke a login shell on the remote host.

I have added a note to the Tramp manual about this restriction (the
remote shell must support -l in order to use tramp-own-remote-path). I
have no idea what could be done else, so I propose to close this bug.

> Andreas.

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23914; Package emacs. (Sat, 20 Aug 2016 10:06:02 GMT) Full text and rfc822 format available.

Message #17 received at 23914 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: 23914 <at> debbugs.gnu.org,  Joel Ray Holveck <joelh <at> piquan.org>
Subject: Re: bug#23914: 24.5;
 tramp-get-remote-path fails with some shells if tramp-own-remote-path
 is used
Date: Sat, 20 Aug 2016 12:05:06 +0200
Michael Albinus <michael.albinus <at> gmx.de> writes:

> I have added a note to the Tramp manual about this restriction (the
> remote shell must support -l in order to use tramp-own-remote-path). I
> have no idea what could be done else, so I propose to close this bug.

Since commit 5126b7d6c201f95fde0d817a64620d152c1c15e1 in Emacs master,
Tramp supports the usage of the ENV environment variable. This could be
used as alternative in cases the remote shell does not support the "-l"
argument.

The Tramp manual says:

--8<---------------cut here---------------start------------->8---
Setting the ‘ENV’ environment variable instructs some shells to
read an initialization file.  Per default, TRAMP has disabled this.
You could overwrite this behaviour by evaluating

     (let ((process-environment tramp-remote-process-environment))
       (setenv "ENV" "$HOME/.profile")
       (setq tramp-remote-process-environment process-environment))
--8<---------------cut here---------------end--------------->8---

Could you please check whether this works for you, instead of using
`tramp-own-remote-path'?

Best regards, Michael.




Reply sent to Michael Albinus <michael.albinus <at> gmx.de>:
You have taken responsibility. (Sun, 28 Aug 2016 08:21:02 GMT) Full text and rfc822 format available.

Notification sent to Joel Ray Holveck <joelh <at> piquan.org>:
bug acknowledged by developer. (Sun, 28 Aug 2016 08:21:02 GMT) Full text and rfc822 format available.

Message #22 received at 23914-done <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: 23914-done <at> debbugs.gnu.org
Cc: Joel Ray Holveck <joelh <at> piquan.org>
Subject: Re: bug#23914: 24.5;
 tramp-get-remote-path fails with some shells if tramp-own-remote-path
 is used
Date: Sun, 28 Aug 2016 10:20:23 +0200
Version: 25.2

> Could you please check whether this works for you, instead of using
> `tramp-own-remote-path'?

No response, so I'm closing the bug. Feel free to reopen if it doesn't
work for you.

Best regards, Michael.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 25 Sep 2016 11:24:03 GMT) Full text and rfc822 format available.

bug unarchived. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Sun, 04 Dec 2016 02:50:12 GMT) Full text and rfc822 format available.

bug Marked as fixed in versions 26.1. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Sun, 04 Dec 2016 02:50:12 GMT) Full text and rfc822 format available.

bug No longer marked as fixed in versions 25.2. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Sun, 04 Dec 2016 02:50:12 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 01 Jan 2017 12:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 8 years and 222 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.