From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: npostavs@users.sourceforge.net Newsgroups: gmane.emacs.bugs Subject: bug#27169: eshell/sudo doesn't work with protected directories Date: Wed, 07 Jun 2017 20:20:47 -0400 Message-ID: <878tl3xrc0.fsf@users.sourceforge.net> References: <87bmq0x8bm.fsf@users.sourceforge.net> <9B3DCDF4-DA3C-40CB-B5E6-61FD2BB6DEC8@gmail.com> <92D4739F-7FCF-4658-B0C0-D20CEB863150@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1496881216 5503 195.159.176.226 (8 Jun 2017 00:20:16 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 8 Jun 2017 00:20:16 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux) Cc: 27169@debbugs.gnu.org To: Yegor Timoshenko Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jun 08 02:20:10 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dIlBI-00015R-QF for geb-bug-gnu-emacs@m.gmane.org; Thu, 08 Jun 2017 02:20:09 +0200 Original-Received: from localhost ([::1]:46613 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIlBN-0003T9-Qo for geb-bug-gnu-emacs@m.gmane.org; Wed, 07 Jun 2017 20:20:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51415) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIlBF-0003Qj-9p for bug-gnu-emacs@gnu.org; Wed, 07 Jun 2017 20:20:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dIlBC-0006r0-1y for bug-gnu-emacs@gnu.org; Wed, 07 Jun 2017 20:20:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:59360) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dIlBB-0006qu-U3 for bug-gnu-emacs@gnu.org; Wed, 07 Jun 2017 20:20:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dIlBB-0007U4-LR for bug-gnu-emacs@gnu.org; Wed, 07 Jun 2017 20:20:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 08 Jun 2017 00:20:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27169 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: unreproducible Original-Received: via spool by 27169-submit@debbugs.gnu.org id=B27169.149688117428732 (code B ref 27169); Thu, 08 Jun 2017 00:20:01 +0000 Original-Received: (at 27169) by debbugs.gnu.org; 8 Jun 2017 00:19:34 +0000 Original-Received: from localhost ([127.0.0.1]:33804 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dIlAk-0007TH-Bo for submit@debbugs.gnu.org; Wed, 07 Jun 2017 20:19:34 -0400 Original-Received: from mail-it0-f41.google.com ([209.85.214.41]:37342) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dIlAi-0007Sx-D6; Wed, 07 Jun 2017 20:19:32 -0400 Original-Received: by mail-it0-f41.google.com with SMTP id m47so13504054iti.0; Wed, 07 Jun 2017 17:19:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=fwwrptbHSH+DZn6XGXFURUtTTzZY6xeEtpSuvEjwYp4=; b=DWPB90bGL2us7K/qUnMy1/V59nMZDMJb2jLun7NP1rOR61O9Lcfq4WTa0+yPLRECsm FsRln7KZlUHmyjRKv/Ts/P+WnjzDureLIXzjgS4UypYHsqe41T+m4eqiffxmdsYzOdqv M1+xrESnipHAAuNZ9XIHNc5VUgz9779r19rC+Rkp4E+bWLqzTa7vfhYBshkcHT5eJ9IO QtejzY2gRc2OsxkKKYa2B1dXaDl+x3I8MB56yzFtM9Twc525HuF1S4TWGkOEdwkckDe5 ZtixbKLIsmnU68zvg+v7oVAH+3UfvM0JO56ahTRlgSO3M2k8Vo2inmZRaaFmJw48HQFa 3Caw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=fwwrptbHSH+DZn6XGXFURUtTTzZY6xeEtpSuvEjwYp4=; b=PewoFEenVch6s8lxIiGjcTqb1TMHR7b+PbsBEH5PunQ+/mVxrG4y2v/x9RncqPj8gL 70AB1bZ15WF5OKLSB3lKjx6Zj1IH0SwS5y2kBbR7S1jS8eoM59qyy74mYJ0nQdZJdRc6 PQwMr0cELvCo8gtW61ENLLbQEZbO3bi/B0IDr2dTeJapeexPKR0Hi0kMK5YonQ/1aIlJ PinWPr37Wsfhtk5jNwq+H12QiyyrdnoJ5k8TqRUzTtee38XvqlBWD3DHCV54ciijOesl QthFQssXXV/0JAKdwUiU82GYi5vZJfOzG6rAfkZclUuvWNLUWpb/p8J+1o+BdFMK56to hUvA== X-Gm-Message-State: AODbwcCHnt6E8PN+/EiXg+iLJ/LrNWDSlL3vvRStvWFLsxSKpV5vd/cL kCk+8nWnxlskaEjE X-Received: by 10.36.193.66 with SMTP id e63mr2947507itg.86.1496881166750; Wed, 07 Jun 2017 17:19:26 -0700 (PDT) Original-Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id 76sm1723731itx.7.2017.06.07.17.19.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 07 Jun 2017 17:19:25 -0700 (PDT) In-Reply-To: <92D4739F-7FCF-4658-B0C0-D20CEB863150@gmail.com> (Yegor Timoshenko's message of "Wed, 7 Jun 2017 21:43:18 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:133388 Archived-At: --=-=-= Content-Type: text/plain tags 27169 = patch quit Yegor Timoshenko 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: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=v1-0001-Let-eshell-sudo-handle-absolute-command-names-Bug.patch Content-Description: patch >From e3d96af45b85a9ed9b96a12cae3e68eb21a2de47 Mon Sep 17 00:00:00 2001 From: Noam Postavsky 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 --=-=-=--