GNU bug report logs - #68074
eshell sudo/doas does not work for aliases

Previous Next

Package: emacs;

Reported by: Alfonso Sanchez-Beato <alfonsosanchezbeato <at> yahoo.es>

Date: Thu, 28 Dec 2023 04:14:02 UTC

Severity: normal

Tags: patch

Done: Jim Porter <jporterbugs <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


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

From: Alfonso Sanchez-Beato <alfonsosanchezbeato <at> yahoo.es>
To: Stefan Kangas <stefankangas <at> gmail.com>, Jim Porter <jporterbugs <at> gmail.com>
Cc: "68074 <at> debbugs.gnu.org" <68074 <at> debbugs.gnu.org>
Subject: Re: bug#68074: eshell sudo/doas does not work for aliases
Date: Fri, 26 Jan 2024 23:53:00 +0000 (UTC)
En jueves, 25 de enero de 2024, 02:43:46 GMT, Jim Porter <jporterbugs <at> gmail.com> escribió: 


On 1/11/2024 1:15 PM, Jim Porter wrote:

>> I've been meaning to look at this in detail, but haven't had time. My 
>> gut feeling though is that we shouldn't have a special case in this code 
>> for when the alias starts with "cd". I'll have to do some testing with 
>> aliases and sudo in order to have a more-helpful answer though.
>> 
>> At a guess, I think a better place to add code for this is likely in 
>> em-tramp.el.


> After letting this percolate in my brain for a few weeks, the answer 
> revealed itself to me: the functions in "em-tramp.el" shouldn't throw 
> 'eshell-external', they should throw 'eshell-replace-command'. That 
> allows for a two-step command replacement in this case. First, 
> 'eshell/sudo' (or 'eshell/doas') will do its replacement. Then, Eshell 
> will evaluate that and call the inner command, which will do another 
> replacement to expand the alias.

> Alfonso, does the attached patch work for you? If so, I'll merge it to 
> master.

Unfortunately that does not seem to be the case, I see an error saying "Invalid function" after applying on top of current master:

$ which cp
cp is an alias, defined as "*cp $*"
$ touch foo
$ eshell/sudo cp foo /
Invalid function: "foo"
[1] $




This bug report was last modified 1 year and 115 days ago.

Previous Next


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