Subject: Re: bug#29157: 25.3; Eshell parsing fails sometimes, e.g. "date" and "sed"

From: Eli Zaretskii <[email-masked]>
Date: Thu, 23 Nov 2017 18:26:52 +0200

> From: Noam Postavsky <[email-masked]>
> Date: Thu, 23 Nov 2017 07:59:10 -0500
> Cc: [email-masked]
> 
> > Disabling eshell/date makes Eshell less portable on one system at least,
> > that is Windows.  But what does "portability" mean in this context?  Are
> > the coreutils meant to be part of Eshell?  Why?  Supporting `date' but not
> > its arguments does not make up for actual portability I believe.  Case
> > in point: I got fooled.
> >
> > Let's take the case of BSD vs. GNU: bash or zsh do not wrap around `ls',
> > so the behaviour will not be the same on BSD and GNU.  Why should Eshell
> > be any different?
> 
> Eshell isn't exactly the same as bash or zsh.  You can use M-x shell if
> you prefer them.
> 
> We could fallback to the external command if given arguments.  This is
> being done currently for other commands like eshell/rm (for unrecognized
> arguments, that is).

That doesn't sound right to me (for rm as well): it will fail in
strange ways for systems where the external command is absent or
deficient.

Eshell has both internal and external implementations because it wants
to be able to handle Lisp objects and Lisp-like syntax, not just
files, pipes, and other shell stuff.  So people who expect Eshell to
be just another shell are expecting something that Eshell was never
designed to be.  That's why Eshell offers the possibility to
optionally invoke the external implementation -- but it should be done
explicitly by the users, not by us second-guessing what they mean,
because reliably guessing which arguments are for an external command
and which for the internal Eshell implementation is impossible.
Observe:

	~/git/emacs/branch $ date 42
	Wed Dec 31 19:00:42 1969
But
	~/git/emacs/branch $ *date 42
	/bin/date: invalid date ‘42’

So I'm not sure such a naïve solution is TRT in this case, because we
are losing valuable features by doing that, and those features are not
just an accident, they were intentionally included in Eshell.