Discussion:
[ABRT PATCH 1/2] remove abrt-dedup-client; related to #702
Michal Toman
2013-09-12 12:47:34 UTC
Permalink
Signed-off-by: Michal Toman <mtoman-H+wXaHxf7aLQT0dZR+***@public.gmane.org>
---
.gitignore | 1 -
doc/Makefile.am | 1 -
doc/abrt-dedup-client.txt | 52 --------
po/POTFILES.in | 1 -
src/plugins/Makefile.am | 18 +--
src/plugins/abrt-dedup-client.c | 264 ----------------------------------------
src/plugins/ccpp_event.conf | 1 -
7 files changed, 1 insertion(+), 337 deletions(-)
delete mode 100644 doc/abrt-dedup-client.txt
delete mode 100644 src/plugins/abrt-dedup-client.c

diff --git a/.gitignore b/.gitignore
index 9fcbe04..4a5e967 100644
--- a/.gitignore
+++ b/.gitignore
@@ -28,7 +28,6 @@ src/plugins/abrt-action-trim-files
src/plugins/abrt-watch-log
src/plugins/abrt-dump-oops
src/plugins/abrt-dump-xorg
-src/plugins/abrt-dedup-client
src/plugins/abrt-retrace-client
src/plugins/abrt-action-install-debuginfo
src/plugins/abrt-action-generate-core-backtrace
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 74834b0..1ca52b5 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -25,7 +25,6 @@ MAN1_TXT += abrt-harvest-pstoreoops.txt
MAN1_TXT += abrt-harvest-vmcore.txt
MAN1_TXT += abrt-merge-pstoreoops.txt
MAN1_TXT += abrt-server.txt
-MAN1_TXT += abrt-dedup-client.txt
MAN1_TXT += abrt-cli.txt
MAN1_TXT += abrt-action-save-package-data.txt
MAN1_TXT += abrt-action-save-kernel-data.txt
diff --git a/doc/abrt-dedup-client.txt b/doc/abrt-dedup-client.txt
deleted file mode 100644
index b837fcd..0000000
--- a/doc/abrt-dedup-client.txt
+++ /dev/null
@@ -1,52 +0,0 @@
-abrt-dedup-client(1)
-==================
-
-NAME
-----
-abrt-dedup-client - The ABRT dedup server client.
-
-SYNOPSIS
---------
-'abrt-dedup-client' [-vsk] [--url URL] [--port PORT] [-d DIR] [--headers]
-
-DESCRIPTION
------------
-'abrt-dedup-client' is the command-line tool for searching for duplicates.
-
-OPTIONS
--------
--v, --verbose::
- be verbose
-
--s, --syslog::
- log to syslog
-
--k, --insecure::
- allow insecure connection to dedup server
-
---url URL::
- dedup server URL [Default: retrace.fedoraproject.org]
-
---port NUM::
- dedup server port [Default: 443]
-
--d, --dump-dir DIR::
- problem directory [Default: current directory]
-
---headers::
- (debug) show received HTTP headers
-
-ENVIRONMENT
------------
-DEDUP_SERVER_URL::
- dedup server URL
-
-DEDUP_SERVER_PORT::
- dedup server PORT
-
-DEDUP_SERVER_INSECURE::
- Allow insecure connection to dedup server (use 'insecure')
-
-AUTHORS
--------
-* ABRT team
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 817b3fd..bd6c482 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -28,7 +28,6 @@ src/plugins/abrt-action-generate-core-backtrace.c
src/plugins/abrt-action-install-debuginfo.in
src/plugins/abrt-action-perform-ccpp-analysis.in
src/plugins/abrt-action-trim-files.c
-src/plugins/abrt-dedup-client.c
src/plugins/abrt-gdb-exploitable
src/plugins/abrt-watch-log.c
src/plugins/abrt-dump-oops.c
diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am
index c0c0745..44eb2dd 100644
--- a/src/plugins/Makefile.am
+++ b/src/plugins/Makefile.am
@@ -22,8 +22,7 @@ bin_PROGRAMS = \
abrt-action-generate-backtrace \
abrt-action-generate-core-backtrace \
abrt-action-analyze-backtrace \
- abrt-retrace-client \
- abrt-dedup-client
+ abrt-retrace-client

