GNU bug report logs - #52999
29.0.50; [PATCH] `eshell-eval-using-options' should follow POSIX/GNU argument conventions

Previous Next

Package: emacs;

Reported by: Jim Porter <jporterbugs <at> gmail.com>

Date: Tue, 4 Jan 2022 01:37:02 UTC

Severity: normal

Tags: patch

Found in version 29.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#52999: closed (29.0.50; [PATCH] `eshell-eval-using-options'
 should follow POSIX/GNU argument conventions)
Date: Wed, 12 Jan 2022 15:01:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Wed, 12 Jan 2022 17:00:29 +0200
with message-id <83ilup578y.fsf <at> gnu.org>
and subject line Re: bug#52999: 29.0.50; [PATCH v3] `eshell-eval-using-options' should follow POSIX/GNU argument conventions
has caused the debbugs.gnu.org bug report #52999,
regarding 29.0.50; [PATCH] `eshell-eval-using-options' should follow POSIX/GNU argument conventions
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
52999: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=52999
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Jim Porter <jporterbugs <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.50; [PATCH] `eshell-eval-using-options' should follow POSIX/GNU
 argument conventions
Date: Mon, 3 Jan 2022 17:36:06 -0800
[Message part 3 (text/plain, inline)]
Currently, `eshell-eval-using-options' doesn't follow POSIX/GNU argument 
conventions[1], resulting in some confusing behavior. To see this in 
action, the easiest way is probably to make a small patch to 
`eshell-do-ls' in lisp/eshell/em-ls.el: just comment out the line that says,

  :external "ls"

and then eval the function again. (This is necessary so that eshell 
doesn't fall back to the system's `ls' command when it gets confused.) 
Then open `eshell' and run:

  ls '-I*.el'

Instead of what you'd expect (a directory listing that ignores Emacs 
Lisp files), instead you get a directory listing of *all* the files in 
the long listing format. That's because `eshell-eval-using-options' 
assumes that all the characters after the "-" are names of short 
options, rather than a single short option followed by its value. You 
can see a similar problem with:

  ls '--ignore=*.el'

In this case, `eshell-eval-using-options' looks for an option named 
"ignore=*.el" instead of an option named "ignore" followed by its value.

I've attached a patch with tests to fix this and use the POSIX/GNU 
argument conventions, supporting both the above cases. However, I should 
mention that this is a slightly incompatible change. A small number of 
existing eshell commands work like `ls -I', and their behavior is now a 
bit different. Previously, you could do the following,

  ls -Ia '*.el'

to list all the files in a directory, excluding Emacs Lisp files. Now, 
you have to spell that as:

  ls -aI '*.el'
  # or...
  ls -aI'*.el'

I think that's ok though, since I can't imagine anyone *wanting* the old 
behavior. It surprised me quite a bit when I stumbled across it, and 
worse, it only crops up sometimes, since eshell transparently falls back 
to the real commands when it gets confused.

For completeness, the following commands+options are affected:

  sudo -u
  du -d
  ls -I

[1] https://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html
[0001-Follow-POSIX-GNU-argument-conventions-for-eshell-eva.patch (text/plain, attachment)]
[Message part 5 (message/rfc822, inline)]
From: Eli Zaretskii <eliz <at> gnu.org>
To: Jim Porter <jporterbugs <at> gmail.com>
Cc: 52999-done <at> debbugs.gnu.org
Subject: Re: bug#52999: 29.0.50; [PATCH v3] `eshell-eval-using-options' should
 follow POSIX/GNU argument conventions
Date: Wed, 12 Jan 2022 17:00:29 +0200
> Cc: 52999 <at> debbugs.gnu.org
> From: Jim Porter <jporterbugs <at> gmail.com>
> Date: Wed, 5 Jan 2022 16:48:39 -0800
> 
> Ok, I updated this to refer to "Built-in commands in Eshell".
> 
> Thanks for looking over the patch.

Thanks, I installed this, and I'm closing the bug.


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

Previous Next


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