From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from Ishtar.sc.tlinx.org (ishtar.tlinx.org [173.164.175.65]) by sourceware.org (Postfix) with ESMTPS id 7CC633894C16 for ; Mon, 7 Sep 2020 14:02:19 +0000 (GMT) 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@tlinx.org Received: from [192.168.3.12] (Athenae [192.168.3.12]) by Ishtar.sc.tlinx.org (8.14.7/8.14.4/SuSE Linux 0.8) with ESMTP id 087E2FsF068385; Mon, 7 Sep 2020 07:02:17 -0700 Message-ID: <5F563D65.5000307@tlinx.org> Date: Mon, 07 Sep 2020 07:02:13 -0700 From: L A Walsh User-Agent: Thunderbird MIME-Version: 1.0 To: cygwin@cygwin.com Subject: Re: Bug in 'grep'ing for string in /proc/registry... References: <5F55C670.7030004@tlinx.org> <758d674d-7501-56ea-7246-894e5c877778@SystematicSw.ab.ca> In-Reply-To: <758d674d-7501-56ea-7246-894e5c877778@SystematicSw.ab.ca> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2020 14:02:21 -0000 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 >> 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