unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#23914: 24.5; tramp-get-remote-path fails with some shells if tramp-own-remote-path is used
@ 2016-07-08  8:57 Joel Ray Holveck
  2016-07-09 11:38 ` Michael Albinus
  0 siblings, 1 reply; 6+ messages in thread
From: Joel Ray Holveck @ 2016-07-08  8:57 UTC (permalink / raw)
  To: 23914




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





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#23914: 24.5; tramp-get-remote-path fails with some shells if tramp-own-remote-path is used
  2016-07-08  8:57 bug#23914: 24.5; tramp-get-remote-path fails with some shells if tramp-own-remote-path is used Joel Ray Holveck
@ 2016-07-09 11:38 ` Michael Albinus
  2016-07-09 12:23   ` Andreas Schwab
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Albinus @ 2016-07-09 11:38 UTC (permalink / raw)
  To: Joel Ray Holveck; +Cc: 23914

Joel Ray Holveck <joelh@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.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#23914: 24.5; tramp-get-remote-path fails with some shells if tramp-own-remote-path is used
  2016-07-09 11:38 ` Michael Albinus
@ 2016-07-09 12:23   ` Andreas Schwab
  2016-07-10 15:07     ` Michael Albinus
  0 siblings, 1 reply; 6+ messages in thread
From: Andreas Schwab @ 2016-07-09 12:23 UTC (permalink / raw)
  To: Michael Albinus; +Cc: Joel Ray Holveck, 23914

Michael Albinus <michael.albinus@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@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#23914: 24.5; tramp-get-remote-path fails with some shells if tramp-own-remote-path is used
  2016-07-09 12:23   ` Andreas Schwab
@ 2016-07-10 15:07     ` Michael Albinus
  2016-08-20 10:05       ` Michael Albinus
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Albinus @ 2016-07-10 15:07 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Joel Ray Holveck, 23914

Andreas Schwab <schwab@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.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#23914: 24.5; tramp-get-remote-path fails with some shells if tramp-own-remote-path is used
  2016-07-10 15:07     ` Michael Albinus
@ 2016-08-20 10:05       ` Michael Albinus
  2016-08-28  8:20         ` Michael Albinus
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Albinus @ 2016-08-20 10:05 UTC (permalink / raw)
  To: 23914, Joel Ray Holveck

Michael Albinus <michael.albinus@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.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#23914: 24.5; tramp-get-remote-path fails with some shells if tramp-own-remote-path is used
  2016-08-20 10:05       ` Michael Albinus
@ 2016-08-28  8:20         ` Michael Albinus
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Albinus @ 2016-08-28  8:20 UTC (permalink / raw)
  To: 23914-done; +Cc: Joel Ray Holveck

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.





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-08-28  8:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-08  8:57 bug#23914: 24.5; tramp-get-remote-path fails with some shells if tramp-own-remote-path is used Joel Ray Holveck
2016-07-09 11:38 ` Michael Albinus
2016-07-09 12:23   ` Andreas Schwab
2016-07-10 15:07     ` Michael Albinus
2016-08-20 10:05       ` Michael Albinus
2016-08-28  8:20         ` Michael Albinus

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).