Compare commits

...

No commits in common. "c10s" and "c8" have entirely different histories.
c10s ... c8

43 changed files with 987 additions and 570 deletions

1
.abrt.metadata Normal file
View File

@ -0,0 +1 @@
8447e6b5d2604815a4156e891936a4c76316f3f4 SOURCES/abrt-2.10.9.tar.gz

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
SOURCES/abrt-2.10.9.tar.gz

View File

@ -1,3 +0,0 @@
# Package Not Available
This package is not available on CentOS Stream 10.
It may be available on another branch.

View File

@ -0,0 +1,155 @@
From b9005f1a69ad989a50ffa68a41c959551f0cb158 Mon Sep 17 00:00:00 2001
From: Matej Habrnal <mhabrnal@redhat.com>
Date: Wed, 23 May 2018 11:15:38 +0200
Subject: [PATCH 1/1] Remove dependency on deprecated nss-pem
This commit removes dependency on nss-pem which is deprecated and
reimplements TLS client to use libnssckbi.so instead [1].
Resolves #1578427
[1] https://docs-old.fedoraproject.org/en-US/Fedora_Security_Team/1/html/Defensive_Coding/sect-Defensive_Coding-TLS-Client-NSS.html#ex-Defensive_Coding-TLS-NSS-Init
Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
---
abrt.spec.in | 2 +-
src/plugins/abrt-retrace-client.c | 5 ++-
src/plugins/https-utils.c | 53 ++++++-------------------------
src/plugins/https-utils.h | 4 +--
4 files changed, 15 insertions(+), 49 deletions(-)
diff --git a/abrt.spec.in b/abrt.spec.in
index f423562c..eb6fdaf9 100644
--- a/abrt.spec.in
+++ b/abrt.spec.in
@@ -255,7 +255,7 @@ Summary: %{name}'s retrace client
Requires: %{name} = %{version}-%{release}
Requires: xz
Requires: tar
-Requires: nss-pem
+Requires: p11-kit-trust
%description retrace-client
This package contains the client application for Retrace server
diff --git a/src/plugins/abrt-retrace-client.c b/src/plugins/abrt-retrace-client.c
index ae5ef83b..d50d45fb 100644
--- a/src/plugins/abrt-retrace-client.c
+++ b/src/plugins/abrt-retrace-client.c
@@ -1281,8 +1281,7 @@ int main(int argc, char **argv)
/* Initialize NSS */
SECMODModule *mod;
- PK11GenericObject *cert;
- nss_init(&mod, &cert);
+ nss_init(&mod);
/* Run the desired operation. */
int result = 0;
@@ -1334,7 +1333,7 @@ int main(int argc, char **argv)
error_msg_and_die(_("Unknown operation: %s."), operation);
/* Shutdown NSS. */
- nss_close(mod, cert);
+ nss_close(mod);
return result;
}
diff --git a/src/plugins/https-utils.c b/src/plugins/https-utils.c
index 7a22729b..7a9479ca 100644
--- a/src/plugins/https-utils.c
+++ b/src/plugins/https-utils.c
@@ -142,37 +142,6 @@ static const char *ssl_get_configdir()
return NULL;
}
-static PK11GenericObject *nss_load_cacert(const char *filename)
-{
- PK11SlotInfo *slot = PK11_FindSlotByName("PEM Token #0");
- if (!slot)
- error_msg_and_die(_("Failed to get slot 'PEM Token #0': %d."), PORT_GetError());
-
- CK_ATTRIBUTE template[4];
- CK_OBJECT_CLASS class = CKO_CERTIFICATE;
-
-#define PK11_SETATTRS(x,id,v,l) \
- do { \
- (x)->type = (id); \
- (x)->pValue=(v); \
- (x)->ulValueLen = (l); \
- } while (0)
-
- PK11_SETATTRS(&template[0], CKA_CLASS, &class, sizeof(class));
- CK_BBOOL cktrue = CK_TRUE;
- PK11_SETATTRS(&template[1], CKA_TOKEN, &cktrue, sizeof(CK_BBOOL));
- PK11_SETATTRS(&template[2], CKA_LABEL, (unsigned char*)filename, strlen(filename)+1);
- PK11_SETATTRS(&template[3], CKA_TRUST, &cktrue, sizeof(CK_BBOOL));
- PK11GenericObject *cert = PK11_CreateGenericObject(slot, template, 4, PR_FALSE);
- PK11_FreeSlot(slot);
- return cert;
-}
-
-static char *ssl_get_password(PK11SlotInfo *slot, PRBool retry, void *arg)
-{
- return NULL;
-}
-
void ssl_connect(struct https_cfg *cfg, PRFileDesc **tcp_sock, PRFileDesc **ssl_sock)
{
PRAddrInfo *addrinfo = PR_GetAddrInfoByName(cfg->url, PR_AF_UNSPEC, PR_AI_ADDRCONFIG);
@@ -411,7 +380,7 @@ char *http_join_chunked(char *body, int bodylen)
return strbuf_free_nobuf(result);
}
-void nss_init(SECMODModule **mod, PK11GenericObject **cert)
+void nss_init(SECMODModule **mod)
{
SECStatus sec_status;
const char *configdir = ssl_get_configdir();
@@ -422,21 +391,19 @@ void nss_init(SECMODModule **mod, PK11GenericObject **cert)
if (SECSuccess != sec_status)
error_msg_and_die(_("Failed to initialize NSS."));
- char *user_module = xstrdup("library=libnsspem.so name=PEM");
- *mod = SECMOD_LoadUserModule(user_module, NULL, PR_FALSE);
- free(user_module);
- if (!*mod || !(*mod)->loaded)
- error_msg_and_die(_("Failed to initialize security module."));
-
- *cert = nss_load_cacert("/etc/pki/tls/certs/ca-bundle.crt");
- PK11_SetPasswordFunc(ssl_get_password);
- NSS_SetDomesticPolicy();
+ // Initialize the trusted certificate store.
+ char module_name[] = "library=libnssckbi.so name=\"Root Certs\"";
+ *mod = SECMOD_LoadUserModule(module_name, NULL, PR_FALSE);
+ if (*mod == NULL || !(*mod)->loaded)
+ {
+ const PRErrorCode err = PR_GetError();
+ error_msg_and_die("error: NSPR error code %d: %s\n", err, PR_ErrorToName(err));
+ }
}
-void nss_close(SECMODModule *mod, PK11GenericObject *cert)
+void nss_close(SECMODModule *mod)
{
SSL_ClearSessionCache();
- PK11_DestroyGenericObject(cert);
SECMOD_UnloadUserModule(mod);
SECMOD_DestroyModule(mod);
SECStatus sec_status = NSS_Shutdown();
diff --git a/src/plugins/https-utils.h b/src/plugins/https-utils.h
index 8ff9aede..f0b167d3 100644
--- a/src/plugins/https-utils.h
+++ b/src/plugins/https-utils.h
@@ -61,7 +61,7 @@ int http_get_response_code(const char *message);
void http_print_headers(FILE *file, const char *message);
char *tcp_read_response(PRFileDesc *tcp_sock);
char *http_join_chunked(char *body, int bodylen);
-void nss_init(SECMODModule **mod, PK11GenericObject **cert);
-void nss_close(SECMODModule *mod, PK11GenericObject *cert);
+void nss_init(SECMODModule **mod);
+void nss_close(SECMODModule *mod);
#endif
--
2.17.0

View File

@ -0,0 +1,133 @@
From a8a22295837aaadf39bfede6c92e9f9047bcaa34 Mon Sep 17 00:00:00 2001
From: Matej Habrnal <mhabrnal@redhat.com>
Date: Wed, 6 Jun 2018 14:04:09 +0200
Subject: [PATCH] ccpp: add %h and %e parameter into abrt-hook-ccpp
Without this commit core_pattern's parameter %h and %e was not
translated at all.
If there is a white space in executable filename, %e replaced only by
the first part of executable name (till the space). Hence we decided
to get executable name from /proc/PID/exe symlink exist.
Example:
If 'core_pattern = core.%h.%p.%t.%e' the result was
core.%h.26284.1469805542.sleep not
core.myshostmane.26284.1469805542.sleep with spaces
Related to #1587891
Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
---
src/hooks/abrt-hook-ccpp.c | 36 ++++++++++++++++++++++++------------
src/hooks/abrt-install-ccpp-hook.in | 2 +-
2 files changed, 25 insertions(+), 13 deletions(-)
diff --git a/src/hooks/abrt-hook-ccpp.c b/src/hooks/abrt-hook-ccpp.c
index 1c4e45e..40117fc 100644
--- a/src/hooks/abrt-hook-ccpp.c
+++ b/src/hooks/abrt-hook-ccpp.c
@@ -65,13 +65,13 @@ static struct dump_dir *dd;
* %t - UNIX time of dump
* %P - global pid
* %I - crash thread tid
- * %e - executable filename (can contain white spaces)
+ * %h - hostname
+ * %e - executable filename (can contain white spaces, must be placed at the end)
* %% - output one "%"
*/
/* Hook must be installed with exactly the same sequence of %c specifiers.
- * Last one, %h, may be omitted (we can find it out).
*/
-static const char percent_specifiers[] = "%scpugtePi";
+static const char percent_specifiers[] = "%scpugtPIhe";
static char *core_basename = (char*) "core";
static DIR *open_cwd(pid_t pid)
@@ -146,7 +146,8 @@ static int setfscreatecon_raw(security_context_t context)
}
#endif
-static int open_user_core(uid_t uid, uid_t fsuid, gid_t fsgid, pid_t pid, char **percent_values)
+static int open_user_core(uid_t uid, uid_t fsuid, gid_t fsgid, pid_t pid,
+ char **percent_values, const char *executable_filename)
{
proc_cwd = open_cwd(pid);
if (proc_cwd == NULL)
@@ -196,7 +197,13 @@ static int open_user_core(uid_t uid, uid_t fsuid, gid_t fsgid, pid_t pid, char *
{
const char *val = "%";
if (specifier_num > 0) /* not %% */
+ {
val = percent_values[specifier_num - 1];
+ /* if %e (executable filename), use executable from
+ * /proc/PID/exe symlink if exists */
+ if (percent_specifiers[specifier_num] == 'e' && executable_filename)
+ val = executable_filename;
+ }
//log_warning("c:'%c'", c);
//log_warning("val:'%s'", val);
@@ -917,9 +924,9 @@ int main(int argc, char** argv)
if (argc < 8)
{
- /* percent specifier: %s %c %p %u %g %t %P %T */
- /* argv: [0] [1] [2] [3] [4] [5] [6] [7] [8] */
- error_msg_and_die("Usage: %s SIGNO CORE_SIZE_LIMIT PID UID GID TIME GLOBAL_PID GLOBAL_TID", argv[0]);
+ /* percent specifier: %s %c %p %u %g %t %P %I %h %e */
+ /* argv: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] */
+ error_msg_and_die("Usage: %s SIGNO CORE_SIZE_LIMIT PID UID GID TIME GLOBAL_PID GLOBAL_TID HOSTNAME BINARY_NAME", argv[0]);
}
/* Not needed on 2.6.30.
@@ -1016,13 +1023,21 @@ int main(int argc, char** argv)
snprintf(path, sizeof(path), "%s/last-ccpp", g_settings_dump_location);
+ char *executable = get_executable_at(pid_proc_fd);
+ const char *last_slash = NULL;
+ if (executable)
+ {
+ last_slash = strrchr(executable, '/');
+ /* if the last_slash was found, skip it */
+ if (last_slash) ++last_slash;
+ }
+
/* Open a fd to compat coredump, if requested and is possible */
int user_core_fd = -1;
if (setting_MakeCompatCore && ulimit_c != 0)
/* note: checks "user_pwd == NULL" inside; updates core_basename */
- user_core_fd = open_user_core(uid, fsuid, fsgid, pid, &argv[1]);
+ user_core_fd = open_user_core(uid, fsuid, fsgid, pid, &argv[1], (const char *)last_slash);
- char *executable = get_executable_at(pid_proc_fd);
if (executable == NULL)
{
/* readlink on /proc/$PID/exe failed, don't create abrt dump dir */
@@ -1031,9 +1046,6 @@ int main(int argc, char** argv)
return create_user_core(user_core_fd, pid, ulimit_c);
}
- const char *last_slash = strrchr(executable, '/');
- /* if the last_slash was found, skip it */
- if (last_slash) ++last_slash;
/* ignoring crashes */
if (executable && is_path_ignored(setting_ignored_paths, executable))
diff --git a/src/hooks/abrt-install-ccpp-hook.in b/src/hooks/abrt-install-ccpp-hook.in
index 660c209..f8c0c61 100755
--- a/src/hooks/abrt-install-ccpp-hook.in
+++ b/src/hooks/abrt-install-ccpp-hook.in
@@ -11,7 +11,7 @@ SAVED_PATTERN_DIR="@VAR_RUN@/abrt"
SAVED_PATTERN_FILE="@VAR_RUN@/abrt/saved_core_pattern"
HOOK_BIN="@libexecdir@/abrt-hook-ccpp"
# Must match percent_specifiers[] order in abrt-hook-ccpp.c:
-PATTERN="|$HOOK_BIN %s %c %p %u %g %t %P %I"
+PATTERN="|$HOOK_BIN %s %c %p %u %g %t %P %I %h %e"
# core_pipe_limit specifies how many dump_helpers can run at the same time
# 0 - means unlimited, but it's not guaranteed that /proc/<pid> of crashing
--
1.8.3.1

View File

@ -0,0 +1,41 @@
From 7e9e07dc9ce67777a201beddc8cef32f08293a2b Mon Sep 17 00:00:00 2001
From: Martin Kutlak <mkutlak@redhat.com>
Date: Tue, 24 Jul 2018 10:17:05 +0200
Subject: [PATCH] lib: Correct the syntax for gdb backtrace command
abrt-action-generate-backtrace generates backtraces with error message:
A syntax error in expression, near `full'.
According to the GDB documentation the correct syntax for backtrace
command is:
backtrace [n]
backtrace full [n]
- sourceware.org/gdb/onlinedocs/gdb/Backtrace.html
Signed-off-by: Martin Kutlak <mkutlak@redhat.com>
---
src/lib/hooklib.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/lib/hooklib.c b/src/lib/hooklib.c
index 135c7cde..b66fc119 100644
--- a/src/lib/hooklib.c
+++ b/src/lib/hooklib.c
@@ -353,11 +353,11 @@ char *get_backtrace(const char *dump_dir_name, unsigned timeout_sec, const char
/* Limit bt depth. With no limit, gdb sometimes OOMs the machine */
unsigned bt_depth = 1024;
const char *thread_apply_all = "thread apply all -ascending";
- const char *full = " full";
+ const char *full = "full ";
char *bt = NULL;
while (1)
{
- args[bt_cmd_index] = xasprintf("%s backtrace %u%s", thread_apply_all, bt_depth, full);
+ args[bt_cmd_index] = xasprintf("%s backtrace %s%u", thread_apply_all, full, bt_depth);
bt = exec_vp(args, /*redirect_stderr:*/ 1, timeout_sec, NULL);
free(args[bt_cmd_index]);
if ((bt && strnlen(bt, 256*1024) < 256*1024) || bt_depth <= 32)
--
2.17.2

View File

@ -0,0 +1,60 @@
From d5c53fefd25ef90ece1d3481c9af1552d458eb97 Mon Sep 17 00:00:00 2001
From: Martin Kutlak <mkutlak@redhat.com>
Date: Tue, 25 Sep 2018 13:28:24 +0200
Subject: [PATCH] dbus: Add configuration for Python3
abrt-dbus misses a configuration file for Python3 and it instead includes Python2 configuration.
Related: #1652676
Signed-off-by: Martin Kutlak <mkutlak@redhat.com>
---
doc/dbus-configuration/Makefile.am | 11 ++++++++++-
.../com.redhat.problems.configuration.python3.xml.in | 11 +++++++++++
3 files changed, 26 insertions(+), 1 deletion(-)
create mode 100644 doc/dbus-configuration/com.redhat.problems.configuration.python3.xml.in
diff --git a/doc/dbus-configuration/Makefile.am b/doc/dbus-configuration/Makefile.am
index 889713943..a02706de9 100644
--- a/doc/dbus-configuration/Makefile.am
+++ b/doc/dbus-configuration/Makefile.am
@@ -9,9 +9,18 @@ dist_dbusabrtinterfaces_DATA = \
com.redhat.problems.configuration.abrt.xml \
com.redhat.problems.configuration.ccpp.xml \
com.redhat.problems.configuration.oops.xml \
- com.redhat.problems.configuration.python.xml \
com.redhat.problems.configuration.xorg.xml
+if BUILD_PYTHON2
+dist_dbusabrtinterfaces_DATA += \
+ com.redhat.problems.configuration.python.xml
+endif
+
+if BUILD_PYTHON3
+dist_dbusabrtinterfaces_DATA += \
+ com.redhat.problems.configuration.python3.xml
+endif
+
if BUILD_ADDON_VMCORE
dist_dbusabrtinterfaces_DATA += \
com.redhat.problems.configuration.vmcore.xml
diff --git a/doc/dbus-configuration/com.redhat.problems.configuration.python3.xml.in b/doc/dbus-configuration/com.redhat.problems.configuration.python3.xml.in
new file mode 100644
index 000000000..68b6760b2
--- /dev/null
+++ b/doc/dbus-configuration/com.redhat.problems.configuration.python3.xml.in
@@ -0,0 +1,11 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+
+<node name="/com/redhat/problems/configuration/python3">
+ <annotation name="com.redhat.problems.ConfFile" value="/etc/abrt/plugins/python3.conf" />
+ <annotation name="com.redhat.problems.DefaultConfFile" value="/usr/share/abrt/conf.d/plugins/python3.conf" />
+
+ <interface name="com.redhat.problems.configuration.python3">
+ <property name="RequireAbsolutePath" type="b" access="readwrite" />
+ </interface>
+</node>
--
2.17.2

View File

@ -0,0 +1,62 @@
From b2ec373cfec2dd6a39acfd91ea1a67618ee209ac Mon Sep 17 00:00:00 2001
From: Martin Kutlak <mkutlak@redhat.com>
Date: Tue, 20 Nov 2018 19:03:55 +0100
Subject: [PATCH] daemon: Fix double closed fd race condition
When a communication channel is set up between abrtd and abrt-server it uses
abrt_gio_channel_unix_new(). In that function there is a call g_io_channel_set_close_on_unref() [1].
This function sets whether to close a file/socket/whatever associated with the channel when channel
recieves a final unref and is to be destroyed.
Calling a close() on fd associated with the channel before/after g_io_channel_unref()
created a double close() race condition when ABRT was processing a lot of crashes at the same time.
Thank you benzea for the patch.
Related BZ#1650622
1 - https://developer.gnome.org/glib/stable/glib-IO-Channels.html#g-io-channel-get-close-on-unref
Signed-off-by: Martin Kutlak <mkutlak@redhat.com>
---
src/daemon/abrt-server.c | 1 -
src/daemon/abrtd.c | 4 +---
2 files changed, 1 insertion(+), 4 deletions(-)
diff --git a/src/daemon/abrt-server.c b/src/daemon/abrt-server.c
index 692ccee38..90068069d 100644
--- a/src/daemon/abrt-server.c
+++ b/src/daemon/abrt-server.c
@@ -364,7 +364,6 @@ static int run_post_create(const char *dirname, struct response *resp)
g_main_loop_unref(context.main_loop);
g_io_channel_unref(channel_signal);
close(g_signal_pipe[1]);
- close(g_signal_pipe[0]);
log_notice("Waiting finished");
diff --git a/src/daemon/abrtd.c b/src/daemon/abrtd.c
index 32753966b..fefb2e9c9 100644
--- a/src/daemon/abrtd.c
+++ b/src/daemon/abrtd.c
@@ -114,7 +114,6 @@ static void stop_abrt_server(struct abrt_server_proc *proc)
static void dispose_abrt_server(struct abrt_server_proc *proc)
{
- close(proc->fdout);
free(proc->dirname);
if (proc->watch_id > 0)
@@ -231,8 +230,7 @@ static gboolean abrt_server_output_cb(GIOChannel *channel, GIOCondition conditio
GList *item = g_list_find_custom(s_processes, &fdout, (GCompareFunc)abrt_server_compare_fdout);
if (item == NULL)
{
- log_warning("Closing a pipe fd (%d) without a process assigned", fdout);
- close(fdout);
+ log_warning("Removing an input channel fd (%d) without a process assigned", fdout);
return FALSE;
}
--
2.17.2

View File

@ -0,0 +1,116 @@
From 16b6963ef5e37805d2587684f90d2c6d5dd4ffdc Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Thu, 6 Dec 2018 17:57:59 +0100
Subject: [PATCH] cli list: show a hint about creating a case in RHTS
Adds "Run 'abrt-cli report ...' for creating a case in Red Hat Customer Portal" to
abrt-cli list output.
Resolves: #1649753
(cherry-picked from 7966e5737e8d3af43b1ecdd6a823234b8d25931d)
Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
configure.ac | 2 ++
src/cli/Makefile.am | 3 ++-
src/cli/list.c | 49 +++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 53 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 76e0f274b..5d70bb9a8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -246,6 +246,7 @@ DEFAULT_PLUGINS_CONF_DIR='${datadir}/${PACKAGE_NAME}/conf.d/plugins'
EVENTS_DIR='${datadir}/libreport/events'
EVENTS_CONF_DIR='${sysconfdir}/libreport/events.d'
JOURNAL_CATALOG_DIR='$(prefix)/lib/systemd/catalog'
+WORKFLOWS_DIR='${datadir}/libreport/workflows'
ENABLE_SOCKET_OR_DBUS='-DENABLE_DBUS=1'
DEFAULT_DUMP_LOCATION_MODE=0751
DEFAULT_DUMP_DIR_MODE=$($PKG_CONFIG --variable=dd_mode libreport)
@@ -389,6 +390,7 @@ AC_SUBST(PLUGINS_CONF_DIR)
AC_SUBST(DEFAULT_PLUGINS_CONF_DIR)
AC_SUBST(EVENTS_CONF_DIR)
AC_SUBST(JOURNAL_CATALOG_DIR)
+AC_SUBST(WORKFLOWS_DIR)
AC_SUBST(EVENTS_DIR)
AC_SUBST(DEFAULT_DUMP_LOCATION)
AC_SUBST(DEFAULT_DUMP_LOCATION_MODE)
diff --git a/src/cli/Makefile.am b/src/cli/Makefile.am
index 92dc20ab4..a7c76efa3 100644
--- a/src/cli/Makefile.am
+++ b/src/cli/Makefile.am
@@ -17,7 +17,8 @@ abrt_cli_CFLAGS = \
-I$(srcdir)/../include \
-I$(srcdir)/../lib \
$(LIBREPORT_CFLAGS) \
- $(POLKIT_AGENT_CFLAGS)
+ $(POLKIT_AGENT_CFLAGS) \
+ -DWORKFLOWS_DIR=\"${WORKFLOWS_DIR}\"
if SUGGEST_AUTOREPORTING
abrt_cli_CFLAGS += -DSUGGEST_AUTOREPORTING=1
diff --git a/src/cli/list.c b/src/cli/list.c
index d069695c6..2c140cb38 100644
--- a/src/cli/list.c
+++ b/src/cli/list.c
@@ -77,6 +77,55 @@ static void print_crash(problem_data_t *problem_data, int detailed, int text_siz
/*names_to_skip:*/ NULL,
/*max_text_size:*/ text_size,
MAKEDESC_SHOW_ONLY_LIST | MAKEDESC_SHOW_URLS);
+
+ /*
+ * If the problem is reportable and has not yet been reported into RHTS
+ * and there is at least one applicable Workflow which contains
+ * 'report_RHTSupport' event, then append a short message informing
+ * user that he can create a new case in Red Hat Customer Portal.
+ */
+ const char *const not_reportable = problem_data_get_content_or_NULL(problem_data, FILENAME_NOT_REPORTABLE);
+ const char *const reported_to = not_reportable ? NULL : problem_data_get_content_or_NULL(problem_data, FILENAME_REPORTED_TO);
+ report_result_t *const report = !reported_to ? NULL : find_in_reported_to_data(reported_to, "RHTSupport");
+
+ if (!not_reportable && !report)
+ {
+ /* The lines below should be replaced by something simpler, I'd
+ * like to see:
+ * GHashTable *possible_worfklows = load_applicable_workflows_for_dump();
+ *
+ * However, this feature (rhbz#1055565) is intended for RHEL only
+ * and I'm not sure whether it's worth to file another bug against
+ * libreport and try to improve libreport public API.
+ */
+ const char *const dump_dir_name = problem_data_get_content_or_NULL(problem_data, CD_DUMPDIR);
+ GList *const wf_names = list_possible_events_glist(dump_dir_name, "workflow");
+ GHashTable *const possible_workflows = load_workflow_config_data_from_list(wf_names, WORKFLOWS_DIR);
+ g_list_free_full(wf_names, free);
+
+ int event_found = 0;
+
+ GHashTableIter iter;
+ gpointer key = NULL;
+ gpointer value = NULL;
+
+ g_hash_table_iter_init(&iter, possible_workflows);
+ while (!event_found && g_hash_table_iter_next(&iter, &key, &value))
+ {
+ GList *const event_names = wf_get_event_names((workflow_t *)value);
+ event_found = !!g_list_find_custom(event_names, "report_RHTSupport", (GCompareFunc)g_strcmp0);
+ g_list_free_full(event_names, free);
+ }
+
+ g_hash_table_destroy(possible_workflows);
+
+ if (event_found)
+ {
+ char *tmp = xasprintf("%sRun 'abrt-cli report %s' for creating a case in Red Hat Customer Portal\n", desc, dump_dir_name);
+ free(desc);
+ desc = tmp;
+ }
+ }
}
fputs(desc, stdout);
free(desc);
--
2.17.2

View File

@ -0,0 +1,28 @@
From c0aa44a93bfdc701839d2c70568224521a6d5c5b Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Thu, 6 Dec 2018 18:00:45 +0100
Subject: [PATCH] cli: mark the suggestion text for translation
(cherry-picked from 187530c4df6971927d1e099584be5b418ab2725b)
Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/cli/list.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/cli/list.c b/src/cli/list.c
index 2c140cb38..f16ce8c0d 100644
--- a/src/cli/list.c
+++ b/src/cli/list.c
@@ -121,7 +121,7 @@ static void print_crash(problem_data_t *problem_data, int detailed, int text_siz
if (event_found)
{
- char *tmp = xasprintf("%sRun 'abrt-cli report %s' for creating a case in Red Hat Customer Portal\n", desc, dump_dir_name);
+ char *tmp = xasprintf(_("%sRun 'abrt-cli report %s' for creating a case in Red Hat Customer Portal\n"), desc, dump_dir_name);
free(desc);
desc = tmp;
}
--
2.17.2

View File

@ -0,0 +1,31 @@
From 58dcdd2f2780263e79a82ecebb27b000b0583979 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Thu, 6 Dec 2018 18:01:13 +0100
Subject: [PATCH] cli: get list of possible workflows for problem_data_t
File system access is not possible, so we have to rely on the data
transfered via D-Bus.
(cherry-picked from f2055f8c6469b590172d94e9ea530243af89f028)
Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/cli/list.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/cli/list.c b/src/cli/list.c
index f16ce8c0d..e688d2f49 100644
--- a/src/cli/list.c
+++ b/src/cli/list.c
@@ -99,7 +99,7 @@ static void print_crash(problem_data_t *problem_data, int detailed, int text_siz
* libreport and try to improve libreport public API.
*/
const char *const dump_dir_name = problem_data_get_content_or_NULL(problem_data, CD_DUMPDIR);
- GList *const wf_names = list_possible_events_glist(dump_dir_name, "workflow");
+ GList *const wf_names = list_possible_events_problem_data_glist(problem_data, dump_dir_name, "workflow");
GHashTable *const possible_workflows = load_workflow_config_data_from_list(wf_names, WORKFLOWS_DIR);
g_list_free_full(wf_names, free);
--
2.17.2

View File

@ -0,0 +1,57 @@
From f6e07167e8769219471b10a3c20fa64ada8ce61f Mon Sep 17 00:00:00 2001
From: Martin Kutlak <mkutlak@redhat.com>
Date: Fri, 12 Jul 2019 17:46:48 +0200
Subject: [PATCH] a-a-list-dsos: Fix decoding of strings from rpm
rpm used to return bytes but that was changed to return strings in recent release.
Related: rhbz#1693751
Resolves: rhbz#1694970
Signed-off-by: Martin Kutlak <mkutlak@redhat.com>
---
abrt.spec.in | 1 +
src/plugins/abrt-action-list-dsos | 13 ++++++-------
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/abrt.spec.in b/abrt.spec.in
index 03f1a67d..b9c9d5f1 100644
--- a/abrt.spec.in
+++ b/abrt.spec.in
@@ -233,6 +233,7 @@ Requires: python2-libreport
%if %{with python3}
Requires: python3-libreport
%endif # with python3
+Requires: rpm >= 4.14.2-11
%description addon-ccpp
This package contains %{name}'s C/C++ analyzer plugin.
diff --git a/src/plugins/abrt-action-list-dsos b/src/plugins/abrt-action-list-dsos
index adb228a4..8bf5415e 100644
--- a/src/plugins/abrt-action-list-dsos
+++ b/src/plugins/abrt-action-list-dsos
@@ -84,15 +84,14 @@ if __name__ == "__main__":
outname = None
vendor = h[rpm.RPMTAG_VENDOR]
- if vendor != None:
- vendor = vendor.decode('utf-8')
+ rpmtag_nevra = h[rpm.RPMTAG_NEVRA]
outfile.write("%s %s (%s) %s\n" %
- (path,
- h[rpm.RPMTAG_NEVRA].decode('utf-8'),
- vendor,
- h[rpm.RPMTAG_INSTALLTIME])
- )
+ (path,
+ rpmtag_nevra,
+ vendor,
+ h[rpm.RPMTAG_INSTALLTIME])
+ )
except Exception as ex:
error_msg_and_die("Can't get the DSO list: %s" % ex)
--
2.21.0

View File

@ -0,0 +1,118 @@
From caf03304c98dc84086b2f4f60be4b41fc76f31e6 Mon Sep 17 00:00:00 2001
From: Martin Kutlak <mkutlak@redhat.com>
Date: Wed, 4 Mar 2020 16:41:28 +0100
Subject: [PATCH] a-a-save-package-data: Use regexps to match interpreters
Instead of adding more and more interpreters to the list which
gets outdated after a while, we can utilize regular expressions.
User will still have an option to set Interpreters in config file to
match any other interpreters.
The regexes should cover interpreters:
Python:
* python
* python2
* python2.7
* python3
* python3.8
* platform-python
* platform-python3
* platform-python3.8
Perl:
* perl
* perl5.30.1
PHP:
* php
* php-cgi
R
retrace.fedoraproject.org/faf/reports/2832480
tcl
retrace.fedoraproject.org/faf/reports/2555398
The regexes should cover interpreters:
R:
* R
tcl:
* tclsh
* tclsh8.6
Tests require will-crash and perl-interpreter installed.
Resolves: rhbz#1798494
Signed-off-by: Martin Kutlak <mkutlak@redhat.com>
---
src/daemon/abrt-action-save-package-data.c | 39 ++++++++-
1 files change, 38 insertions(+), 1 deletions(-)
diff --git a/src/daemon/abrt-action-save-package-data.c b/src/daemon/abrt-action-save-package-data.c
index 21b4c97d..6ced7971 100644
--- a/src/daemon/abrt-action-save-package-data.c
+++ b/src/daemon/abrt-action-save-package-data.c
@@ -17,11 +17,47 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <fnmatch.h>
+#include <glib.h>
#include "libabrt.h"
#include "rpm.h"
#define GPG_CONF "gpg_keys.conf"
+/**
+ "python3.4, python3.5, python3.6, python3.7, perl, perl5.16.2"
+ * The regexes should cover interpreters with basename:
+ * Python:
+ * python
+ * python2
+ * python3
+ * python2.7
+ * python3.8
+ * platform-python
+ * platform-python3
+ * platform-python3.8
+ *
+ * Perl:
+ * perl
+ * perl5.30.1
+ *
+ * PHP:
+ * php
+ * php-cgi
+ *
+ * R:
+ * R
+ *
+ * tcl:
+ * tclsh
+ * tclsh8.6
+ **/
+#define DEFAULT_INTERPRETERS_REGEX \
+ "^(perl ([[:digit:]][.][[:digit:]]+[.][[:digit:]])? |" \
+ "php (-cgi)? |" \
+ "(platform-)? python ([[:digit:]]([.][[:digit:]])?)? |" \
+ "R |" \
+ "tclsh ([[:digit:]][.][[:digit:]])?)$"
+
static bool settings_bOpenGPGCheck = false;
static GList *settings_setOpenGPGPublicKeys = NULL;
static GList *settings_setBlackListedPkgs = NULL;
@@ -304,7 +340,8 @@ static int SavePackageDescriptionToDebugDump(const char *dump_dir_name, const ch
/* if basename is known interpreter, we want to blame the running script
* not the interpreter
*/
- if (g_list_find_custom(settings_Interpreters, basename, (GCompareFunc)g_strcmp0))
+ if (g_regex_match_simple(DEFAULT_INTERPRETERS_REGEX, basename, G_REGEX_EXTENDED, /*MatchFlags*/0) ||
+ g_list_find_custom(settings_Interpreters, basename, (GCompareFunc)g_strcmp0))
{
struct pkg_envra *script_pkg = get_script_name(cmdline, &executable, chroot);
/* executable may have changed, check it again */
--
2.25.1

View File

@ -0,0 +1,42 @@
From 11869ec9290a32c028d9d2741a7466206b635f59 Mon Sep 17 00:00:00 2001
From: Jake Daryll Obina <jake.obina@gmail.com>
Date: Mon, 25 Jun 2018 11:52:11 +0800
Subject: [PATCH] harvest_vmcore: Fix missing argument error during
delete_and_close()
delete_and_close() requires a directory name argument and it is being called
without one. This argument is really not necessary though since the directory
name is already saved in the directory object (can be queried via the directory
object's name attribute), and it is the saved directory that is always deleted
regardless of the argument passed in.
Signed-off-by: Jake Daryll Obina <jake.obina@gmail.com>
---
src/hooks/abrt_harvest_vmcore.py.in | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/hooks/abrt_harvest_vmcore.py.in b/src/hooks/abrt_harvest_vmcore.py.in
index 7d4bba52..66c3ad37 100644
--- a/src/hooks/abrt_harvest_vmcore.py.in
+++ b/src/hooks/abrt_harvest_vmcore.py.in
@@ -128,13 +128,15 @@ def create_abrtd_info(dest, uuid):
return dd
-def delete_and_close(dd, dd_dirname):
+def delete_and_close(dd):
"""
Deletes the given dump directory and closes it.
dd - dump directory object
- dd_dirname - full path to dump directory
"""
+ # Save the directory name as the directory object could be destroyed during
+ # delete().
+ dd_dirname = dd.name
if not dd.delete() == 0:
sys.stderr.write("Unable to delete '%s'\n" % (dd_dirname))
return
--
2.25.1

View File

@ -0,0 +1,26 @@
From 445e68861693be83023e93de072cf04caf833e57 Mon Sep 17 00:00:00 2001
From: Martin Kutlak <mkutlak@redhat.com>
Date: Wed, 12 Dec 2018 16:07:33 +0100
Subject: [PATCH] cli: Add a shebang
Fixes a ShellCheck warning SC2148.
error: Tips depend on target shell and yours is unknown. Add a shebang.
Signed-off-by: Martin Kutlak <mkutlak@redhat.com>
---
src/cli/abrt-console-notification.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/cli/abrt-console-notification.sh b/src/cli/abrt-console-notification.sh
index f1a79ffb..cd69eb38 100755
--- a/src/cli/abrt-console-notification.sh
+++ b/src/cli/abrt-console-notification.sh
@@ -1,3 +1,4 @@
+#!/bin/sh
# If shell is not connect to a terminal, return immediately, because this script
# should print out ABRT's status and it is senseless to continue without
# terminal.
--
2.26.2

View File

@ -0,0 +1,47 @@
From 9edffdf1a4be9a2983cb69f1ebff81c805cde72f Mon Sep 17 00:00:00 2001
From: Martin Kutlak <mkutlak@redhat.com>
Date: Wed, 12 Dec 2018 16:09:59 +0100
Subject: [PATCH] shellcheck: Use $(...) instead of legacy backticked
Fixes ShellCheck warning SC2006.
Signed-off-by: Martin Kutlak <mkutlak@redhat.com>
---
src/cli/abrt-console-notification.sh | 4 ++--
src/plugins/abrt-action-analyze-ccpp-local.in | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/cli/abrt-console-notification.sh b/src/cli/abrt-console-notification.sh
index cd69eb38..c245677b 100755
--- a/src/cli/abrt-console-notification.sh
+++ b/src/cli/abrt-console-notification.sh
@@ -26,11 +26,11 @@ if [ ! -f "$LPATHDIR" ]; then
mkdir -p "$LPATHDIR" >"$ABRT_DEBUG_LOG" 2>&1 || return 0
fi
-TMPPATH=`mktemp --tmpdir="$LPATHDIR" lastnotification.XXXXXXXX 2> "$ABRT_DEBUG_LOG"`
+TMPPATH=$(mktemp --tmpdir="$LPATHDIR" lastnotification.XXXXXXXX 2> "$ABRT_DEBUG_LOG")
SINCE=0
if [ -f "$SINCEFILE" ]; then
- SINCE=`cat $SINCEFILE 2>"$ABRT_DEBUG_LOG"`
+ SINCE=$(cat "$SINCEFILE" 2>"$ABRT_DEBUG_LOG")
fi
# always update the lastnotification
diff --git a/src/plugins/abrt-action-analyze-ccpp-local.in b/src/plugins/abrt-action-analyze-ccpp-local.in
index 6691c59b..92593437 100644
--- a/src/plugins/abrt-action-analyze-ccpp-local.in
+++ b/src/plugins/abrt-action-analyze-ccpp-local.in
@@ -15,7 +15,7 @@ if $INSTALL_DI; then
# debuginfo install fail even for root.
# Therefore, if we are root, we don't use the wrapper.
EXECUTABLE=@LIBEXEC_DIR@/abrt-action-install-debuginfo-to-abrt-cache
- if [ x"`id -u`" = x"0" ]; then
+ if [ x"$(id -u)" = x"0" ]; then
EXECUTABLE=abrt-action-install-debuginfo
fi
--
2.26.2

View File

@ -0,0 +1,35 @@
From dad230792b046c711f4e491cfdbabda58862ee78 Mon Sep 17 00:00:00 2001
From: Martin Kutlak <mkutlak@redhat.com>
Date: Wed, 12 Dec 2018 16:12:23 +0100
Subject: [PATCH] shellcheck: Suppress shellcheck warning SC1090
ShellCheck is not able to include sourced files from paths that are determined at runtime.
The file will not be read, potentially resulting in warnings about unassigned variables and similar.
If you don't care that ShellCheck is unable to account for the file, specify
"# shellcheck source=/dev/null".
Signed-off-by: Martin Kutlak <mkutlak@redhat.com>
---
src/plugins/abrt-action-analyze-ccpp-local.in | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/plugins/abrt-action-analyze-ccpp-local.in b/src/plugins/abrt-action-analyze-ccpp-local.in
index 92593437..9144c0e6 100644
--- a/src/plugins/abrt-action-analyze-ccpp-local.in
+++ b/src/plugins/abrt-action-analyze-ccpp-local.in
@@ -26,8 +26,9 @@ if $INSTALL_DI; then
EXTRA_ARGS=
for osrel in "${DUMP_DIR:-.}/os_info_in_rootdir" "${DUMP_DIR:-.}/os_info"
do
- if [ -e $osrel ]; then
- . $osrel
+ if [ -e "$osrel" ]; then
+ # shellcheck source=/dev/null
+ . "$osrel"
if [ -n "$VERSION_ID" ]; then
EXTRA_ARGS="--releasever=$VERSION_ID"
break
--
2.26.2

View File

@ -0,0 +1,34 @@
From 58d1e4fa0a0f6fc2fc3ee773665de70a073ae759 Mon Sep 17 00:00:00 2001
From: Martin Kutlak <mkutlak@redhat.com>
Date: Wed, 12 Dec 2018 16:16:55 +0100
Subject: [PATCH] shellcheck: Check exit code directly with if mycmd
Running a command and then checking its exit status $? against 0 is redundant.
Fixes ShellCheck warning SC2181.
Signed-off-by: Martin Kutlak <mkutlak@redhat.com>
---
src/plugins/abrt-action-analyze-ccpp-local.in | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/plugins/abrt-action-analyze-ccpp-local.in b/src/plugins/abrt-action-analyze-ccpp-local.in
index 9144c0e6..d2453c19 100644
--- a/src/plugins/abrt-action-analyze-ccpp-local.in
+++ b/src/plugins/abrt-action-analyze-ccpp-local.in
@@ -36,9 +36,7 @@ if $INSTALL_DI; then
fi
done
- ${EXECUTABLE} ${EXTRA_ARGS} --size_mb=4096
-fi
-
-if [ $? = 0 ]; then
- abrt-action-generate-backtrace && abrt-action-analyze-backtrace
+ if ${EXECUTABLE} "${EXTRA_ARGS}" --size_mb=4096; then
+ abrt-action-generate-backtrace && abrt-action-analyze-backtrace
+ fi
fi
--
2.26.2

View File

@ -1 +0,0 @@
abrt package is retired on branch c10s for CS-2551

View File

@ -1,7 +0,0 @@
--- !Policy
product_versions:
- rhel-8
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}
- !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier1.functional}

View File

@ -1 +0,0 @@
SHA512 (abrt-2.10.9.tar.gz) = aff498ba52402593a853bb1e6d20c2c97137a5643d4f346a4568849d2fb5f3bb231e2c9f5c1f9742e3bb14de18de415ceede080fa089f8aa93955868bb6d5ad0

View File

@ -1,62 +0,0 @@
#!/bin/bash
function check_prior_crashes() {
rlAssert0 "No prior crashes recorded" $(abrt-cli list 2> /dev/null | wc -l)
if [ ! "_$(abrt-cli list 2> /dev/null | wc -l)" == "_0" ]; then
abrt-cli list
rlDie "Won't proceed"
fi
}
function create_custom_event() {
rlLog "Creating custom test event"
cat > /etc/libreport/events.d/test_event.conf << _EOF_
EVENT=notify
echo "ABRT tests - EVENT=notify - $DUMP_DIR"
touch /tmp/abrt-done
true
EVENT=notify-dup
echo "ABRT tests - EVENT=notify-dup - $DUMP_DIR"
touch /tmp/abrt-done
true
_EOF_
}
function remove_custom_event() {
rlLog "Removing custom test event"
rm -f /etc/libreport/events.d/test_event.conf
rm -f /tmp/abrt-done
}
function wait_for_hooks() {
rlLog "Waiting for all hooks to end"
# Wait at least 1 second
sleep 1
local c=0
while [ ! -f "/tmp/abrt-done" ]; do
sleep 0.1
let c=$c+1
if [ $c -gt 3000 ]; then
rlFail "Timeout"
break
fi
done
t=$( echo "scale=2; ($c/10)+1" | bc )
rlLog "Hooks ended in $t seconds"
}
function get_crash_path() {
rlLog "Get crash path"
rlAssertGreater "Crash recorded" $(abrt-cli list 2> /dev/null | wc -l) 0
crash_PATH="$(abrt-cli list 2> /dev/null | grep Directory | awk '{ print $2 }' | tail -n1)"
if [ ! -d "$crash_PATH" ]; then
echo "Dump location listing:"
ls -l $ABRT_CONF_DUMP_LOCATION
echo "abrt-cli list:"
abrt-cli list
echo "Syslog:"
print_syslog 10
rlFail "No crash dir generated, this shouldn't happen"
fi
rlLog "PATH = $crash_PATH"
}

View File

@ -1,63 +0,0 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/abrt/Sanity/cli-ng-sanity
# Description: Test basic abrt-cli-ng funcionality
# Author: Martin Kutlak <mkutlak@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2013 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/CoreOS/abrt/Sanity/cli-ng-sanity
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
test -x runtest.sh || chmod a+x runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Martin Kutlak <mkutlak@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Test basic abrt-cli-ng funcionality" >> $(METADATA)
@echo "Type: Sanity" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: abrt" >> $(METADATA)
@echo "Requires: abrt abrt-cli-ng coreutils libreport-plugin-logger" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
rhts-lint $(METADATA)

View File

@ -1,3 +0,0 @@
PURPOSE of cli-ng-sanity
Description: does sanity on abrt-cli-ng
Author: Richard Marko <rmarko@redhat.com>

View File

@ -1,138 +0,0 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of cli-ng-sanity
# Description: does sanity on abrt-cli-ng
# Author: Richard Marko <rmarko@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2015 Red Hat, Inc. All rights reserved.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
. /usr/share/beakerlib/beakerlib.sh
. ../aux/lib.sh
TEST="cli-ng-sanity"
PACKAGE="abrt"
rlJournalStart
rlPhaseStartSetup
LANG=""
export LANG
# Since we send SIGSEGV to sleep(1) and coreutils will be unsigned.
rlRun "augtool set /files/etc/abrt/abrt-action-save-package-data.conf/OpenGPGCheck no" 0
check_prior_crashes
create_custom_event
rlServiceStart abrtd abrt-journal-core
TmpDir=$(mktemp -d)
pushd $TmpDir
rlPhaseEnd
rlPhaseStartTest "--version"
rlRun "abrt -v 2>&1 | grep 'abrt'"
rlRun "abrt --version 2>&1 | grep 'abrt'"
rlPhaseEnd
rlPhaseStartTest "--help"
rlRun "abrt --help" 0
rlRun "abrt --help 2>&1 | grep 'usage: abrt'"
rlPhaseEnd
rlPhaseStartTest "list"
timeout --signal=SEGV 1 sleep 10
wait_for_hooks
get_crash_path
rlRun "abrt list | grep -i 'Id'"
rlRun "abrt list | grep -i 'Component'"
rlRun "abrt list --pretty full | grep -i 'Command line'"
rlPhaseEnd
rlPhaseStartTest "list -n" # list not-reported
rlRun "abrt list -n | grep -i 'Id'"
rlRun "abrt list -n | grep -i 'Component'"
rlPhaseEnd
rlPhaseStartTest "status"
rlRun "abrt status | grep 'has detected 1 problem'"
rlPhaseEnd
rlPhaseStartTest "report NONEXISTENT"
rlRun "abrt report NONEXISTENT" 1
rlPhaseEnd
rlPhaseStartTest "report not-reportable"
rlRun "touch $crash_PATH/not-reportable"
cp $crash_PATH/{type,analyzer} ./
echo "cli_sanity_test_not_reportable" > $crash_PATH/type
echo "cli_sanity_test_not_reportable" > $crash_PATH/analyzer
PROBLEM_ID=$(abrt list --fmt {short_id})
rlRun "abrt report 2>&1 | tee abrt-cli-report-not-reportable.log" 0
rlAssertGrep "Problem '$PROBLEM_ID' cannot be reported" abrt-cli-report-not-reportable.log
cp -f type analyzer $crash_PATH
rlRun "rm -f $crash_PATH/not-reportable"
rlPhaseEnd
rlPhaseStartTest "info DIR"
rlRun "abrt info"
rlRun "abrt info --pretty email > info.out"
rlPhaseEnd
rlPhaseStartTest "list (after reporting)"
DIR=$( abrt list --pretty full | grep 'Path' | head -n1 | awk '{ print $2 }' )
# this should ensure that ABRT will consider the problem as reported
rlRun "reporter-print -r -d $DIR -o /dev/null"
# this expects that reporter-print works and adds an URL to
# the output file to the problem's data
rlRun "abrt list | grep -i 'file:///dev/null'"
rlPhaseEnd
rlPhaseStartTest "list -n (after reporting)" # list not-reported
rlRun "abrt list -n | grep 'No problems'"
rlPhaseEnd
rlPhaseStartTest "info NONEXISTENT"
rlRun "abrt info NONEXISTENT" 1
rlPhaseEnd
rlPhaseStartTest "remove NONEXISTENT"
rlRun "abrt remove NONEXISTENT" 1
rlPhaseEnd
rlPhaseStartTest "remove DIR"
rlRun "abrt remove -f"
rlPhaseEnd
rlPhaseStartCleanup
remove_custom_event
popd # TmpDir
rm -rf $TmpDir
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View File

@ -1,63 +0,0 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/abrt/Sanity/cli-sanity
# Description: Test basic abrt-cli funcionality
# Author: Martin Kutlak <mkutlak@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2013 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/CoreOS/abrt/Sanity/cli-sanity
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
test -x runtest.sh || chmod a+x runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Martin Kutlak <mkutlak@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Test basic abrt-cli funcionality" >> $(METADATA)
@echo "Type: Sanity" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: abrt" >> $(METADATA)
@echo "Requires: abrt abrt-cli coreutils" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
rhts-lint $(METADATA)

View File

@ -1,3 +0,0 @@
PURPOSE of cli-sanity
Description: does sanity on abrt-cli
Author: Michal Nowak <mnowak@redhat.com>

View File

@ -1,210 +0,0 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of cli-sanity
# Description: does sanity on report-cli
# Author: Michal Nowak <mnowak@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2011 Red Hat, Inc. All rights reserved.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
. /usr/share/beakerlib/beakerlib.sh
. ../aux/lib.sh
TEST="cli-sanity"
PACKAGE="abrt"
rlJournalStart
rlPhaseStartSetup
LANG=""
export LANG
# Since we send SIGSEGV to sleep(1) and coreutils will be unsigned.
rlRun "augtool set /files/etc/abrt/abrt-action-save-package-data.conf/OpenGPGCheck no" 0
check_prior_crashes
create_custom_event
rlServiceStart abrtd abrt-journal-core
TmpDir=$(mktemp -d)
pushd $TmpDir
rlPhaseEnd
rlPhaseStartTest "--version"
rlRun "abrt-cli --version | grep 'abrt-cli'"
# rlAssertEquals "abrt-cli and abrt-cli RPM claim the same version" "$(abrt-cli -V | awk '{ print $2 }')" "$(rpmquery --qf='%{VERSION}' abrt-cli)"
rlPhaseEnd
rlPhaseStartTest "--help"
rlRun "abrt-cli --help" 0
rlRun "abrt-cli --help 2>&1 | grep 'Usage: abrt-cli'"
rlPhaseEnd
rlPhaseStartTest "list the same as ls"
abrt-cli list &> param_cmd
abrt-cli ls &> param_abbrev
rlAssertNotDiffer param_cmd param_abbrev
rlPhaseEnd
rlPhaseStartTest "remove the same as rm"
abrt-cli remove &> param_cmd
abrt-cli rm &> param_abbrev
rlAssertNotDiffer param_cmd param_abbrev
rlPhaseEnd
rlPhaseStartTest "report the same as e"
abrt-cli report &> param_cmd
abrt-cli e &> param_abbrev
rlAssertNotDiffer param_cmd param_abbrev
rlPhaseEnd
rlPhaseStartTest "info the same as i"
abrt-cli info &> param_cmd
abrt-cli i &> param_abbrev
rlAssertNotDiffer param_cmd param_abbrev
rlPhaseEnd
rlPhaseStartTest "status the same as st"
abrt-cli status &> param_cmd
abrt-cli st &> param_abbrev
rlAssertNotDiffer param_cmd param_abbrev
rlPhaseEnd
rlPhaseStartTest "process the same as p"
abrt-cli process &> param_cmd
abrt-cli p &> param_abbrev
rlAssertNotDiffer param_cmd param_abbrev
rlPhaseEnd
rlPhaseStartTest "list"
timeout --signal=SEGV 1 sleep 10
wait_for_hooks
get_crash_path
rlRun "abrt-cli list | grep -i 'cmdline'"
rlRun "abrt-cli list | grep -i 'Package'"
rlPhaseEnd
rlPhaseStartTest "list -n" # list not-reported
rlRun "abrt-cli list -n | grep -i 'cmdline'"
rlRun "abrt-cli list -n | grep -i 'Package'"
rlPhaseEnd
rlPhaseStartTest "report FAKEDIR"
rlRun "abrt-cli report FAKEDIR" 1
rlPhaseEnd
rlPhaseStartTest "report not-reportable"
rlRun "touch $crash_PATH/not-reportable"
cp $crash_PATH/{type,analyzer} ./
echo "cli_sanity_test_not_reportable" > $crash_PATH/type
echo "cli_sanity_test_not_reportable" > $crash_PATH/analyzer
rlRun "abrt-cli report $crash_PATH 2>&1 | tee abrt-cli-report-not-reportable.log" 0
rlAssertGrep "Problem '$crash_PATH' cannot be reported" abrt-cli-report-not-reportable.log
cp -f type analyzer $crash_PATH
rlRun "rm -f $crash_PATH/not-reportable"
rlPhaseEnd
rlPhaseStartTest "report not-reportable --unsafe parameter"
rlRun "touch $crash_PATH/not-reportable"
cp $crash_PATH/{type,analyzer} ./
echo "cli_sanity_test_not_reportable_unsafe" > $crash_PATH/type
echo "cli_sanity_test_not_reportable_unsafe" > $crash_PATH/analyzer
rlRun "abrt-cli report --unsafe $crash_PATH 2>&1 | tee abrt-cli-report-not-reportable-unsafe.log" 0
rlAssertNotGrep "Problem '$crash_PATH' cannot be reported" abrt-cli-report-not-reportable-unsafe.log
rlAssertGrep "Error: no processing is specified for event 'report-cli'" abrt-cli-report-not-reportable-unsafe.log
cp -f type analyzer $crash_PATH
rlRun "rm -f $crash_PATH/not-reportable"
rlPhaseEnd
# This test used to select 1st analyzer (Local GNU Debugger)
# and run it, then "edit" data with cat (this merely prints data to stdout)
# and terminate. This was far from reliable (what if analyzer would change?).
#
# With the changed CLI, it probably can be emulated by running
# "report-cli -e analyze_LocalGDB $DIR"
# ...except that analyze_LocalGDB has <gui-review-elements>no</gui-review-elements>!
# Need to think about this...
#
#rlPhaseStartTest "report DIR"
# DIR=$(abrt-cli list -n | grep 'Directory' | head -n1 | awk '{ print $2 }')
# echo -e "1\n" | VISUAL="cat" EDITOR="cat" abrt-cli report $DIR > output.out 2>&1
#
# rlAssertGrep "\-cmdline" output.out
# rlAssertGrep "\-kernel" output.out
#rlPhaseEnd
rlPhaseStartTest "info DIR"
DIR=$(abrt-cli list | grep 'Directory' | head -n1 | awk '{ print $2 }')
rlRun "abrt-cli info $DIR"
rlRun "abrt-cli info -d $DIR > info.out"
rlPhaseEnd
rlPhaseStartTest "list (after reporting)"
DIR=$(abrt-cli list | grep 'Directory' | head -n1 | awk '{ print $2 }')
# this should ensure that ABRT will consider the problem as reported
rlRun "reporter-print -r -d $DIR -o /dev/null"
rlRun "abrt-cli list | grep -i 'cmdline'"
rlRun "abrt-cli list | grep -i 'Package'"
# this expects that reporter-print works and adds an URL to
# the output file to the problem's data
rlRun "abrt-cli list | grep -i 'file:///dev/null'"
rlPhaseEnd
rlPhaseStartTest "list -n (after reporting)" # list not-reported
BYTESNUM=$(abrt-cli list -n | wc -c)
rlAssert0 "No not-reported problem" "$BYTESNUM"
rlPhaseEnd
rlPhaseStartTest "info FAKEDIR"
rlRun "abrt-cli info FAKEDIR" 1
rlRun "abrt-cli info -d FAKEDIR" 1
rlPhaseEnd
rlPhaseStartTest "rm FAKEDIR"
rlRun "abrt-cli rm FAKEDIR" 1
rlPhaseEnd
rlPhaseStartTest "rm DIR"
DIR_DELETE=$(abrt-cli list | grep 'Directory' | head -n1 | awk '{ print $2 }')
rlRun "abrt-cli rm $DIR_DELETE"
rlPhaseEnd
rlPhaseStartCleanup
remove_custom_event
popd # TmpDir
rm -rf $TmpDir
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View File

@ -1,16 +0,0 @@
---
# Tests that run in all contexts
- hosts: localhost
become: true
roles:
- role: standard-test-beakerlib
tags:
- classic
tests:
- cli-sanity
- cli-ng-sanity
required_packages:
- augeas # unsetting OpenGPGCheck in the config
- libreport-plugin-logger # cli-ng-sanity requires
- coreutils # tests require sleep, timeout
- bc # bc command in timeout