Weird behavior in 'grep'ing for string in /proc/registry...

Corinna Vinschen corinna-cygwin@cygwin.com
Mon Sep 7 20:51:26 GMT 2020


On Sep  7 09:53, Thomas Wolff wrote:
> Am 07.09.2020 um 09:05 schrieb Brian Inglis:
> > On 2020-09-06 23:34, L A Walsh wrote:
> > > In directory
> > > /proc/registry/HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/services/eventlog
> > > I wanted to list all the ".dll"s that handled various types of
> > > events.
> > > 
> > > I tried
> > > /bin/grep -Pr '\.dll'
> > > 
> > > but got a load of bogus error messages:
> > > 
> > > /bin/grep: Group: Is a directory
> > > /bin/grep: ImagePath: Is a directory
> > > /bin/grep: Description: Is a directory
> > > /bin/grep: ObjectName: Is a directory
> > > ....
> > [...]
> I reproduced Lindas observation (although not in the folder she mentioned
> which does not exist here) and in fact there is an inconsistency between
> `grep -r` reporting "Is a directory" for entries that are not marked as
> directory by `ls`:
> .pwd
> /proc/registry/HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/Appinfo/Parameters
> .ls -l
> insgesamt 0
> -r--r----- 1 SYSTEM SYSTEM 34 27. Nov 2019  ServiceDll
> -r--r----- 1 SYSTEM SYSTEM  4 27. Nov 2019  ServiceDllUnloadOnStop
> .grep -r .
> grep: ServiceDll: Is a directory
> grep: ServiceDllUnloadOnStop: Is a directory
> 
> I checked whether `opendir` marks the d_type fields wrong in the /proc
> filesystem but that's not it.

No, it's a collision of an internal flag with an official open(2) flag
from fcntl.h, used by grep in this case.  I changed the way the internal
flag is used so it doesn't collide with fcntl.h flags ever, even if we
add some more.

I uploaded new snapshots for testing to https://cygwin.com/snapshots/

Please give them a try.


Thanks,
Corinna


-- 
Corinna Vinschen
Cygwin Maintainer


More information about the Cygwin mailing list