FS#42940 - [grep] 2.21 gives no useful output; faulty considers everything binary; -c gives wrong counts
Attached to Project:
Arch Linux
Opened by Hans Pelleboer (hansp) - Friday, 28 November 2014, 14:16 GMT
Last edited by Sébastien Luttringer (seblu) - Tuesday, 17 February 2015, 00:12 GMT
Opened by Hans Pelleboer (hansp) - Friday, 28 November 2014, 14:16 GMT
Last edited by Sébastien Luttringer (seblu) - Tuesday, 17 February 2015, 00:12 GMT
|
Details
Description:
After upgrading to grep V2.21 yesterday I noticed that, no matter what combination of input flags I use, grep outputs whenever it finds a match only this: Binary file <SSSSS> matches. This is independent of <SSSSS> actually being binary or not. When presented with the -c flag, grep prints a `1', independent of the number of matches present in the search file. Its 'null' behaviour is as usual: no match, no output. I had an archived grep V2.20 around; after placing this in /usr/bin grep behaved normal again; glibc, among others, got upgraded yesterday as well, so I feared this to be a faulty glibc dependency. Evidently, it isn't. Additional info: * package version(s) V2.21 * config and/or log files etc. Steps to reproduce: invoke grep with -c, -i, -e, -f, -n, -A or combinations thereof yields the faulty behaviour described above |
This task depends upon
Closed by Sébastien Luttringer (seblu)
Tuesday, 17 February 2015, 00:12 GMT
Reason for closing: Upstream
Additional comments about closing: Reopen if upstream provide a fix
Tuesday, 17 February 2015, 00:12 GMT
Reason for closing: Upstream
Additional comments about closing: Reopen if upstream provide a fix
$ grep -V|head -n1
grep (GNU grep) 2.21
$ grep -c bash /etc/passwd
5
$ grep root /etc/passwd
root:x:0:0:Charlie Rwolf Root:/root:/bin/zsh
$ grep ELF /usr/bin/bash
Binary file /usr/bin/bash matches
The problem has shifted somewhat: the -c flag seems to be functioning,
but a simple string search is still unsuccesful, unless the -a flag is used.
Can it be that the default behaviour of grep has shifted from -a to -I ?
That would explain it. If so --how can I change grep's defaults?
I can't find out what is wrong with them; none of the usual aberrations
are there, e.g. <CR><LF> deviations. Still, grep 2.21 insists that the
files are binary. I would like to include one, provided that you delete
it after use. It's my personal adress file, originally created in 1986
on the very first unix machine I worked on. A grep oneliner allows me
to retrieve adresses and perform range searches.
It remains peculiar, that all greps until now but this one have read
this file without fail.
Would you like to use this file for testing?
light on my grep issue before signing up to flyspray:
https://bbs.archlinux.org/viewtopic.php?id=190436
However, since this seems destined for upstream, I thought I'd at least point out here that:
- this bug impacts rkhunter. For example, the rkhunter update-process uses grep to determine
file versions, and it fails on some files with grep 2.21 but succeeds with 2.20 and earlier
grep versions.
- grep 2.21 succeeds on ASCII text files but fails on ISO-8859 text files (unless the '-a' option is used).
Grep v2.20 does not require the '-a' on the ISO-8859 text files.
It may be possible that other encodings give grep v2.21 problems.
The issue seems to be locale dependent; when set to UTF-8, ISO-8859 is no longer
recognized. I am trying to finagle what can be done, to keep grep
more accepting. After all, editors and the like don't act that difficult,
as a rule, when presented with different encodings.