Subject: bug#15937: inconsistent behavior when using the -f option

From: Aaron Selk <[email-masked]>
Date: Wed, 20 Nov 2013 19:34:51 +0000

The following command produces matches.
# egrep ^[\[].+[\]] /var/log/apache2/error.log

However, if I save the pattern to a file and use the -f option, it produces no matches.
I have to change the pattern to this:
^[\[].+\]

Notice I had to remove the enclosing square brackets to get the literal closing bracket to match when using the -f option.
This is on a Debian Squeeze system. Below is the package information. I am happy to provide more details if you needed.
# apt-cache show grep

Package: grep
Essential: yes
Priority: required
Section: utils
Installed-Size: 1148
Maintainer: Anibal Monsalve Salazar <[email-masked]>
Architecture: amd64
Version: 2.6.3-3+squeeze1
Provides: rgrep
Depends: dpkg (>= 1.15.4) | install-info
Pre-Depends: libc6 (>= 2.3)
Suggests: libpcre3 (>= 7.7)
Conflicts: rgrep
Filename: pool/main/g/grep/grep_2.6.3-3+squeeze1_amd64.deb
Size: 313920
MD5sum: 7c8b301e28fc614cd99b04ea87ad0fee
SHA1: 7ebde8d23c4efe40d6744ec9f79133c37b7d2150
SHA256: e0bb207f1446f5b560540df30cee048fe623b5de164c5e035323cffb59de1736
Description: GNU grep, egrep and fgrep
'grep' is a utility to search for text in files; it can be used from the
command line or in scripts.  Even if you don't want to use it, other packages
on your system probably will.
.
The GNU family of grep utilities may be the "fastest grep in the west".
GNU grep is based on a fast lazy-state deterministic matcher (about
twice as fast as stock Unix egrep) hybridized with a Boyer-Moore-Gosper
search for a fixed string that eliminates impossible text from being
considered by the full regexp matcher without necessarily having to
look at every character. The result is typically many times faster
than Unix grep or egrep. (Regular expressions containing backreferencing
will run more slowly, however.)
Homepage: http://www.gnu.org/software/grep/
Tag: implemented-in::c, interface::commandline, role::program, scope::utility, suite::gnu, use::searchin

Package: grep
Essential: yes
Status: install ok installed
Priority: required
Section: utils
Installed-Size: 768
Maintainer: Anibal Monsalve Salazar <[email-masked]>
Architecture: amd64
Version: 2.6.3-3
Provides: rgrep
Depends: dpkg (>= 1.15.4) | install-info
Pre-Depends: libc6 (>= 2.3)
Suggests: libpcre3 (>= 7.7)
Conflicts: rgrep
Description: GNU grep, egrep and fgrep
'grep' is a utility to search for text in files; it can be used from the
command line or in scripts.  Even if you don't want to use it, other packages
on your system probably will.
.
The GNU family of grep utilities may be the "fastest grep in the west".
GNU grep is based on a fast lazy-state deterministic matcher (about
twice as fast as stock Unix egrep) hybridized with a Boyer-Moore-Gosper
search for a fixed string that eliminates impossible text from being
considered by the full regexp matcher without necessarily having to
look at every character. The result is typically many times faster
than Unix grep or egrep. (Regular expressions containing backreferencing
will run more slowly, however.)
Homepage: http://www.gnu.org/software/grep/

Aaron Selk
Information Services
4910 Burlington Way
Tacoma, WA 98409
Ph: 253.473.5000
Fax: 253.473.5104
www.generalplastics.com

[emailsig-logo]<http://www.generalplastics.com/>
                              [facebook_resized] <http://www.facebook.com/pages/General-Plastics-Manufacturing-Company/177811009011912>  [twitter_resized] <https://twitter.com/generalplastics>  [linkedin_resized] <http://www.linkedin.com/company/general-plastics-mfg.-co.>  [youtube_resized] <http://www.youtube.com/user/GeneralPlastics>

The contents of this electronic message and any attachments are considered confidential and are intended only for the use of the individual or entity
identified above. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this
communication is strictly prohibited. If you have received this e-mail in error, please notify the sender and delete this message, as well as any attachments.