if BUILD_BODHI
bin_PROGRAMS += \
@@ -277,21 +276,6 @@ abrt_retrace_client_SOURCES = \
$(SATYR_LIBS) \
$(NSS_LIBS)

-abrt_dedup_client_SOURCES = \
- abrt-dedup-client.c \
- https-utils.c
- abrt_dedup_client_CFLAGS = \
- -I$(srcdir)/../include \
- -I$(srcdir)/../lib \
- $(NSS_CFLAGS) \
- $(GLIB_CFLAGS) \
- -D_GNU_SOURCE \
- $(LIBREPORT_CFLAGS)
- abrt_dedup_client_LDADD = \
- $(LIBREPORT_LIBS) \
- $(SATYR_LIBS) \
- $(NSS_LIBS)
-
if BUILD_BODHI
abrt_bodhi_SOURCES = \
bodhi.c
diff --git a/src/plugins/abrt-dedup-client.c b/src/plugins/abrt-dedup-client.c
deleted file mode 100644
index 830efda..0000000
--- a/src/plugins/abrt-dedup-client.c
+++ /dev/null
@@ -1,264 +0,0 @@
-/*
- Copyright (C) 2012 ABRT Team
- Copyright (C) 2012 Red Hat, Inc.
-
- 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 2 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, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-*/
-#include <syslog.h>
-#include "https-utils.h"
-
-#define SHOW_PREFIX "SHOW "
-#define SAVE_PREFIX "SAVE "
-
-static const char *dump_dir_name = ".";
-static char *component = NULL;
-static char *backtrace = NULL;
-static bool http_show_headers = false;
-static struct https_cfg cfg =
-{
- .url = "retrace.fedoraproject.org",
- .port = 443,
- .ssl_allow_insecure = false,
-};
-
-/* allowed characters are [a-zA-Z0-9_\.\-\+] */
-/* http://fedoraproject.org/wiki/Packaging:NamingGuidelines */
-static inline int is_valid_component_name(const char *name)
-{
- int i;
- unsigned char c;
- for (i = 0; name[i]; ++i)
- {
- c = (unsigned char)name[i];
- if (!isalnum(c) &&
- c != '-' && c != '.' &&
- c != '+' && c != '_')
- return 0;
- }
-
- return 1;
-}
-
-/* idea from curl */
-/* escape everything except [a-zA-Z0-9\.\-_~] */
-static void escape(const char *src, struct strbuf *dest)
-{
- int i;
- unsigned char c;
- for (i = 0; src[i]; ++i)
- {
- c = (unsigned char)src[i];
- if (isalnum(c) ||
- c == '-' || c == '.' ||
- c == '~' || c == '_')
- strbuf_append_char(dest, c);
- else
- strbuf_append_strf(dest, "%%%02X", c);
- }
-}
-
-int main(int argc, char **argv)
-{
- setlocale(LC_ALL, "");
-#if ENABLE_NLS
- bindtextdomain(PACKAGE, LOCALEDIR);
- textdomain(PACKAGE);
-#endif
-
- struct language lang;
- get_language(&lang);
-
- enum {
- OPT_verbose = 1 << 0,
- OPT_syslog = 1 << 1,
- OPT_insecure = 1 << 2,
- OPT_url = 1 << 3,
- OPT_port = 1 << 4,
- OPT_directory = 1 << 5,
- OPT_headers = 1 << 6,
- };
-
- /* Keep enum above and order of options below in sync! */
- struct options options[] = {
- OPT__VERBOSE(&g_verbose),
- OPT_BOOL('s', "syslog", NULL, _("log to syslog")),
- OPT_BOOL('k', "insecure", NULL,
- _("allow insecure connection to dedup server")),
- OPT_STRING(0, "url", &(cfg.url), "URL",
- _("dedup server URL")),
- OPT_INTEGER(0, "port", &(cfg.port),
- _("dedup server port")),
- OPT_STRING('d', "dump-dir", &dump_dir_name, "DUMP_DIR",
- _("Problem directory")),
- OPT_BOOL(0, "headers", NULL,
- _("(debug) show received HTTP headers")),
- OPT_END()
- };
-
- const char *usage = _("abrt-dedup-client component backtrace_file [options]");
-
- char *env_url = getenv("DEDUP_SERVER_URL");
- if (env_url)
- cfg.url = env_url;
-
- char *env_port = getenv("DEDUP_SERVER_PORT");
- if (env_port)
- cfg.port = xatou(env_port);
-
- char *env_insecure = getenv("DEDUP_SERVER_INSECURE");
- if (env_insecure)
- cfg.ssl_allow_insecure = strncmp(env_insecure, "insecure", strlen("insecure")) == 0;
-
- unsigned opts = parse_opts(argc, argv, options, usage);
- if (opts & OPT_syslog)
- {
- openlog(msg_prefix, 0, LOG_DAEMON);
- logmode = LOGMODE_SYSLOG;
- }
-
- /* expecting no positional arguments */
- argv += optind;
- if (argv[0])
- show_usage_and_die(usage, options);
-
- if (!cfg.ssl_allow_insecure)
- cfg.ssl_allow_insecure = opts & OPT_insecure;
-
- http_show_headers = opts & OPT_headers;
-
- /* load component and backtrace from dump_dir */
- struct dump_dir *dd = dd_opendir(dump_dir_name, DD_OPEN_READONLY);
- /* error message was emitted by dd_opendir */
- if (!dd)
- xfunc_die();
- component = dd_load_text_ext(dd, FILENAME_COMPONENT,
- DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE);
- backtrace = dd_load_text_ext(dd, FILENAME_BACKTRACE,
- DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE);
- dd_close(dd);
-
- if (!component || !backtrace)
- error_msg_and_die(_("'" FILENAME_COMPONENT "' and '" FILENAME_BACKTRACE
- "' files are required to check for duplicates."));
-
- if (!is_valid_component_name(component))
- error_msg_and_die(_("Forbidden component name: '%s'."), component);
-
- struct strbuf *request_body = strbuf_new();
- strbuf_append_str(request_body, "component=");
- /* escape component - may contain '+' */
- escape(component, request_body);
- free(component);
- strbuf_append_str(request_body, "&backtrace=");
- escape(backtrace, request_body);
- free(backtrace);
-
- struct strbuf *request = strbuf_new();
- strbuf_append_strf(request,
- "POST /btserver.cgi HTTP/1.1\r\n"
- "Host: %s\r\n"
- "Content-Type: application/x-www-form-urlencoded\r\n"
- "Content-Length: %d\r\n"
- "Connection: close\r\n"
- "%s"
- "%s"
- "\r\n",
- cfg.url,
- request_body->len,
- lang.accept_charset,
- lang.accept_language
- );
-
- strbuf_append_str(request, request_body->buf);
- strbuf_free(request_body);
-
- /* Initialize NSS */
- SECMODModule *mod;
- PK11GenericObject *cert;
- nss_init(&mod, &cert);
-
- /* start SSL communication */
- PRFileDesc *tcp_sock, *ssl_sock;
- ssl_connect(&cfg, &tcp_sock, &ssl_sock);
- PRInt32 written = PR_Send(tcp_sock, request->buf, request->len,
- 0/*flags*/, PR_INTERVAL_NO_TIMEOUT);
- if (written < 0)
- {
- alert_connection_error(cfg.url);
- error_msg_and_die(_("Failed to send HTTP request of length %d: NSS error %d."),
- request->len, PR_GetError());
- }
-
- char *response = tcp_read_response(tcp_sock);
- strbuf_free(request);
- ssl_disconnect(ssl_sock);
- if (http_show_headers)
- http_print_headers(stdout, response);
-
- char *response_body = http_get_body(response);
- char *encoding = http_get_header_value(response, "Transfer-Encoding");
- if (encoding && strcasecmp("chunked", encoding) == 0)
- {
- char *newbody = http_join_chunked(response_body, strlen(response_body));
- free(response_body);
- response_body = newbody;
- }
- free(encoding);
-
- /* iterate line by line */
- struct strbuf *result = strbuf_new();
- char *line, *newline;
- for (line = response_body; line; line = newline)
- {
- newline = strchr(line, '\n');
- if (newline)
- {
- *newline = '\0';
- /* we are on '\n', the line could be terminated by "\r\n" */
- if (*(newline - 1) == '\r')
- *(newline - 1) = '\0';
- ++newline;
- }
-
- /* forward to client */
- if (strncmp(SHOW_PREFIX, line, strlen(SHOW_PREFIX)) == 0)
- puts(line + strlen(SHOW_PREFIX));
- /* save to FILENAME_REMOTE_RESULT */
- else if (strncmp(SAVE_PREFIX, line, strlen(SAVE_PREFIX)) == 0)
- strbuf_append_strf(result, "%s\n", line + strlen(SAVE_PREFIX));
- else
- /* ignore anything else, just print on -v */
- VERB1 printf("Ignoring: '%s'\n", line);
- }
-
- /* save result */
- if (result->len > 0)
- {
- dd = dd_opendir(dump_dir_name, /*flags:*/ 0);
- if (!dd)
- xfunc_die();
- dd_save_text(dd, FILENAME_REMOTE_RESULT, result->buf);
- dd_close(dd);
- }
- strbuf_free(result);
-
- free(response);
- free(response_body);
-
- /* Shutdown NSS. */
- nss_close(mod, cert);
-
- return 0;
-}
diff --git a/src/plugins/ccpp_event.conf b/src/plugins/ccpp_event.conf
index 1dacbeb..e7aec1d 100644
--- a/src/plugins/ccpp_event.conf
+++ b/src/plugins/ccpp_event.conf
@@ -63,7 +63,6 @@ EVENT=analyze_LocalGDB analyzer=CCpp

