unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#28320: 25.2; Eshell/TRAMP's sudo does not work with aliases
@ 2017-09-01 17:06 Pierre Neidhardt
  2021-02-05 11:24 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 7+ messages in thread
From: Pierre Neidhardt @ 2017-09-01 17:06 UTC (permalink / raw)
  To: 28320


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





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#28320: 25.2; Eshell/TRAMP's sudo does not work with aliases
  2017-09-01 17:06 bug#28320: 25.2; Eshell/TRAMP's sudo does not work with aliases Pierre Neidhardt
@ 2021-02-05 11:24 ` Lars Ingebrigtsen
  2021-02-12 10:30   ` Pierre Neidhardt
  0 siblings, 1 reply; 7+ messages in thread
From: Lars Ingebrigtsen @ 2021-02-05 11:24 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: 28320

Pierre Neidhardt <ambrevar@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





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#28320: 25.2; Eshell/TRAMP's sudo does not work with aliases
  2021-02-05 11:24 ` Lars Ingebrigtsen
@ 2021-02-12 10:30   ` Pierre Neidhardt
  2021-02-13 12:00     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 7+ messages in thread
From: Pierre Neidhardt @ 2021-02-12 10:30 UTC (permalink / raw)
  To: Lars Ingebrigtsen, Pierre Neidhardt; +Cc: 28320

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

Lars Ingebrigtsen <larsi@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/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 511 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#28320: 25.2; Eshell/TRAMP's sudo does not work with aliases
  2021-02-12 10:30   ` Pierre Neidhardt
@ 2021-02-13 12:00     ` Lars Ingebrigtsen
  2021-02-13 16:39       ` Pierre Neidhardt
  0 siblings, 1 reply; 7+ messages in thread
From: Lars Ingebrigtsen @ 2021-02-13 12:00 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: 28320, Pierre Neidhardt

Pierre Neidhardt <mail@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





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#28320: 25.2; Eshell/TRAMP's sudo does not work with aliases
  2021-02-13 12:00     ` Lars Ingebrigtsen
@ 2021-02-13 16:39       ` Pierre Neidhardt
  2021-02-13 21:15         ` Lars Ingebrigtsen
  0 siblings, 1 reply; 7+ messages in thread
From: Pierre Neidhardt @ 2021-02-13 16:39 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 28320, Pierre Neidhardt

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

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/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 511 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#28320: 25.2; Eshell/TRAMP's sudo does not work with aliases
  2021-02-13 16:39       ` Pierre Neidhardt
@ 2021-02-13 21:15         ` Lars Ingebrigtsen
  2021-02-14  7:58           ` Pierre Neidhardt
  0 siblings, 1 reply; 7+ messages in thread
From: Lars Ingebrigtsen @ 2021-02-13 21:15 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: 28320, Pierre Neidhardt

Pierre Neidhardt <mail@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





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#28320: 25.2; Eshell/TRAMP's sudo does not work with aliases
  2021-02-13 21:15         ` Lars Ingebrigtsen
@ 2021-02-14  7:58           ` Pierre Neidhardt
  0 siblings, 0 replies; 7+ messages in thread
From: Pierre Neidhardt @ 2021-02-14  7:58 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 28320, Pierre Neidhardt

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

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/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 511 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-02-14  7:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-01 17:06 bug#28320: 25.2; Eshell/TRAMP's sudo does not work with aliases Pierre Neidhardt
2021-02-05 11:24 ` Lars Ingebrigtsen
2021-02-12 10:30   ` Pierre Neidhardt
2021-02-13 12:00     ` Lars Ingebrigtsen
2021-02-13 16:39       ` Pierre Neidhardt
2021-02-13 21:15         ` Lars Ingebrigtsen
2021-02-14  7:58           ` Pierre Neidhardt

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).