GNU bug report logs - #28320
25.2; Eshell/TRAMP's sudo does not work with aliases

Previous Next

Package: emacs;

Reported by: Pierre Neidhardt <ambrevar <at> gmail.com>

Date: Fri, 1 Sep 2017 17:09:01 UTC

Severity: minor

Tags: moreinfo

Found in version 25.2

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 28320 in the body.
You can then email your comments to 28320 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#28320; Package emacs. (Fri, 01 Sep 2017 17:09:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Pierre Neidhardt <ambrevar <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 01 Sep 2017 17:09:01 GMT) Full text and rfc822 format available.

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

From: Pierre Neidhardt <ambrevar <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.2; Eshell/TRAMP's sudo does not work with aliases
Date: Fri, 01 Sep 2017 18:06:06 +0100
Using TRAMP's sudo, in Eshell:

$ alias c 'cp $*'
$ sudo c foo /etc/bar
/bin/cp: cannot create regular file 'bar': Permission denied

(Assuming that the user does not have write permissions to /etc.)

As a work around, it is possible to use "*sudo".



In GNU Emacs 25.2.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.15)
 of 2017-08-28 built on dhiov23k
Windowing system distributor 'The X.Org Foundation', version 11.0.11903000
System Description:	Gentoo Base System release 2.3

Configured using:
 'configure --prefix=/usr --build=x86_64-pc-linux-gnu
 --host=x86_64-pc-linux-gnu --mandir=/usr/share/man
 --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc
 --localstatedir=/var/lib --disable-dependency-tracking
 --disable-silent-rules --docdir=/usr/share/doc/emacs-25.2
 --htmldir=/usr/share/doc/emacs-25.2/html --libdir=/usr/lib64
 --program-suffix=-emacs-25 --infodir=/usr/share/info/emacs-25
 --localstatedir=/var
 --enable-locallisppath=/etc/emacs:/usr/share/emacs/site-lisp
 --with-gameuser=:gamestat --without-compress-install
 --with-file-notification=inotify --enable-acl --without-dbus
 --without-modules --without-gpm --without-hesiod --without-kerberos
 --without-kerberos5 --with-xml2 --without-selinux --with-gnutls
 --without-wide-int --with-zlib --with-sound=alsa --with-x --without-ns
 --without-gconf --without-gsettings --without-toolkit-scroll-bars
 --with-gif --with-jpeg --with-png --with-rsvg --with-tiff --with-xpm
 --with-imagemagick --with-xft --without-cairo --without-libotf
 --without-m17n-flt --with-x-toolkit=gtk3 --without-xwidgets
 GENTOO_PACKAGE=app-editors/emacs-25.2 'CFLAGS=-march=ivybridge -O2
 -pipe' CPPFLAGS= 'LDFLAGS=-Wl,-O1 -Wl,--as-needed''

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND NOTIFY ACL GNUTLS LIBXML2
FREETYPE XFT ZLIB GTK3 X11