# Bugzilla requires nonempty duphash
EVENT=report_Bugzilla analyzer=CCpp duphash!=
- abrt-dedup-client
test -f component || abrt-action-save-package-data
component="`cat component`"
format="bugzilla_format.conf"
--
1.8.3.1
Michal Toman
2013-09-12 12:47:35 UTC
Permalink
Signed-off-by: Michal Toman <mtoman-H+wXaHxf7aLQT0dZR+***@public.gmane.org>
---
abrt.spec.in | 2 --
1 file changed, 2 deletions(-)

diff --git a/abrt.spec.in b/abrt.spec.in
index b07230f..fda81b9 100644
--- a/abrt.spec.in
+++ b/abrt.spec.in
@@ -652,7 +652,6 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%{_bindir}/abrt-action-analyze-backtrace
%{_bindir}/abrt-action-list-dsos
%{_bindir}/abrt-action-perform-ccpp-analysis
-%{_bindir}/abrt-dedup-client
%{_bindir}/abrt-action-analyze-ccpp-local
%{_sbindir}/abrt-install-ccpp-hook
%config(noreplace) %{_sysconfdir}/libreport/events.d/ccpp_event.conf
@@ -677,7 +676,6 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%{_mandir}/man*/abrt-action-analyze-core.*
%{_mandir}/man*/abrt-action-analyze-vulnerability.*
%{_mandir}/man*/abrt-action-perform-ccpp-analysis.*
-%{_mandir}/man*/abrt-dedup-client.*

%files addon-upload-watch
%defattr(-,root,root,-)
--
1.8.3.1
Jakub Filak
2013-09-12 14:03:55 UTC
Permalink
Pushed both. Thank you!

Loading...