Dear Developer Team,

I have encountered a problem related to fgrep, while I was trying to search
back and forth in a file filled with a number of log messages.
I have managed to narrow down the input file to a few lines, and also wrote
a reproduction guide for it.
I have checked it with a few different grep versions, but not all seemed to
be affected.
Grep 2.6.3 (CentOS 6) and 2.16 (Ubuntu 14.04) were, and 2.25 (Unbuntu
16.04) wasn't.

The problem basically was, that I was fgrepping for messages in syslog-ng
debug logs, and I was looking for matches that matched the log lines, that
were sent to syslog-ng (ie. messages about incoming log messages), and
there were a few messages, where there was no match for the whole message,
but if I removed the last character of the string I was grepping for, then
it did return a match.
The match also showed the character I removed previously, so it was unclear
why there was no match with the last character, and why there was without...

I tried to look for already closed bugs that looked similar, but I did not
manage to find anything similar.

Thanks for your help!

Best Regards,
János Szigetvári

-- 
Janos SZIGETVARI
RHCE, License no. 150-053-692
<https://www.redhat.com/rhtapps/verify/?certId=150-053-692>

E-mail: jszigetv...@gmail.com
Phone: +36209440412 (Hungary)

__@__˚V˚
Make the switch to open (source) applications, protocols, formats now:
- windows -> Linux, iexplore -> Firefox, msoffice -> LibreOffice
- msn -> jabber protocol (Pidgin, Google Talk)
- mp3 -> ogg, wmv -> ogg, jpg -> png, doc/xls/ppt -> odt/ods/odp
Simply issue the following commands:

# fgrep '<181>Jul 28 10:44:25 xxxxxxxxxxxxxxx CSCOacs_TACACS_Accounting 
6666666666 6 6 2016-07-28 10:44:25.654 +00:00 6666666666 6666 NOTICE 
Tacacs-Accounting: TACACS+ Accounting with Command, 
ACSVersion=acs-6.6.6.66-X.666, ConfigVersionId=6666, Device IP 
Address=66.666.66.6, CmdSet=[ CmdAV=show snmp manager ], RequestLatency=6, 
Type=Accounting, Privilege-Level=6, Service=Login, User=X.xxxxxxxxxxxxxx.66, 
Port=, Remote-Address=66.666.66.6, Authen-Method=None, AVPair=task_id=6666666, 
AVPair=start_time=6666666666, AVPair=timezone=xxx, AVPair=err_msg=, 
AcctRequest-Flags=Stop, Service-Argument=shell, 
AcsSessionID=xxxxxxxxxxxxxxx/666666666/66666666, SelectedAccessService=xxxxxx, 
Step=13006 , Step=15008 , Step=15004 , Step=15012 , Step=13035 , 
NetworkDeviceName=66-66666-6666-66-666-66, NetworkDeviceGroups=Device 
Type:Devices:xxxxxx:xxxxxxxxxx, 
NetworkDeviceGroups=Location:Location:Production:Region 6 - 
xxxxxxx:xxxxx:xxxxxxxx, Response={Type=Accounting; AcctReply-Status=Success; }' 
reproduction-sample.txt 
# fgrep '<181>Jul 28 10:44:25 xxxxxxxxxxxxxxx CSCOacs_TACACS_Accounting 
6666666666 6 6 2016-07-28 10:44:25.654 +00:00 6666666666 6666 NOTICE 
Tacacs-Accounting: TACACS+ Accounting with Command, 
ACSVersion=acs-6.6.6.66-X.666, ConfigVersionId=6666, Device IP 
Address=66.666.66.6, CmdSet=[ CmdAV=show snmp manager ], RequestLatency=6, 
Type=Accounting, Privilege-Level=6, Service=Login, User=X.xxxxxxxxxxxxxx.66, 
Port=, Remote-Address=66.666.66.6, Authen-Method=None, AVPair=task_id=6666666, 
AVPair=start_time=6666666666, AVPair=timezone=xxx, AVPair=err_msg=, 
AcctRequest-Flags=Stop, Service-Argument=shell, 
AcsSessionID=xxxxxxxxxxxxxxx/666666666/66666666, SelectedAccessService=xxxxxx, 
Step=13006 , Step=15008 , Step=15004 , Step=15012 , Step=13035 , 
NetworkDeviceName=66-66666-6666-66-666-66, NetworkDeviceGroups=Device 
Type:Devices:xxxxxx:xxxxxxxxxx, 
NetworkDeviceGroups=Location:Location:Production:Region 6 - 
xxxxxxx:xxxxx:xxxxxxxx, Response={Type=Accounting; AcctReply-Status=Success; ' 
reproduction-sample.txt

# fgrep -V
fgrep (GNU grep) 2.16
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Mike Haertel and others, see 
<http://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.

CipherSuite "AES-256-CBC-SHA TLSv1 Non-Export 256-bit" - Session Reuse
line='<133>Jul 28 10:44:25 xxxx sport[23388]: [splice/probe.NOTICE] 0 {- -} 
(locl: 666.66.66.666:66666 clnt: 66.666.66.666:66666 serv: 66.666.66.66:666) No 
inner channel created for this probe splice'
line='<181>Jul 28 10:44:25 xxxxxxxxxxxxxxx CSCOacs_TACACS_Accounting 6666666666 
6 6 2016-07-28 10:44:25.654 +00:00 6666666666 6666 NOTICE Tacacs-Accounting: 
TACACS+ Accounting with Command, ACSVersion=acs-6.6.6.66-X.666, 
ConfigVersionId=6666, Device IP Address=66.666.66.6, CmdSet=[ CmdAV=show snmp 
manager ], RequestLatency=6, Type=Accounting, Privilege-Level=6, Service=Login, 
User=X.xxxxxxxxxxxxxx.66, Port=, Remote-Address=66.666.66.6, 
Authen-Method=None, AVPair=task_id=6666666, AVPair=start_time=6666666666, 
AVPair=timezone=xxx, AVPair=err_msg=, AcctRequest-Flags=Stop, 
Service-Argument=shell, AcsSessionID=xxxxxxxxxxxxxxx/666666666/66666666, 
SelectedAccessService=xxxxxx, Step=13006 , Step=15008 , Step=15004 , Step=15012 
, Step=13035 , NetworkDeviceName=66-66666-6666-66-666-66, 
NetworkDeviceGroups=Device Type:Devices:xxxxxx:xxxxxxxxxx, 
NetworkDeviceGroups=Location:Location:Production:Region 6 - 
xxxxxxx:xxxxx:xxxxxxxx, Response={Type=Accounting; AcctReply-Status=Success; }'

Reply via email to