backport gcc8 fix to 3.2

This commit is contained in:
George Angelopoulos 2018-06-03 16:35:39 +02:00
parent dda4d2e898
commit a2db70026d
3 changed files with 204 additions and 5 deletions

View file

@ -1,7 +1,9 @@
# Generated by mksrcinfo v8
# Sun Jun 3 14:33:59 UTC 2018
pkgbase = systemtap
pkgdesc = provides infrastructure to simplify the gathering of information about the running system.
pkgver = 3.2
pkgrel = 2
pkgrel = 3
url = http://sourceware.org/systemtap/
install = systemtap.install
arch = x86_64
@ -16,10 +18,11 @@ pkgbase = systemtap
source = systemtap-3.2.tar.gz::https://sourceware.org/systemtap/ftp/releases/systemtap-3.2.tar.gz
source = systemtap-3.2.tar.gz.asc::https://sourceware.org/systemtap/ftp/releases/systemtap-3.2.tar.gz.asc
source = stp_remove_install_hooks.patch
validpgpkeys = 5D38116FA4D3A7CC77E378D37E83610126DCC2E8
source = fixes-for-gcc-8.patch
sha512sums = 6036ed1b5189fd3fcfdeeaa526a3539ac632d0b687a063b5e3424e8f613bfc2c8d079742b0262b547128e97e30e4beb61898b23761657aee519e61346ac92e94
sha512sums = SKIP
sha512sums = 1d2758e9f875e06d08d37679587454fb43e025aa83ceeb405b1bc8d3277476502f2d67cf9e8383cc4c63ae545d7d0e9ebaab814f880b2f53bba47bef4afcd537
sha512sums = 970d83ace43909e5a1bfc4112d78dd913af6d59e4b8dc8c4461370b022092b0cdb6830427b52bcf5b7409ff6d7c79dab778e53398ba65de71bd4a270c66a2d3a
pkgname = systemtap

View file

