GNU bug report logs -
#69261
'ls' : --ignore does not apply on FILEs selection
Previous Next
Reported by: Mathias MICHEL <matm <at> gmx.fr>
Date: Mon, 19 Feb 2024 03:19:01 UTC
Severity: normal
Done: Paul Eggert <eggert <at> cs.ucla.edu>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 69261 in the body.
You can then email your comments to 69261 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-coreutils <at> gnu.org
:
bug#69261
; Package
coreutils
.
(Mon, 19 Feb 2024 03:19:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Mathias MICHEL <matm <at> gmx.fr>
:
New bug report received and forwarded. Copy sent to
bug-coreutils <at> gnu.org
.
(Mon, 19 Feb 2024 03:19:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hello,
Is it expected that --ignore arg does not apply on globbed FILE ?
My goal is to avoid using grep or complex find args:
> ~/.ssh :: ls id_ed* | grep -v
"\.pub$"id_ed25519id_ed25519.localid_ed25519_ori
> ~/.ssh:: find . '!' -name '*.pub' -name
"id_ed*"./id_ed25519_ori./id_ed25519.local./id_ed25519
I tried -I (--ignore) and --hide :
> ~/.ssh:: ls -I"*.pub" id_ed* id_ed25519 id_ed25519.local
id_ed25519.local.pub id_ed25519_ori
id_ed25519_ori.pub id_ed25519.pub> ~/.ssh:: ls --hide "*.pub"
id_ed* id_ed25519 id_ed25519.local id_ed25519.local.pub
id_ed25519_ori id_ed25519_ori.pub id_ed25519.pub
Since help text says for both options is : do not list implied entries
matching shell PATTERN
I would expect it to occur after building the initial listing.
When I remove the globbing pattern, it seems to work as expected:
~/.ssh:: ls -I "*.pub" ./config id_ed25519 id_ed25519.local
id_ed25519_ori id_rsa.local known_hosts known_hosts.old~/.ssh:: ls
-I "*.pub"config id_ed25519 id_ed25519.local id_ed25519_ori
id_rsa.local known_hosts known_hosts.old
Man page says nothing about conflicts with file globbing. My view is
obviously that this is a miss, what are yours ?
Thanks for your feedback--
Mathias M
[Message part 2 (text/html, inline)]
Reply sent
to
Paul Eggert <eggert <at> cs.ucla.edu>
:
You have taken responsibility.
(Mon, 19 Feb 2024 06:46:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
Mathias MICHEL <matm <at> gmx.fr>
:
bug acknowledged by developer.
(Mon, 19 Feb 2024 06:46:02 GMT)
Full text and
rfc822 format available.
Message #10 received at 69261-done <at> debbugs.gnu.org (full text, mbox):
On 2024-02-18 14:07, Mathias MICHEL via GNU coreutils Bug Reports wrote:
> Is it expected that --ignore arg does not apply on globbed FILE ?
Yes. --ignore is about what 'ls' finds in directories, not about
command-line arguments.
> My goal is to avoid using grep or complex find args:
>> > ~/.ssh :: ls id_ed* | grep -v "\.pub$" > id_ed25519 id_ed25519.local id_ed25519_ori
Try this:
ls --hide='[^i]*' --hide='i[^d]*' --hide='id[^_]*' --hide='id_[^e]*'
--hide='id_e[^d]*' --hide='*.pub'
Admittedly ugly, but does the job.
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#69261
; Package
coreutils
.
(Wed, 21 Feb 2024 00:50:01 GMT)
Full text and
rfc822 format available.
Message #13 received at 69261 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Paul Eggert said:
> Yes. --ignore is about what 'ls' finds in directories, not about
command-line arguments.
So my command should work, IMO:
ls --hide "*.pub" id_ed*
id_ed* would expand to all files starting with id_ed
ls will stat them and get their name
--hide should hide those matching the pattern.ls should display the
expected result of all id_ed private key files.
I don't understand why --hide is depending on whether FILEs were provided
or not to the command. This is the opposite of what Paul stated.
Best regards
Mathias M
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#69261
; Package
coreutils
.
(Wed, 21 Feb 2024 02:57:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 69261 <at> debbugs.gnu.org (full text, mbox):
On 2024-02-20 12:33, Mathias MICHEL via GNU coreutils Bug Reports wrote:
> I don't understand why --hide is depending on whether FILEs were provided
> or not to the command. This is the opposite of what Paul stated.
It's not the opposite of what I stated. I said that --hide affects only
files that 'ls' finds in directories itself (e.g., via ls -R); it does
not affect command-line arguments. That's the behavior you're observing,
and that's the documented behavior.
As for "why", it's similar to ls's behavior with files starting with
".". Normally ls doesn't display them, but if you give an explicit
command-line argument (e.g., "ls -d .") it displays them, regardless of
whether you've also specified -a or -A or whatever.
It's not likely that we'd change ls's behavior for the command-line
arguments you gave, as it's been behaving this way for years and other
people likely depend on this behavior. However, you can get get the
behavior that you want by using a different set of command-line
arguments (see my previous email), so you might try doing that.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 20 Mar 2024 11:24:09 GMT)
Full text and
rfc822 format available.
This bug report was last modified 1 year and 90 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.