Subject: bug#5072: 23.1.50; Eshell fail with sudo command

From: Michael Albinus <[email-masked]>
Date: Mon, 30 Nov 2009 06:28:53 +0100

Stefan Monnier <[email-masked]> writes:

>> I've added recently an eshell implementation for su and sudo, using
>> Tramp. This requires to run bash, indeed.
>
> What is the advantage?

Imagine, you are on a remote machine, and you want to call a Lisp
function, accessing a file with root permissions. In eshell, you do:

     ~ $ cd /ssh:user@remotehost:/etc
     /ssh:user@remotehost:/etc $ sudo find-file shadow

>> In order to keep your original behaviour, you shall call
>> ,----
>> | *sudo emerge -av somepackage
>> `----
>
> Couldn't your code fail more gracefully and transparently fallback on
> running the bare `sudo'?

That is the eshell built-in approach to suppress command emulation. You
can also apply it to "ls" or "du" or whatever command available in
eshell implementation(1). I wouldn't change it; eshell users know this
approach, likely (2).

Maybe more useful would be to improve Tramp, calling a command via
start-file-process directly (without opening a shell first). This is
already on my todo list, but it isn't simple; it needs basic changes.

At least I will move the eshell related information in etc/NEWS to the
"user visible changes" section.

(1): Check for "eshell/*" Lisp functions.

(2): eshell documentation is very poor. Even this is not documented; I
will improve it next days.

>         Stefan

Best regards, Michael.