delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2020/09/07/10:03:06

X-Recipient: archive-cygwin AT delorie DOT com
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 7CC633894C16
Authentication-Results: sourceware.org;
dmarc=none (p=none dis=none) header.from=tlinx.org
Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=cygwin AT tlinx DOT org
Message-ID: <5F563D65.5000307@tlinx.org>
Date: Mon, 07 Sep 2020 07:02:13 -0700
From: L A Walsh <cygwin AT tlinx DOT org>
User-Agent: Thunderbird
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Bug in 'grep'ing for string in /proc/registry...
References: <5F55C670 DOT 7030004 AT tlinx DOT org>
<758d674d-7501-56ea-7246-894e5c877778 AT SystematicSw DOT ab DOT ca>
In-Reply-To: <758d674d-7501-56ea-7246-894e5c877778@SystematicSw.ab.ca>
X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS,
SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
Sender: "Cygwin" <cygwin-bounces AT cygwin DOT com>

On 9/7/2020 12:05 AM, Brian Inglis wrote:

>> /bin/grep -Pr '\.dll'
>> /bin/grep: Group: Is a directory
>> /bin/grep: ImagePath: Is a directory
----
	ImagePath is a expandable string value under the Eventlog
key. 'ls -l' shows ImagePath has having 65 bytes.

> ll ImagePath
 -r--r----- 1 65 Sep  6 22:06 ImagePath

	Reading the contents, one gets:
 
>>> read -r x <ImagePath
>>> echo $x
>> C:\Windows\System32\svchost.exe -k LocalServiceNetworkRestricted
>> whose length is ${#x} = 64 (not counting end-of-string)

> You remember that the /proc/registry.../ entries are only the 
> keys, subkeys, and kk values names, not the data contained in them.
---
	Not exactly.  Keys are the fs-equivalent of directories,
subkeys are the equivalent of subdirectories, and values are filenames
that usually contain content.  Any util that would normally read
file-content (or scan through it, like grep) will read the content in
registry values.

> You are doing the equivalent of:
> $ fgrep -r .dll
---
	Correct.  Which is almost the same as
fgrep -r .dll .

with the difference that results with the "." will have a "./" on
the front of the names, i.e. 

>> /bin/fgrep -r .dll .
>> /bin/fgrep: ./Group: Is a directory
>> /bin/fgrep: ./ImagePath: Is a directory
----
	I'm not sure, but it looks like you may be confusing
the function & output of 'find' and grep?  Where find looks only
at the names, whereas 'grep' scans for the text string in the
content of the files.  Given the '-r' param, 'grep' will descend
into directories -- not attempt to scan them as text files.

> producing nothing but error messages.
---
	Normally text files are not classified as directories.
Both 'ls' and 'bash' classify keys as 'directories', while values,
of every sort are classified as files.

linda
--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019