Bug 128018
Summary: | grep through > 400 files in the same directory hangs up | ||||||
---|---|---|---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Robert Scheck <redhat-bugzilla> | ||||
Component: | grep | Assignee: | Tim Waugh <twaugh> | ||||
Status: | CLOSED UPSTREAM | QA Contact: | Mike McLean <mikem> | ||||
Severity: | medium | Docs Contact: | |||||
Priority: | medium | ||||||
Version: | rawhide | ||||||
Target Milestone: | --- | ||||||
Target Release: | --- | ||||||
Hardware: | All | ||||||
OS: | Linux | ||||||
Whiteboard: | |||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2004-07-16 14:13:48 UTC | Type: | --- | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Attachments: |
|
Description
Robert Scheck
2004-07-16 13:19:15 UTC
Created attachment 101964 [details]
strace of "grep Name *" in /usr/src/redhat/SPECS with 442 files, canceled with Strg-C
execve("/bin/grep", ["grep", "Name", "-", "anaconda-help.spec", "anaconda.spec", [...] One of your files is named '-'. You need to use 'grep -- Name *'. Doesn't make any sense here, the problem exists further on - the strace result seems to be the same, too. Hm...and the strange is, that a "grep Name *" or "grep -- Name *" through > 400 binary files runs immediately fine and without any problem: # cd /usr/src/redhat/RPMS/i386 # # ls -l | wc -l 484 # # grep Name * Binary file acl-2.2.7-4.i386.rpm matches Binary file anacron-2.3-31.i386.rpm matches Binary file apr-0.9.4-21.i386.rpm matches Binary file apr-devel-0.9.4-21.i386.rpm matches Binary file apr-util-0.9.4-16.i386.rpm matches Binary file apr-util-devel-0.9.4-16.i386.rpm matches Binary file arpwatch-2.1a13-4.i386.rpm matches Binary file ash-0.3.8-19.i386.rpm matches [...] # Reopening, because that behaviour simply seems wrong to me... This behaviour is correct. Grep is doing as you asked it to. And why do neither 'grep Name *' nor 'grep -- Name *' then return any result?! BTW, I thought "--" is only needed, if a file/directory starts with a (or more) "-", not when the filename contains a "-"... Oh, it wasn't clear that '--' didn't help. You have an actual file whose entire name is '-'. Grep is behaving as documented. However, it appears to go against POSIX. Reopening. :-( (FWIW: 'grep -- Name ./*' is the way to do this.) |