Compare commits

..
10 Commits
17 .. 21
Author SHA1 Message Date
Patrick McCarty 8c65e96479 Bump version for release
This release fixes some compiler warnings and the distcheck target, and
addresses a recurrent 404 issue by avoiding a download attempt for
".tar" from the root debuginfo directory.
2015-09-29 12:32:23 -07:00
Patrick McCarty 7ea9a50b19 Avoid attempt to download {lib,src}/debug
The associated cache directories in /var/cache/debuginfo/{lib,src}
already exist, and the tar for / is not created on the server, so avoid
downloading it altogether.
2015-09-29 12:25:13 -07:00
Patrick McCarty e16ab76926 Refresh version in configure.ac
The configure.ac version was falling behind the tagged version...
2015-09-28 14:02:03 -07:00
Patrick McCarty 090cb27a34 Fix distcheck target
Adding two --with-* configure options for the systemd pkgconfig-defined
variables gives opportunity for distcheck to succeed; the variables use
hardcoded paths to /usr/lib/systemd/... without a PREFIX, so the paths
need to be relocated to $dc_install_base, a variable distcheck uses for
the normal variables that begin with PREFIX.
2015-09-28 13:52:24 -07:00
Patrick McCarty cbaf943fca Convert server to use modern Glib Thread API
Using a GStaticMutex and associated functions are deprecated, since
a GMutex can be statically allocated now (as of glib 2.32).
2015-09-25 14:20:22 -07:00
Patrick McCarty 32ae400e7d Update gitignore 2015-09-25 14:19:56 -07:00
Patrick McCarty 82f03f8e22 Fix build warning for implicitly included header 2015-09-25 14:00:33 -07:00
Arjan van de Ven c1f45d9f3c https 2015-07-20 23:02:09 -04:00
Arjan van de Ven bcff8fae39 default to the other server for now 2015-04-24 17:55:53 -04:00
Arjan van de Ven 66bab25bcd implement multi-url setup 2015-03-23 14:45:00 -04:00
5 changed files with 38 additions and 9 deletions
+2
View File
@@ -4,10 +4,12 @@ clr_debug_fuse
clr_debug_daemon
clr_debug_prepare
.deps/
.dirstamp
Makefile
Makefile.in
aclocal.m4
autom4te.cache/
compile
config.h
config.h.in
config.log
+4
View File
@@ -1,5 +1,9 @@
EXTRA_DIST = COPYING clr_debug_fuse.service clr_debug_daemon.service debuginfo.conf
DISTCHECK_CONFIGURE_FLAGS = \
--with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir) \
--with-systemdtmpfilesdir=$$dc_install_base/$(tmpfilesdir)
bin_PROGRAMS = clr_debug_fuse clr_debug_daemon clr_debug_prepare
clr_debug_fuse_SOURCES = src/fuse.c src/client.c
+13 -5
View File
@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.66])
AC_INIT(clr-debug-info, 11, arjan@linux.intel.com)
AC_INIT(clr-debug-info, 21, arjan@linux.intel.com)
AM_INIT_AUTOMAKE([foreign -Wall -W subdir-objects])
AM_SILENT_RULES([yes])
AC_PROG_CC
@@ -13,11 +13,19 @@ PKG_CHECK_MODULES([curl], [libcurl])
PKG_CHECK_MODULES([fuse], [fuse])
PKG_CHECK_MODULES([SYSTEMD], [systemd])
tmpfilesdir=`pkg-config --variable tmpfilesdir systemd`
AC_SUBST(tmpfilesdir)
dir=""
AC_ARG_WITH([systemdsystemunitdir], AS_HELP_STRING([--with-systemdsystemunitdir=DIR],
[path to systemd system service dir @<:@default=/usr/lib/systemd/system@:>@]), [dir=${withval}],
[dir="$($PKG_CONFIG --variable=systemdsystemunitdir systemd)"])
test -z "${dir}" && dir=/usr/lib/systemd/system
AC_SUBST(systemdsystemunitdir, [${dir}])
systemdsystemunitdir=`pkg-config --variable systemdsystemunitdir systemd`
AC_SUBST(systemdsystemunitdir)
dir=""
AC_ARG_WITH([systemdtmpfilesdir], AS_HELP_STRING([--with-systemdtmpfilesdir=DIR],
[path to systemd tmpfiles dir @<:@default=/usr/lib/tmpfiles.d@:>@]), [dir=${withval}],
[dir="$($PKG_CONFIG --variable=tmpfilesdir systemd)"])
test -z "${dir}" && dir=/usr/lib/tmpfiles.d
AC_SUBST(tmpfilesdir, [${dir}])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
+1
View File
@@ -34,6 +34,7 @@ Original copyright notice follows:
#include <malloc.h>
#include <fuse.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
+18 -4
View File
@@ -41,7 +41,10 @@
#include <curl/curl.h>
#include <glib.h>
GStaticMutex dupes_mutex = G_STATIC_MUTEX_INIT;
static GMutex dupes_mutex;
char *urls[2] = {"https://debuginfo.clearlinux.org/debuginfo/", "http://debuginfo.fenrus.org/debuginfo/" };
int urlcounter = 1;
static GHashTable *hash;
@@ -50,7 +53,7 @@ static int avoid_dupes(const char *url)
{
int retval = 0;
void *value;
g_static_mutex_lock(&dupes_mutex);
g_mutex_lock(&dupes_mutex);
if (hash == NULL)
hash = g_hash_table_new(g_str_hash, g_str_equal);
@@ -68,7 +71,7 @@ static int avoid_dupes(const char *url)
g_hash_table_replace(hash, strdup(url), data);
}
g_static_mutex_unlock(&dupes_mutex);
g_mutex_unlock(&dupes_mutex);
return retval;
}
@@ -119,6 +122,9 @@ static int curl_get_file(const char *url, const char *prefix, time_t timestamp)
fflush(file);
// printf("HTTP return code is %i\n", ret);
if (ret != 200 && ret != 404)
urlcounter++;
if (ret == 200) {
char *command = NULL;
// printf("Filename is %s\n", filename);
@@ -185,6 +191,14 @@ static void *server_thread(void *arg)
*path = 0;
path++;
/* GDB and elfutils both stat /usr/lib/debug directly when looking up
* debuginfo, so avoid the download for "/.tar"; the associated cache
* directories already exist by this point.
*/
if (strlen(path) == 1 && strcmp(path, "/") == 0) {
close(fd);
return NULL;
}
if (strstr(path, "..") || strstr(prefix, "..") || strstr(path, "'") || strstr(path, ";")) {
close(fd);
@@ -197,7 +211,7 @@ static void *server_thread(void *arg)
return NULL;
}
url = NULL;
if (asprintf(&url, "http://debuginfo.clearlinux.org/debuginfo/%s%s.tar", prefix, path) < 0) {
if (asprintf(&url, "%s%s%s.tar", urls[urlcounter % 2], prefix, path) < 0) {
close(fd);
return NULL;
}