@ -2,7 +2,7 @@
# Contributor:dront78 <dront78@gmail.com>
pkgname=systemtap
pkgver=3.2
pkgrel=2
pkgrel=3
pkgdesc="provides infrastructure to simplify the gathering of information about the running system."
url="http://sourceware.org/systemtap/"
arch=('x86_64' 'i686')
@ -12,16 +12,19 @@ makedepends=('python2-setuptools' 'xmlto')
optdepends=('sqlite3: for storing results in a database')
source=("${pkgname}-${pkgver}.tar.gz::https://sourceware.org/systemtap/ftp/releases/${pkgname}-${pkgver}.tar.gz"
"${pkgname}-${pkgver}.tar.gz.asc::https://sourceware.org/systemtap/ftp/releases/${pkgname}-${pkgver}.tar.gz.asc"
'stp_remove_install_hooks.patch')
'stp_remove_install_hooks.patch'
'fixes-for-gcc-8.patch')
sha512sums=('6036ed1b5189fd3fcfdeeaa526a3539ac632d0b687a063b5e3424e8f613bfc2c8d079742b0262b547128e97e30e4beb61898b23761657aee519e61346ac92e94'
'SKIP'
'1d2758e9f875e06d08d37679587454fb43e025aa83ceeb405b1bc8d3277476502f2d67cf9e8383cc4c63ae545d7d0e9ebaab814f880b2f53bba47bef4afcd537')
'1d2758e9f875e06d08d37679587454fb43e025aa83ceeb405b1bc8d3277476502f2d67cf9e8383cc4c63ae545d7d0e9ebaab814f880b2f53bba47bef4afcd537'
'970d83ace43909e5a1bfc4112d78dd913af6d59e4b8dc8c4461370b022092b0cdb6830427b52bcf5b7409ff6d7c79dab778e53398ba65de71bd4a270c66a2d3a')
install='systemtap.install'
validpgpkeys=('5D38116FA4D3A7CC77E378D37E83610126DCC2E8')
prepare() {
cd "${pkgname}-${pkgver}"
patch -Np1 -i "${srcdir}/stp_remove_install_hooks.patch"
patch -Np1 -i "${srcdir}/fixes-for-gcc-8.patch"
autoreconf -i
}
build() {

193
fixes-for-gcc-8.patch Normal file
View file

@ -0,0 +1,193 @@
diff --git a/includes/sys/sdt.h b/includes/sys/sdt.h
index 940f74483..c0c5a492c 100644
--- a/includes/sys/sdt.h
+++ b/includes/sys/sdt.h
@@ -119,8 +119,8 @@ struct __sdt_type
#define __SDT_ALWAYS_SIGNED(T) \
template<> struct __sdt_type<T> { static const bool __sdt_signed = true; };
-#define __SDT_COND_SIGNED(T) \
-template<> struct __sdt_type<T> { static const bool __sdt_signed = ((T)(-1) < 1); };
+#define __SDT_COND_SIGNED(T,CT) \
+template<> struct __sdt_type<T> { static const bool __sdt_signed = ((CT)(-1) < 1); };
__SDT_ALWAYS_SIGNED(signed char)
__SDT_ALWAYS_SIGNED(short)
__SDT_ALWAYS_SIGNED(int)
@@ -141,14 +141,14 @@ __SDT_ALWAYS_SIGNED(const volatile short)
__SDT_ALWAYS_SIGNED(const volatile int)
__SDT_ALWAYS_SIGNED(const volatile long)
__SDT_ALWAYS_SIGNED(const volatile long long)
-__SDT_COND_SIGNED(char)
-__SDT_COND_SIGNED(wchar_t)
-__SDT_COND_SIGNED(volatile char)
-__SDT_COND_SIGNED(volatile wchar_t)
-__SDT_COND_SIGNED(const char)
-__SDT_COND_SIGNED(const wchar_t)
-__SDT_COND_SIGNED(const volatile char)
-__SDT_COND_SIGNED(const volatile wchar_t)
+__SDT_COND_SIGNED(char, char)
+__SDT_COND_SIGNED(wchar_t, wchar_t)
+__SDT_COND_SIGNED(volatile char, char)
+__SDT_COND_SIGNED(volatile wchar_t, wchar_t)
+__SDT_COND_SIGNED(const char, char)
+__SDT_COND_SIGNED(const wchar_t, wchar_t)
+__SDT_COND_SIGNED(const volatile char, char)
+__SDT_COND_SIGNED(const volatile wchar_t, wchar_t)
#if defined (__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
/* __SDT_COND_SIGNED(char16_t) */
/* __SDT_COND_SIGNED(char32_t) */
diff --git a/stap-serverd.cxx b/stap-serverd.cxx
index b8f70114c..063c3c587 100644
--- a/stap-serverd.cxx
+++ b/stap-serverd.cxx
@@ -1607,6 +1607,7 @@ generate_mok(string &mok_fingerprint)
char tmpdir[PATH_MAX] = { '\0' };
string public_cert_path, private_cert_path, destdir;
mode_t old_umask;
+ int retlen;
mok_fingerprint.clear ();
@@ -1631,7 +1632,14 @@ generate_mok(string &mok_fingerprint)
}
// Make a temporary directory to store results in.
- snprintf (tmpdir, PATH_MAX, "%s/stap-server.XXXXXX", mok_path.c_str ());
+ retlen = snprintf (tmpdir, PATH_MAX, "%s/stap-server.XXXXXX", mok_path.c_str ());
+ if (retlen < 0 || retlen >= PATH_MAX)
+ {
+ server_error (_F("Could not create %s name", "temporary directory"));
+ tmpdir[0] = '\0';
+ goto cleanup;
+ }
+
if (mkdtemp (tmpdir) == NULL)
{
server_error (_F("Could not create temporary directory %s: %s", tmpdir,
@@ -1704,6 +1712,7 @@ handleRequest (const string &requestDirName, const string &responseDirName, stri
unsigned u;
unsigned i;
FILE* f;
+ int retlen;
// Save the server version. Do this early, so the client knows what version of the server
// it is dealing with, even if the request is not fully completed.
@@ -1782,7 +1791,12 @@ handleRequest (const string &requestDirName, const string &responseDirName, stri
struct stat st;
char *arg;
- snprintf (stapargfile, PATH_MAX, "%s/argv%d", requestDirName.c_str (), i);
+ retlen = snprintf (stapargfile, PATH_MAX, "%s/argv%d", requestDirName.c_str (), i);
+ if (retlen < 0 || retlen >= PATH_MAX)
+ {
+ server_error (_F("Error creating %s name", "path"));
+ return;
+ }
rc = stat(stapargfile, & st);
if (rc) break;
@@ -1888,7 +1902,15 @@ handleRequest (const string &requestDirName, const string &responseDirName, stri
{
glob_t globber;
char pattern[PATH_MAX];
- snprintf (pattern, PATH_MAX, "%s/*.ko", new_staptmpdir.c_str());
+ int retlen;
+
+ retlen = snprintf (pattern, PATH_MAX, "%s/*.ko", new_staptmpdir.c_str());
+ if (retlen < 0 || retlen >= PATH_MAX)
+ {
+ server_error (_F("Error creating %s name", "pattern"));
+ return;
+ }
+
rc = glob (pattern, GLOB_ERR, NULL, &globber);
if (rc)
server_error (_F("Unable to find a module in %s", new_staptmpdir.c_str()));
@@ -2164,6 +2186,7 @@ handle_connection (void *arg)
copy for each connection.*/
vector<string> argv;
PRInt32 bytesRead;
+ int retlen;
/* Detatch to avoid a memory leak */
if(max_threads > 0)
@@ -2213,7 +2236,13 @@ handle_connection (void *arg)
#endif
secStatus = SECFailure;
- snprintf(tmpdir, PATH_MAX, "%s/stap-server.XXXXXX", getenv("TMPDIR") ?: "/tmp");
+ retlen = snprintf(tmpdir, PATH_MAX, "%s/stap-server.XXXXXX", getenv("TMPDIR") ?: "/tmp");
+ if (retlen < 0 || retlen >= PATH_MAX)
+ {
+ server_error (_F("Error creating %s name", "temporary directory"));
+ tmpdir[0]=0; /* prevent /bin/rm */
+ goto cleanup;
+ }
rc1 = mkdtemp(tmpdir);
if (! rc1)
{
@@ -2223,9 +2252,20 @@ handle_connection (void *arg)
}
/* Create a temporary files names and directories. */
- snprintf (requestFileName, PATH_MAX, "%s/request.zip", tmpdir);
+ retlen = snprintf (requestFileName, PATH_MAX, "%s/request.zip", tmpdir);
+ if (retlen < 0 || retlen >= PATH_MAX)
+ {
+ server_error (_F("Error creating %s name", "request.zip path"));
+ goto cleanup;
+ }
+
+ retlen = snprintf (requestDirName, PATH_MAX, "%s/request", tmpdir);
+ if (retlen < 0 || retlen >= PATH_MAX)
+ {
+ server_error (_F("Error creating %s name", "request directory path"));
+ goto cleanup;
+ }
- snprintf (requestDirName, PATH_MAX, "%s/request", tmpdir);
rc = mkdir(requestDirName, 0700);
if (rc)
{
@@ -2233,7 +2273,13 @@ handle_connection (void *arg)
goto cleanup;
}
- snprintf (responseDirName, PATH_MAX, "%s/response", tmpdir);
+ retlen = snprintf (responseDirName, PATH_MAX, "%s/response", tmpdir);
+ if (retlen < 0 || retlen >= PATH_MAX)
+ {
+ server_error (_F("Error creating %s name", "response directory path"));
+ goto cleanup;
+ }
+
rc = mkdir(responseDirName, 0700);
if (rc)
{
@@ -2243,7 +2289,12 @@ handle_connection (void *arg)
// Set this early, since it gets used for errors to be returned to the client.
stapstderr = string(responseDirName) + "/stderr";
- snprintf (responseFileName, PATH_MAX, "%s/response.zip", tmpdir);
+ retlen = snprintf (responseFileName, PATH_MAX, "%s/response.zip", tmpdir);
+ if (retlen < 0 || retlen >= PATH_MAX)
+ {
+ server_error (_F("Error creating %s name", "response.zip path"));
+ goto cleanup;
+ }
/* Read data from the socket.
* If the user is requesting/requiring authentication, authenticate
diff --git a/translate.cxx b/translate.cxx
index 1240a80ec..4ade06fdd 100644
--- a/translate.cxx
+++ b/translate.cxx
@@ -7860,7 +7860,7 @@ translate_pass (systemtap_session& s)
if (versions.size() >= 3 && s.verbose > 1)
clog << _F("ignoring extra parts of compat version: %s", s.compatible.c_str()) << endl;
}
- catch (const runtime_error)
+ catch (const runtime_error&)
{
throw SEMANTIC_ERROR(_F("parse error in compatibility version: %s", s.compatible.c_str()));
}