[lfs-dev] Possible problem with grep-2.23

Chris Staub chris at beaker67.com
Mon Feb 15 13:56:18 PST 2016


On 02/15/2016 04:32 PM, Ken Moffat wrote:
> This is my logging problem.  A while ago, I reworked my logging to
> get a list of everything "interesting" before a package was built,
> and again after.  This uses a long pipeline to exclude things which
> are not interesting (in chroot I build in /building, log in /logs and
> keep internal markers in /misc).  I also use ls -l on all the files of
> interest, to get changes.
>
> What seems to be happening is that grep-2.23 used with -v discards
> too much, grep-2.22 was ok.
>
> My commands have evolved, the listing comes down to the following,
> reformatted to one part per line with numbers added at end
>
> find -H / -xdev -type f -o -type l | \	# 001
> sed 's%^/mnt/lfs%%' | \			# 002
> grep -v '^/logs' | \			# 003
> grep -v '^/misc' | \			# 004
> grep -v '^/building' | \		# 005
> grep -v '^/tmp' |  \			# 006
> sed 's/\x20/\\\ /g' | \			# 007
> xargs ls -l | \				# 008
> sed 's%\([^/]*\)\(.*\)%\2 \1%'		# 009
>
> All is fine in the first two steps, but removing any line which
> starts '/logs' does far more.
>
> root in chroot /# wc -l /tmp/list002 /tmp/list003
>    37121 /tmp/list002
>     1495 /tmp/list003
>
> and the diff starts:
>
> --- /tmp/list002        2016-02-15 20:38:16.966065542 +0000
> +++ /tmp/list003        2016-02-15 20:38:39.717790746 +0000
> @@ -1492,35630 +1492,4 @@
>   /usr/share/doc/kbd-2.0.3/iso8859-4.txt
>   /usr/share/doc/kbd-2.0.3/utf/utflist
>   /usr/share/doc/kbd-2.0.3/utf/ethiopic
> -/usr/share/doc/kbd-2.0.3/utf/<E2><99><AA><E2><99><AC>
> -/usr/share/doc/kbd-2.0.3/utf/utfdemo
> -/usr/share/doc/kbd-2.0.3/utf/README
> -/usr/share/doc/kbd-2.0.3/kbd.FAQ-21.html
> -/usr/share/doc/kbd-2.0.3/iso8859-6.txt
> -/usr/share/doc/kbd-2.0.3/kbd.FAQ-9.html
> -/usr/share/doc/kbd-2.0.3/kbd.FAQ-1.html
> -/usr/share/doc/kbd-2.0.3/kbd.FAQ-17.html
> -/usr/share/doc/kbd-2.0.3/kbd.FAQ-13.html
> -/usr/share/doc/kbd-2.0.3/kbd.FAQ-16.html
> -/usr/share/doc/kbd-2.0.3/iso8859-14.txt
> -/usr/share/doc/kbd-2.0.3/iso8859-1.txt
> -/usr/share/doc/kbd-2.0.3/iso8859-10.txt
>
> and finally gets to
> -/bin/cat
> -/bin/cp
> -/bin/bzcat
> -/bin/lsattr
> +Binary file (standard input) matches
>
> Can anybody confirm this sort of problem with grep-2.23 ?  Or am I
> misusing those grep -v commands ?
>
> FWIW, the final sed rearranges the fields so that the filename comes
> first - that aids the comparison.
>
Do you get similar results with slightly different grep commands - for 
example, does it do the same if you leave out the "^" and just do "grep 
-v '/logs'"?


More information about the lfs-dev mailing list