all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: npostavs@users.sourceforge.net
To: Yegor Timoshenko <yegortimoshenko@gmail.com>
Cc: 27169@debbugs.gnu.org
Subject: bug#27169: eshell/sudo doesn't work with protected directories
Date: Wed, 07 Jun 2017 20:20:47 -0400	[thread overview]
Message-ID: <878tl3xrc0.fsf@users.sourceforge.net> (raw)
In-Reply-To: <92D4739F-7FCF-4658-B0C0-D20CEB863150@gmail.com> (Yegor Timoshenko's message of "Wed, 7 Jun 2017 21:43:18 +0300")

[-- Attachment #1: Type: text/plain, Size: 476 bytes --]

tags 27169 = patch
quit

Yegor Timoshenko <yegortimoshenko@gmail.com> writes:

> GNU Emacs 25.2.1 (x86_64-apple-darwin13.4.0, NS appkit-1265.21 Version 10.9.5 (Build 13F1911)) of 2017-04-21
>
> Yes, it's reproducible with -Q flag, provided that you execute (require 'em-tramp) in *scratch* buffer.

Hmm, for some reason that doesn't work for me (possibly another bug),
but if I use 'eshell/sudo' instead of plain 'sudo' I can reproduce your problem.

The following fixes it:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 1459 bytes --]

From e3d96af45b85a9ed9b96a12cae3e68eb21a2de47 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Wed, 7 Jun 2017 18:48:39 -0400
Subject: [PATCH v1] Let eshell/sudo handle absolute command names (Bug#27167)

* lisp/eshell/esh-ext.el (eshell-find-interpreter): Don't change
absolute paths into relative ones.
---
 lisp/eshell/esh-ext.el | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/lisp/eshell/esh-ext.el b/lisp/eshell/esh-ext.el
index fb1fedc9c5..2a495225dc 100644
--- a/lisp/eshell/esh-ext.el
+++ b/lisp/eshell/esh-ext.el
@@ -299,11 +299,13 @@ (defun eshell-find-interpreter (file args &optional no-examine-p)
       (let ((fullname (if (file-name-directory file) file
 			(eshell-search-path file)))
 	    (suffixes eshell-binary-suffixes))
-	(if (and fullname
-		 (not (file-remote-p fullname))
-		 (file-remote-p default-directory))
-	    (setq fullname (expand-file-name
-			    (concat "./" fullname) default-directory)))
+	(when (and fullname
+                   (not (file-remote-p fullname))
+                   (file-remote-p default-directory))
+          (setq fullname
+                (if (file-name-absolute-p fullname)
+                    (concat (file-remote-p default-directory) fullname)
+                  (expand-file-name fullname default-directory))))
 	(if (and fullname (not (or eshell-force-execution
 				   (file-executable-p fullname))))
 	    (while suffixes
-- 
2.11.1


  reply	other threads:[~2017-06-08  0:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-31 16:47 bug#27169: eshell/sudo doesn't work with protected directories Yegor Timoshenko
2017-06-07 12:59 ` npostavs
     [not found]   ` <9B3DCDF4-DA3C-40CB-B5E6-61FD2BB6DEC8@gmail.com>
2017-06-07 18:43     ` Yegor Timoshenko
2017-06-08  0:20       ` npostavs [this message]
2017-06-08  0:50       ` npostavs
2017-06-08 22:21         ` Yegor Timoshenko
2017-06-09  0:49           ` npostavs
2020-09-04  6:04             ` bug#27168: " Lars Ingebrigtsen
2020-10-07  3:29               ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878tl3xrc0.fsf@users.sourceforge.net \
    --to=npostavs@users.sourceforge.net \
    --cc=27169@debbugs.gnu.org \
    --cc=yegortimoshenko@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.