[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#52999: 29.0.50; [PATCH] `eshell-eval-using-options' should follow PO
From: |
Jim Porter |
Subject: |
bug#52999: 29.0.50; [PATCH] `eshell-eval-using-options' should follow POSIX/GNU argument conventions |
Date: |
Mon, 3 Jan 2022 17:36:06 -0800 |
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
Description: Text document
- bug#52999: 29.0.50; [PATCH] `eshell-eval-using-options' should follow POSIX/GNU argument conventions,
Jim Porter <=
- bug#52999: 29.0.50; [PATCH v2] `eshell-eval-using-options' should follow POSIX/GNU argument conventions, Jim Porter, 2022/01/04
- bug#52999: 29.0.50; [PATCH v2] `eshell-eval-using-options' should follow POSIX/GNU argument conventions, Eli Zaretskii, 2022/01/04
- bug#52999: 29.0.50; [PATCH v3] `eshell-eval-using-options' should follow POSIX/GNU argument conventions, Jim Porter, 2022/01/04
- bug#52999: 29.0.50; [PATCH v3] `eshell-eval-using-options' should follow POSIX/GNU argument conventions, Eli Zaretskii, 2022/01/05
- bug#52999: 29.0.50; [PATCH v3] `eshell-eval-using-options' should follow POSIX/GNU argument conventions, Jim Porter, 2022/01/05
- bug#52999: 29.0.50; [PATCH v3] `eshell-eval-using-options' should follow POSIX/GNU argument conventions, Eli Zaretskii, 2022/01/06
- bug#52999: 29.0.50; [PATCH v3] `eshell-eval-using-options' should follow POSIX/GNU argument conventions, Jim Porter, 2022/01/08
- bug#52999: 29.0.50; [PATCH v3] `eshell-eval-using-options' should follow POSIX/GNU argument conventions, Eli Zaretskii, 2022/01/08
- bug#52999: 29.0.50; [PATCH v3] `eshell-eval-using-options' should follow POSIX/GNU argument conventions, Eli Zaretskii, 2022/01/12