[PATCH] fix rhbz610603
by Nikola Pajkovsky
list values shoud be parsed as uniquie
CCpp = Bugzilla, Bugzilla must be reduce to Bugzilla
Signed-off-by: Nikola Pajkovsky <npajkovs(a)redhat.com>
---
src/Daemon/Settings.cpp | 70 +++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 62 insertions(+), 8 deletions(-)
diff --git a/src/Daemon/Settings.cpp b/src/Daemon/Settings.cpp
index eb12286..b2fbb47 100644
--- a/src/Daemon/Settings.cpp
+++ b/src/Daemon/Settings.cpp
@@ -74,6 +74,20 @@ map_cron_t g_settings_mapCron;
* Loading
*/
+static int exist_item(const vector_pair_string_string_t args, const std::string key, const std::string value)
+{
+ for (size_t ii = 0; ii < args.size(); ++ii)
+ {
+ if (args[ii] == make_pair(key, value))
+ {
+ VERB3 log(" Skiping existed pair(%s,%s)", key.c_str(), value.c_str());
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
static set_string_t ParseList(const char* pList)
{
unsigned ii;
@@ -83,7 +97,11 @@ static set_string_t ParseList(const char* pList)
{
if (pList[ii] == ',')
{
- set.insert(item);
+ set_string_t::const_iterator end = set.end();
+ set_string_t::const_iterator it = set.find(item);
+ if (end == it)
+ set.insert(item);
+
item = "";
}
else
@@ -93,11 +111,43 @@ static set_string_t ParseList(const char* pList)
}
if (item != "")
{
- set.insert(item);
+ set_string_t::const_iterator end = set.end();
+ set_string_t::const_iterator it = set.find(item);
+ if (end == it)
+ set.insert(item);
}
return set;
}
+// Need to be rewritten, it's just a workaround
+static std::string parse_list_unique(const char* list)
+{
+ std::string item;
+ std::string ret;
+ for (unsigned int ii = 0; list[ii]; ii++)
+ {
+ if (list[ii] == ',')
+ {
+ if (strstr(ret.c_str(), item.c_str()) == NULL)
+ ret = ret + item + ",";
+ item = "";
+ }
+ else
+ item += list[ii];
+ }
+
+ if (item != "")
+ {
+ if (strstr(ret.c_str(), item.c_str()) == NULL)
+ ret = ret + item;
+ }
+ size_t len = strlen(ret.c_str());
+ if (ret[--len] == ',')
+ ret[len] = '\0';
+
+ return ret;
+}
+
/* Format: name, name(param),name("param with spaces \"and quotes\"") */
static vector_pair_string_string_t ParseListWithArgs(const char *pValue, int *err)
{
@@ -145,7 +195,7 @@ static vector_pair_string_string_t ParseListWithArgs(const char *pValue, int *er
}
if (pValue[ii] == ')')
{
- if (is_arg)
+ if (is_arg && !exist_item(pluginsWithArgs, action, item))
{
VERB3 log(" adding (%s,%s)", action.c_str(), item.c_str());
pluginsWithArgs.push_back(make_pair(action, item));
@@ -163,12 +213,15 @@ static vector_pair_string_string_t ParseListWithArgs(const char *pValue, int *er
}
if (pValue[ii] == ',' && !is_arg)
{
- if (item != "")
+ if (item != "" && !exist_item(pluginsWithArgs, item, ""))
{
VERB3 log(" adding (%s,%s)", item.c_str(), "");
pluginsWithArgs.push_back(make_pair(item, ""));
item = "";
}
+ else
+ item = "";
+
continue;
}
item += pValue[ii];
@@ -185,7 +238,7 @@ static vector_pair_string_string_t ParseListWithArgs(const char *pValue, int *er
*err = 1;
error_msg("Parser error: Unclosed argument in \"%s\"", pValue);
}
- else if (item != "")
+ else if (item != "" && !exist_item(pluginsWithArgs, item, ""))
{
VERB3 log(" adding (%s,%s)", item.c_str(), "");
pluginsWithArgs.push_back(make_pair(item, ""));
@@ -455,19 +508,20 @@ static int ReadConfigurationFromFile(FILE *fp)
{
if (s_mapSectionCommon[key] != "")
s_mapSectionCommon[key] += ",";
- s_mapSectionCommon[key] += value;
+ s_mapSectionCommon[key] += parse_list_unique(value.c_str());
}
else if (section == SECTION_ANALYZER_ACTIONS_AND_REPORTERS)
{
if (s_mapSectionAnalyzerActionsAndReporters[key] != "")
s_mapSectionAnalyzerActionsAndReporters[key] += ",";
- s_mapSectionAnalyzerActionsAndReporters[key] += value;
+
+ s_mapSectionAnalyzerActionsAndReporters[key] += parse_list_unique(value.c_str());
}
else if (section == SECTION_CRON)
{
if (s_mapSectionCron[key] != "")
s_mapSectionCron[key] += ",";
- s_mapSectionCron[key] += value;
+ s_mapSectionCron[key] += parse_list_unique(value.c_str());
}
else
{
--
1.7.1
13 years, 10 months
[PATCH] do not pop up message on crash if the same crash is the same
by Denys Vlasenko
Please review.
I have a 30 minute timeout, is it a good value?
--
vda
diff -x '*.po' -d -urpN abrt.8/src/Applet/Applet.cpp abrt.9/src/Applet/Applet.cpp
--- abrt.8/src/Applet/Applet.cpp 2010-07-09 14:10:31.000000000 +0200
+++ abrt.9/src/Applet/Applet.cpp 2010-07-14 14:25:05.503658097 +0200
@@ -45,19 +45,20 @@ static void Crash(DBusMessage* signal)
int r;
DBusMessageIter in_iter;
dbus_message_iter_init(signal, &in_iter);
+
+ /* 1st param: package */
const char* package_name;
r = load_val(&in_iter, package_name);
+
/* 2nd param: crash_id */
const char* crash_id = NULL;
- if (r == ABRT_DBUS_MORE_FIELDS)
- {
- r = load_val(&in_iter, crash_id);
- }
- else
+ if (r != ABRT_DBUS_MORE_FIELDS)
{
error_msg("dbus signal %s: parameter type mismatch", __func__);
return;
}
+ r = load_val(&in_iter, crash_id);
+
/* Optional 3rd param: uid */
const char* uid_str = NULL;
if (r == ABRT_DBUS_MORE_FIELDS)
@@ -70,10 +71,6 @@ static void Crash(DBusMessage* signal)
return;
}
- //if (m_pSessionDBus->has_name("com.redhat.abrt.gui"))
- // return;
-// uid_t uid_num = atol(uid_str);
-
if (uid_str != NULL)
{
char *end;
@@ -91,6 +88,26 @@ static void Crash(DBusMessage* signal)
//applet->AddEvent(uid, package_name);
applet->SetIconTooltip(message, package_name);
applet->ShowIcon();
+
+ /* If this crash seems to be repeating, do not annoy user with popup dialog.
+ * (The icon in the tray is not suppressed)
+ */
+ static time_t last_time = 0;
+ static char* last_package_name = NULL;
+ static char* last_crash_id = NULL;
+ time_t cur_time = time(NULL);
+ if (last_package_name && strcmp(last_package_name, package_name) == 0
+ && last_crash_id && strcmp(last_crash_id, crash_id) == 0
+ && (unsigned)(cur_time - last_time) < 30 * 60
+ ) {
+ return;
+ }
+ last_time = cur_time;
+ free(last_package_name);
+ last_package_name = xstrdup(package_name);
+ free(last_crash_id);
+ last_crash_id = xstrdup(crash_id);
+
applet->CrashNotify(crash_id, message, package_name);
}
13 years, 10 months
offre plv
by serge
Découvrez tout l'univers CADREV
en cliquant ici
4 départements pour faciliter vos recherches
Des professionnels pour vous conseiller
Stimulation de vente
& cadeaux d'affaires
Le catalogue ici
Hi-Fi
Vidéo
Téléphonie
Séjours
Coffrets gourmand
Si vous souhaitez vous désabonner, recopiez cette adresse dans la barre d'adresse de votre navigateur :
http://www.cadrev.net/u-1.1.php?param=3Rbi_1IvEkRQjb1KxEpD5OBZWRGj9U.6yPE...
13 years, 10 months
[PATCH] abort initialization on abrt.conf parsing errors
by Denys Vlasenko
LoadSettings() is too liberal: it only warns about parse errors.
With this patch, obviously broken config files are detected
and abrtd fails to start. Example: I removed = sign from
"Database = SQLite3" line, and:
# abrtd -dvv
abrtd: Loading settings
abrtd: abrt.conf: Invalid syntax on line 23
abrtd: Error while initializing daemon
abrtd: Exiting
--
vda
diff -x '*.po' -d -urpN abrt.5/src/Daemon/Daemon.cpp abrt.6/src/Daemon/Daemon.cpp
--- abrt.5/src/Daemon/Daemon.cpp 2010-07-13 12:55:39.000000000 +0200
+++ abrt.6/src/Daemon/Daemon.cpp 2010-07-13 13:53:48.216072655 +0200
@@ -842,7 +842,8 @@ int main(int argc, char** argv)
init_daemon_logging(&watcher);
VERB1 log("Loading settings");
- LoadSettings();
+ if (LoadSettings() != 0)
+ throw 1;
VERB1 log("Initializing XML-RPC library");
xmlrpc_env env;
diff -x '*.po' -d -urpN abrt.5/src/Daemon/Settings.cpp abrt.6/src/Daemon/Settings.cpp
--- abrt.5/src/Daemon/Settings.cpp 2010-06-22 18:19:11.000000000 +0200
+++ abrt.6/src/Daemon/Settings.cpp 2010-07-13 14:14:40.054822644 +0200
@@ -99,7 +99,7 @@ static set_string_t ParseList(const char
}
/* Format: name, name(param),name("param with spaces \"and quotes\"") */
-static vector_pair_string_string_t ParseListWithArgs(const char *pValue)
+static vector_pair_string_string_t ParseListWithArgs(const char *pValue, int *err)
{
VERB3 log(" ParseListWithArgs(%s)", pValue);
@@ -136,7 +136,10 @@ static vector_pair_string_string_t Parse
is_arg = true;
}
else
+ {
+ *err = 1;
error_msg("Parser error: Invalid syntax on column %d in \"%s\"", ii, pValue);
+ }
continue;
}
@@ -151,7 +154,10 @@ static vector_pair_string_string_t Parse
action = "";
}
else
+ {
+ *err = 1;
error_msg("Parser error: Invalid syntax on column %d in \"%s\"", ii, pValue);
+ }
continue;
}
@@ -169,10 +175,16 @@ static vector_pair_string_string_t Parse
}
if (is_quote)
+ {
+ *err = 1;
error_msg("Parser error: Unclosed quote in \"%s\"", pValue);
+ }
if (is_arg)
+ {
+ *err = 1;
error_msg("Parser error: Unclosed argument in \"%s\"", pValue);
+ }
else if (item != "")
{
VERB3 log(" adding (%s,%s)", item.c_str(), "");
@@ -181,7 +193,7 @@ static vector_pair_string_string_t Parse
return pluginsWithArgs;
}
-static void ParseCommon()
+static int ParseCommon()
{
map_string_t::const_iterator end = s_mapSectionCommon.end();
map_string_t::const_iterator it = s_mapSectionCommon.find("OpenGPGCheck");
@@ -217,26 +229,34 @@ static void ParseCommon()
it = s_mapSectionCommon.find("ActionsAndReporters");
if (it != end)
{
- g_settings_vectorActionsAndReporters = ParseListWithArgs(it->second.c_str());
+ int err = 0;
+ g_settings_vectorActionsAndReporters = ParseListWithArgs(it->second.c_str(), &err);
+ if (err)
+ return err;
}
it = s_mapSectionCommon.find("ProcessUnpackaged");
if (it != end)
{
g_settings_bProcessUnpackaged = string_to_bool(it->second.c_str());
}
+ return 0; /* no error */
}
-static void ParseCron()
+static int ParseCron()
{
map_string_t::iterator it = s_mapSectionCron.begin();
for (; it != s_mapSectionCron.end(); it++)
{
- vector_pair_string_string_t actionsAndReporters = ParseListWithArgs(it->second.c_str());
+ int err = 0;
+ vector_pair_string_string_t actionsAndReporters = ParseListWithArgs(it->second.c_str(), &err);
+ if (err)
+ return err;
g_settings_mapCron[it->first] = actionsAndReporters;
}
+ return 0; /* no error */
}
-static set_string_t ParseKey(const char *Key)
+static set_string_t ParseKey(const char *Key, int *err)
{
unsigned int ii;
std::string item;
@@ -266,7 +286,10 @@ static set_string_t ParseKey(const char
item = "";
}
else
+ {
+ *err = 1;
error_msg("Parser error: Invalid syntax on column %d in \"%s\"", ii, Key);
+ }
}
else
{
@@ -275,6 +298,7 @@ static set_string_t ParseKey(const char
}
if (is_quote)
{
+ *err = 1;
error_msg("Parser error: Unclosed quote in \"%s\"", Key);
}
else if (item != "")
@@ -291,13 +315,16 @@ static set_string_t ParseKey(const char
return set;
}
-static void ParseAnalyzerActionsAndReporters()
+static int ParseAnalyzerActionsAndReporters()
{
map_string_t::iterator it = s_mapSectionAnalyzerActionsAndReporters.begin();
for (; it != s_mapSectionAnalyzerActionsAndReporters.end(); it++)
{
- set_string_t keys = ParseKey(it->first.c_str());
- vector_pair_string_string_t actionsAndReporters = ParseListWithArgs(it->second.c_str());
+ int err = 0;
+ set_string_t keys = ParseKey(it->first.c_str(), &err);
+ vector_pair_string_string_t actionsAndReporters = ParseListWithArgs(it->second.c_str(), &err);
+ if (err)
+ return err;
set_string_t::iterator it_keys = keys.begin();
for (; it_keys != keys.end(); it_keys++)
{
@@ -305,6 +332,7 @@ static void ParseAnalyzerActionsAndRepor
g_settings_mapAnalyzerActionsAndReporters[*it_keys] = actionsAndReporters;
}
}
+ return 0; /* no error */
}
static void LoadGPGKeys()
@@ -332,7 +360,7 @@ static void LoadGPGKeys()
* Reads configuration from file to s_mapSection* static variables.
* The file must be opened for reading.
*/
-static void ReadConfigurationFromFile(FILE *fp)
+static int ReadConfigurationFromFile(FILE *fp)
{
char line[512];
std::string section;
@@ -395,26 +423,32 @@ static void ReadConfigurationFromFile(FI
if (is_quote)
{
error_msg("abrt.conf: Invalid syntax on line %d", lineno);
- continue;
+ return 1; /* error */
}
if (is_section)
{
if (line[ii] != ']') /* section not closed */
+ {
error_msg("abrt.conf: Section not closed on line %d", lineno);
+ return 1; /* error */
+ }
continue;
}
if (is_key)
{
if (!value.empty()) /* the key is stored in value */
+ {
error_msg("abrt.conf: Invalid syntax on line %d", lineno);
+ return 1; /* error */
+ }
continue;
}
else if (key.empty()) /* A line without key: " = something" */
{
error_msg("abrt.conf: Invalid syntax on line %d", lineno);
- continue;
+ return 1; /* error */
}
if (section == SECTION_COMMON)
@@ -436,35 +470,48 @@ static void ReadConfigurationFromFile(FI
s_mapSectionCron[key] += value;
}
else
+ {
error_msg("abrt.conf: Ignoring entry in invalid section [%s]", section.c_str());
+ return 1; /* error */
+ }
}
+ return 0; /* success */
}
/* abrt daemon loads .conf file */
-void LoadSettings()
+int LoadSettings()
{
+ int err = 0;
+
FILE *fp = fopen(CONF_DIR"/abrt.conf", "r");
if (fp)
{
- ReadConfigurationFromFile(fp);
+ err = ReadConfigurationFromFile(fp);
fclose(fp);
}
else
error_msg("Unable to read configuration file %s", CONF_DIR"/abrt.conf");
- ParseCommon();
- ParseAnalyzerActionsAndReporters();
- ParseCron();
+ if (err == 0)
+ err = ParseCommon();
+ if (err == 0)
+ err = ParseAnalyzerActionsAndReporters();
+ if (err == 0)
+ err = ParseCron();
- /*
- loading gpg keys will invoke LoadOpenGPGPublicKey() from rpm.cpp
- pgpReadPkts which makes nss to re-init and thus makes
- bugzilla plugin work :-/
- */
+ if (err == 0)
+ {
+ /*
+ * loading gpg keys will invoke LoadOpenGPGPublicKey() from rpm.cpp
+ * pgpReadPkts which makes nss to re-init and thus makes
+ * bugzilla plugin work :-/
+ */
+ //FIXME FIXME FIXME FIXME FIXME FIXME!!!
+ //if(g_settings_bOpenGPGCheck)
+ LoadGPGKeys();
+ }
- //FIXME FIXME FIXME FIXME FIXME FIXME!!!
- //if(g_settings_bOpenGPGCheck)
- LoadGPGKeys();
+ return err;
}
/* dbus call to retrieve .conf file data from daemon */
diff -x '*.po' -d -urpN abrt.5/src/Daemon/Settings.h abrt.6/src/Daemon/Settings.h
--- abrt.5/src/Daemon/Settings.h 2010-06-22 18:19:11.000000000 +0200
+++ abrt.6/src/Daemon/Settings.h 2010-07-13 13:53:05.493822756 +0200
@@ -37,7 +37,7 @@ extern map_cron_t g_settings_mapCron;
extern vector_pair_string_string_t g_settings_vectorActionsAndReporters;
extern map_analyzer_actions_and_reporters_t g_settings_mapAnalyzerActionsAndReporters;
-void LoadSettings();
+int LoadSettings();
void SaveSettings();
void SetSettings(const map_abrt_settings_t& pSettings, const char * dbus_sender);
map_abrt_settings_t GetSettings();
13 years, 10 months
RHTSupport conf file
by Karel Klic
RHTSupport.conf should list the allowed setting items.
I am going to push the following change into our repository:
diff --git a/lib/Plugins/RHTSupport.conf b/lib/Plugins/RHTSupport.conf
index 3201c6d..f57317f 100644
--- a/lib/Plugins/RHTSupport.conf
+++ b/lib/Plugins/RHTSupport.conf
@@ -1 +1,9 @@
Enabled = yes
+
+URL = http://support-services-devel.gss.redhat.com:8080/Strata
+# No means that ssl certificates will not be checked
+SSLVerify = yes
+# Your login has to exist
+Login =
+# Your password
+Password =
If there is something wrong with the change, please tell me.
K
13 years, 10 months
[PATCH] GUI: don't require rating for all crashes
by Jiri Moskovcak
There is a bug in the latest version which prevents koopses and old
python crashes from reporting to bz because they don't have a rating.
These patches restore the old behavior.
Please review,
Jirka
13 years, 10 months