projects
/
gnucomo.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
83dbd19
)
Bugfix: Segmentation fault when reading an rpm package list
author
arjen
<arjen>
Wed, 14 Nov 2007 16:19:25 +0000
(16:19 +0000)
committer
arjen
<arjen>
Wed, 14 Nov 2007 16:19:25 +0000
(16:19 +0000)
with empty lines.
src/gcm_input/gcm_input.cpp
patch
|
blob
|
history
src/gcm_input/rpm_filter.cpp
patch
|
blob
|
history
diff --git
a/src/gcm_input/gcm_input.cpp
b/src/gcm_input/gcm_input.cpp
index
bcce2e8
..
4717f22
100644
(file)
--- a/
src/gcm_input/gcm_input.cpp
+++ b/
src/gcm_input/gcm_input.cpp
@@
-7,7
+7,7
@@
***********************
** FILE NAME : gcm_input.cpp
** SYSTEM NAME : Gnucomo - Gnu Computer Monitoring
***********************
** FILE NAME : gcm_input.cpp
** SYSTEM NAME : Gnucomo - Gnu Computer Monitoring
-** VERSION NUMBER : $Revision: 1.1
4
$
+** VERSION NUMBER : $Revision: 1.1
5
$
**
** DESCRIPTION : Application to store client messages into the database
** The client message contains a log file from one of the
**
** DESCRIPTION : Application to store client messages into the database
** The client message contains a log file from one of the
@@
-54,7
+54,11
@@
/*****************************
$Log: gcm_input.cpp,v $
/*****************************
$Log: gcm_input.cpp,v $
- Revision 1.14 2007-11-03 10:26:13 arjen
+ Revision 1.15 2007-11-14 16:19:25 arjen
+ Bugfix: Segmentation fault when reading an rpm package list
+ with empty lines.
+
+ Revision 1.14 2007/11/03 10:26:13 arjen
Added a new filter which can directly read the output
of the UNIX df command. A brief description is added in
the user manual.
Added a new filter which can directly read the output
of the UNIX df command. A brief description is added in
the user manual.
@@
-118,7
+122,7
@@
*****************************/
*****************************/
-static const char *RCSID = "$Id: gcm_input.cpp,v 1.1
4 2007-11-03 10:26:13
arjen Exp $";
+static const char *RCSID = "$Id: gcm_input.cpp,v 1.1
5 2007-11-14 16:19:25
arjen Exp $";
#include <fstream>
#include <fstream>
@@
-302,7
+306,6
@@
int main(int argc, char *argv[])
msg.add_cooker(&dlc, &df);
message_probability = msg.classify(hostname, arrival, service);
msg.add_cooker(&dlc, &df);
message_probability = msg.classify(hostname, arrival, service);
- *Log << "Message type probability = " << message_probability << "\n";
if (message_probability > 0.75)
{
try
if (message_probability > 0.75)
{
try
diff --git
a/src/gcm_input/rpm_filter.cpp
b/src/gcm_input/rpm_filter.cpp
index
dd8655d
..
98669bd
100644
(file)
--- a/
src/gcm_input/rpm_filter.cpp
+++ b/
src/gcm_input/rpm_filter.cpp
@@
-8,7
+8,7
@@
***********************
** FILE NAME : rpm_filter.cpp
** SYSTEM NAME :
***********************
** FILE NAME : rpm_filter.cpp
** SYSTEM NAME :
-** VERSION NUMBER : $Revision: 1.
1
$
+** VERSION NUMBER : $Revision: 1.
2
$
**
** DESCRIPTION : Transform a list of packages into a Gnucomo XML document
**
**
** DESCRIPTION : Transform a list of packages into a Gnucomo XML document
**
@@
-20,13
+20,17
@@
********************************
** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl
** CREATION DATE : Nov 27, 2003
********************************
** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl
** CREATION DATE : Nov 27, 2003
-** LAST UPDATE : Nov
27, 2003
+** LAST UPDATE : Nov
12, 2007
** MODIFICATIONS :
**************************************************************************/
/*****************************
$Log: rpm_filter.cpp,v $
** MODIFICATIONS :
**************************************************************************/
/*****************************
$Log: rpm_filter.cpp,v $
- Revision 1.1 2003-12-04 10:38:09 arjen
+ Revision 1.2 2007-11-14 16:19:25 arjen
+ Bugfix: Segmentation fault when reading an rpm package list
+ with empty lines.
+
+ Revision 1.1 2003/12/04 10:38:09 arjen
Major redesign. All input is handled through XML. Raw input data is first
transformed into an XML document for further processing.
A collection of polymorphic classes handle the transformation of various
Major redesign. All input is handled through XML. Raw input data is first
transformed into an XML document for further processing.
A collection of polymorphic classes handle the transformation of various
@@
-35,7
+39,7
@@
*****************************/
*****************************/
-/* static const char *RCSID = "$Id: rpm_filter.cpp,v 1.
1 2003-12-04 10:38:09
arjen Exp $"; */
+/* static const char *RCSID = "$Id: rpm_filter.cpp,v 1.
2 2007-11-14 16:19:25
arjen Exp $"; */
#include <ctype.h>
#include <ctype.h>
@@
-64,10
+68,12
@@
** VARS CHANGED :
** FUNCTIONS USED :
** SEE ALSO :
** VARS CHANGED :
** FUNCTIONS USED :
** SEE ALSO :
-** LAST MODIFIED : Nov
27, 2003
+** LAST MODIFIED : Nov
12, 2007
**=========================================================================
*/
**=========================================================================
*/
+static const regex re_rpm("[[:alnum:]+-]+-[0-9][[:alnum:].-]");
+
void rpm_filter::construct_XML(message_buffer &in, std::strstream &xml)
{
String line;
void rpm_filter::construct_XML(message_buffer &in, std::strstream &xml)
{
String line;
@@
-83,46
+89,48
@@
void rpm_filter::construct_XML(message_buffer &in, std::strstream &xml)
int version_start, next_version_start;
int i;
int version_start, next_version_start;
int i;
- // Separate the package name from the version number
+ if (line == re_rpm)
+ {
+ // Separate the package name from the version number
- i = line.index('-');
- version_start = i;
- next_version_start = i;
+ i = line.index('-');
- while (i < ~line - 1)
- {
- while (i < ~line - 1 && !(line[i] == '-' && isdigit(line[i + 1])))
+ version_start = i;
+ next_version_start = i;
+
+ while (i < ~line - 1)
{
{
+ while (i < ~line - 1 && !(line[i] == '-' && isdigit(line[i + 1])))
+ {
+ i++;
+ }
+ if (i < ~line - 1)
+ {
+ version_start = next_version_start;
+ next_version_start = i;
+ }
i++;
}
i++;
}
- if (i < ~line - 1)
+
+ if (!isdigit(line[version_start + 1]))
{
version_start = next_version_start;
{
version_start = next_version_start;
- next_version_start = i;
}
}
- i++;
- }
-
- if (!isdigit(line[version_start + 1]))
- {
- version_start = next_version_start;
- }
- String package(line(0,version_start));
- String version(line(version_start + 1, ~line));
+ String package(line(0,version_start));
+ String version(line(version_start + 1, ~line));
- // Create the XML element.
+
// Create the XML element.
- xml << " <gcmt:parameter name='" << package << "'>\n";
- xml << " <gcmt:property name='version'>" << version << "</gcmt:property>\n";
- xml << " </gcmt:parameter>\n";
+ xml << " <gcmt:parameter name='" << package << "'>\n";
+ xml << " <gcmt:property name='version'>" << version << "</gcmt:property>\n";
+ xml << " </gcmt:parameter>\n";
+ }
}
xml << " </gcmt:parameters>\n";
xml << " </gcmt:data>\n";
xml << "</gcmt:message>\n";
}
}
xml << " </gcmt:parameters>\n";
xml << " </gcmt:data>\n";
xml << "</gcmt:message>\n";
}
-static const regex re_rpm("[[:alnum:]+-]+-[0-9][[:alnum:].-]");
-
bool rpm_cooker::check_pattern(String logline)
{
return logline == re_rpm;
bool rpm_cooker::check_pattern(String logline)
{
return logline == re_rpm;