GNU bug report logs - #29157
25.3; Eshell parsing fails sometimes, e.g. "date" and "sed"

Previous Next

Package: emacs;

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

Date: Sun, 5 Nov 2017 11:38:02 UTC

Severity: normal

Found in version 25.3

Fixed in version 27.1

Done: Noam Postavsky <npostavs <at> users.sourceforge.net>

Bug is archived. No further changes may be made.

Full log


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

From: Noam Postavsky <npostavs <at> users.sourceforge.net>
To: Pierre Neidhardt <ambrevar <at> gmail.com>
Cc: 29157 <at> debbugs.gnu.org
Subject: Re: bug#29157: 25.3;
 Eshell parsing fails sometimes, e.g. "date" and "sed"
Date: Thu, 23 Nov 2017 07:59:10 -0500
[Message part 1 (text/plain, inline)]
Pierre Neidhardt <ambrevar <at> gmail.com> writes:

> 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).

[0001-eshell-date-use-external-date-for-any-arguments-Bug-.patch (text/x-diff, inline)]
From ab25f638ccff0ebec36b78f9b47092fe9fb103b3 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs <at> gmail.com>
Date: Thu, 23 Nov 2017 07:51:13 -0500
Subject: [PATCH] eshell/date: use external date for any arguments (Bug#29157)

* lisp/eshell/em-unix.el (eshell/date): Throw `eshell-external' if
given any arguments.
(eshell-unix-initialize): Add "date" to `eshell-complex-commands'.
---
 lisp/eshell/em-unix.el | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/lisp/eshell/em-unix.el b/lisp/eshell/em-unix.el
index c486d2c51d..342a045d42 100644
--- a/lisp/eshell/em-unix.el
+++ b/lisp/eshell/em-unix.el
@@ -148,13 +148,18 @@ eshell-unix-initialize
   (make-local-variable 'eshell-complex-commands)
   (setq eshell-complex-commands
 	(append '("grep" "egrep" "fgrep" "agrep" "glimpse" "locate"
-		  "cat" "time" "cp" "mv" "make" "du" "diff")
+		  "cat" "date" "time" "cp" "mv" "make" "du" "diff")
 		eshell-complex-commands)))
 
-(defalias 'eshell/date     'current-time-string)
 (defalias 'eshell/basename 'file-name-nondirectory)
 (defalias 'eshell/dirname  'file-name-directory)
 
+(defun eshell/date (&rest args)
+  (when args
+    (throw 'eshell-external
+           (eshell-external-command "date" args)))
+  (current-time-string))
+
 (defvar em-interactive)
 (defvar em-preview)
 (defvar em-recursive)
-- 
2.11.0


This bug report was last modified 7 years and 159 days ago.

Previous Next


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