Important settings:
  value of $LANG: en_US.utf8
  locale-coding-system: utf-8-unix




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28320; Package emacs. (Sat, 23 Sep 2017 08:24:01 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Jay Kamat <jaygkamat <at> gmail.com>
Cc: help-gnu-emacs <at> gnu.org, 28320 <at> debbugs.gnu.org,
 npostavs <at> users.sourceforge.net
Subject: Re: Possible Eshell/Tramp Bug in Emacs 26
Date: Sat, 23 Sep 2017 10:23:27 +0200
Jay Kamat <jaygkamat <at> gmail.com> writes:

Hi Jay,

> It seems that the fix to
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27954 (commit
> e66e81679c3c91d6bf8f62c7abcd968430b4d1fe) caused this issue. I had an
> eshell alias defined as
>
> alias sudo eshell/sudo $*
>
> Which seems to no longer work (with the error described).

There's also bug#28320, which seems to report the same problem.

> Now, the entry:
>
> alias sudo eshell/sudo
>
> works for my purposes instead.
>
> This is a little bit annoying since it means that I can't share these
> aliases across emacs25 and emacs26 without problems. One solution I
> could do is setting `eshell-prefer-lisp-functions' instead of using this
> alias, but I would have liked to only override sudo (and leave the rest
> as system). If anyone knows a better solution, let me know!
>
> Also, it would be nice if eshell aliases and other configuration were
> not loaded in an emacs -Q setting.

Noam, could you have a look on this?

> -Jay

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28320; Package emacs. (Fri, 05 Feb 2021 11:25:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Pierre Neidhardt <ambrevar <at> gmail.com>
Cc: 28320 <at> debbugs.gnu.org
Subject: Re: bug#28320: 25.2; Eshell/TRAMP's sudo does not work with aliases
Date: Fri, 05 Feb 2021 12:24:42 +0100
Pierre Neidhardt <ambrevar <at> gmail.com> writes:

> Using TRAMP's sudo, in Eshell:
>
> $ alias c 'cp $*'
> $ sudo c foo /etc/bar
> /bin/cp: cannot create regular file 'bar': Permission denied
>
> (Assuming that the user does not have write permissions to /etc.)
>
> As a work around, it is possible to use "*sudo".

Trying to reproduce this in Emacs 28 gives me a different, and more
logical (?) result:

~/src/emacs/trunk $ alias c 'cp $*'
~/src/emacs/trunk $ sudo c foo /etc/bar
[sudo] password for larsi: 
sudo: c: command not found

Is this working as designed, or is eshell supposed to expand the alias
before calling sudo?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 05 Feb 2021 11:25:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28320; Package emacs. (Fri, 12 Feb 2021 10:32:02 GMT) Full text and rfc822 format available.

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

From: Pierre Neidhardt <mail <at> ambrevar.xyz>
To: Lars Ingebrigtsen <larsi <at> gnus.org>, Pierre Neidhardt <ambrevar <at> gmail.com>
Cc: 28320 <at> debbugs.gnu.org
Subject: Re: bug#28320: 25.2; Eshell/TRAMP's sudo does not work with aliases
Date: Fri, 12 Feb 2021 11:30:52 +0100
[Message part 1 (text/plain, inline)]
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Is this working as designed, or is eshell supposed to expand the alias
> before calling sudo?

I don't remember what I had in mind when I initially posted the issue,
but I suppose that I reported it because I noticed an inconsistency
between "sudo" and "*sudo".

That said, Bash does not expand aliases before sudo.  So maybe the right
thing to do is to have "*sudo" behave the same way as well, to be
consistent with what users may be familiar with (Bash).

Cheers!

-- 
Pierre Neidhardt
https://ambrevar.xyz/
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28320; Package emacs. (Sat, 13 Feb 2021 12:02:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Pierre Neidhardt <mail <at> ambrevar.xyz>
Cc: 28320 <at> debbugs.gnu.org, Pierre Neidhardt <ambrevar <at> gmail.com>
Subject: Re: bug#28320: 25.2; Eshell/TRAMP's sudo does not work with aliases
Date: Sat, 13 Feb 2021 13:00:53 +0100
Pierre Neidhardt <mail <at> ambrevar.xyz> writes:

> I don't remember what I had in mind when I initially posted the issue,
> but I suppose that I reported it because I noticed an inconsistency
> between "sudo" and "*sudo".
>
> That said, Bash does not expand aliases before sudo.  So maybe the right
> thing to do is to have "*sudo" behave the same way as well, to be
> consistent with what users may be familiar with (Bash).

In Emacs 28, they do work the same:

~/src/emacs/trunk $ alias c 'cp $*'
~/src/emacs/trunk $ sudo c foo /etc/bar
[sudo] password for larsi: 
sudo: c: command not found
~/src/emacs/trunk $ *sudo c foo /etc/bar
[sudo] password for larsi: 
sudo: c: command not found

So that's consistent, and probably the correct way to behave.  So I'm
closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug closed, send any further explanations to 28320 <at> debbugs.gnu.org and Pierre Neidhardt <ambrevar <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 13 Feb 2021 12:02:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28320; Package emacs. (Sat, 13 Feb 2021 16:40:02 GMT) Full text and rfc822 format available.

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

From: Pierre Neidhardt <mail <at> ambrevar.xyz>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 28320 <at> debbugs.gnu.org, Pierre Neidhardt <ambrevar <at> gmail.com>
Subject: Re: bug#28320: 25.2; Eshell/TRAMP's sudo does not work with aliases
Date: Sat, 13 Feb 2021 17:39:05 +0100
[Message part 1 (text/plain, inline)]
Note that the behaviour of "sudo ..." maybe depend on
eshell-prefer-lisp-functions.
If it's set to nil, then "*sudo" and "sudo" are the same, which explains
the consistency you are seeing.

-- 
Pierre Neidhardt
https://ambrevar.xyz/
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28320; Package emacs. (Sat, 13 Feb 2021 21:17:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Pierre Neidhardt <mail <at> ambrevar.xyz>
Cc: 28320 <at> debbugs.gnu.org, Pierre Neidhardt <ambrevar <at> gmail.com>
Subject: Re: bug#28320: 25.2; Eshell/TRAMP's sudo does not work with aliases
Date: Sat, 13 Feb 2021 22:15:53 +0100
Pierre Neidhardt <mail <at> ambrevar.xyz> writes:

> Note that the behaviour of "sudo ..." maybe depend on
> eshell-prefer-lisp-functions.
> If it's set to nil, then "*sudo" and "sudo" are the same, which explains
> the consistency you are seeing.

I tried

M-: (setq eshell-prefer-lisp-functions t) RET

and then:

~/src/emacs/trunk $ sudo c foo /etc/bar
[sudo] password for larsi: 
sudo: c: command not found
~/src/emacs/trunk $ *sudo c foo /etc/bar
[sudo] password for larsi: 
sudo: c: command not found

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28320; Package emacs. (Sun, 14 Feb 2021 07:59:01 GMT) Full text and rfc822 format available.

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

From: Pierre Neidhardt <mail <at> ambrevar.xyz>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 28320 <at> debbugs.gnu.org, Pierre Neidhardt <ambrevar <at> gmail.com>
Subject: Re: bug#28320: 25.2; Eshell/TRAMP's sudo does not work with aliases
Date: Sun, 14 Feb 2021 08:58:33 +0100
[Message part 1 (text/plain, inline)]
I guess it's all good then, maybe this bug was fixed in the mean time,
or I just misreported.

Thank you for digging into this!

-- 
Pierre Neidhardt
https://ambrevar.xyz/
[signature.asc (application/pgp-signature, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 14 Mar 2021 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 15 days ago.

Previous Next


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