Merge pull request #23009 from keszybz/fix-detection-of-libsystemd-shared-with-suffix

Fix detection of libsystemd-shared with suffix
This commit is contained in:
Lennart Poettering
2022-04-08 15:43:09 +02:00
committed by GitHub
48 changed files with 218 additions and 174 deletions
+1
View File
@@ -4,6 +4,7 @@
* Use 'ninja -C build update-syscall-tables' to download new syscall tables,
* and 'ninja -C build update-syscall-header' to regenerate this file.
*/
#pragma once
/* Note: if this code looks strange, this is because it is derived from the same
* template as the per-syscall blocks below. */
+1
View File
@@ -142,6 +142,7 @@ def print_syscall_defs(syscalls, tables, out):
* Use 'ninja -C build update-syscall-tables' to download new syscall tables,
* and 'ninja -C build update-syscall-header' to regenerate this file.
*/
#pragma once
''',
file=out)
print(ARCH_CHECK, file=out)
-118
View File
@@ -17,17 +17,13 @@
#include "extract-word.h"
#include "fd-util.h"
#include "fs-util.h"
#include "glob-util.h"
#include "log.h"
#include "macro.h"
#include "nulstr-util.h"
#include "parse-util.h"
#include "path-util.h"
#include "stat-util.h"
#include "string-util.h"
#include "strv.h"
#include "time-util.h"
#include "utf8.h"
int path_split_and_make_absolute(const char *p, char ***ret) {
char **l;
@@ -376,52 +372,6 @@ char *path_simplify(char *path) {
return path;
}
int path_simplify_and_warn(
char *path,
unsigned flag,
const char *unit,
const char *filename,
unsigned line,
const char *lvalue) {
bool fatal = flag & PATH_CHECK_FATAL;
assert(!FLAGS_SET(flag, PATH_CHECK_ABSOLUTE | PATH_CHECK_RELATIVE));
if (!utf8_is_valid(path))
return log_syntax_invalid_utf8(unit, LOG_ERR, filename, line, path);
if (flag & (PATH_CHECK_ABSOLUTE | PATH_CHECK_RELATIVE)) {
bool absolute;
absolute = path_is_absolute(path);
if (!absolute && (flag & PATH_CHECK_ABSOLUTE))
return log_syntax(unit, LOG_ERR, filename, line, SYNTHETIC_ERRNO(EINVAL),
"%s= path is not absolute%s: %s",
lvalue, fatal ? "" : ", ignoring", path);
if (absolute && (flag & PATH_CHECK_RELATIVE))
return log_syntax(unit, LOG_ERR, filename, line, SYNTHETIC_ERRNO(EINVAL),
"%s= path is absolute%s: %s",
lvalue, fatal ? "" : ", ignoring", path);
}
path_simplify(path);
if (!path_is_valid(path))
return log_syntax(unit, LOG_ERR, filename, line, SYNTHETIC_ERRNO(EINVAL),
"%s= path has invalid length (%zu bytes)%s.",
lvalue, strlen(path), fatal ? "" : ", ignoring");
if (!path_is_normalized(path))
return log_syntax(unit, LOG_ERR, filename, line, SYNTHETIC_ERRNO(EINVAL),
"%s= path is not normalized%s: %s",
lvalue, fatal ? "" : ", ignoring", path);
return 0;
}
char *path_startswith_full(const char *path, const char *prefix, bool accept_dot_dot) {
assert(path);
assert(prefix);
@@ -1314,74 +1264,6 @@ bool valid_device_allow_pattern(const char *path) {
return valid_device_node_path(path);
}
int systemd_installation_has_version(const char *root, unsigned minimal_version) {
const char *pattern;
int r;
/* Try to guess if systemd installation is later than the specified version. This
* is hacky and likely to yield false negatives, particularly if the installation
* is non-standard. False positives should be relatively rare.
*/
NULSTR_FOREACH(pattern,
/* /lib works for systems without usr-merge, and for systems with a sane
* usr-merge, where /lib is a symlink to /usr/lib. /usr/lib is necessary
* for Gentoo which does a merge without making /lib a symlink.
*/
"lib/systemd/libsystemd-shared-*.so\0"
"lib64/systemd/libsystemd-shared-*.so\0"
"usr/lib/systemd/libsystemd-shared-*.so\0"
"usr/lib64/systemd/libsystemd-shared-*.so\0") {
_cleanup_strv_free_ char **names = NULL;
_cleanup_free_ char *path = NULL;
char *c;
path = path_join(root, pattern);
if (!path)
return -ENOMEM;
r = glob_extend(&names, path, 0);
if (r == -ENOENT)
continue;
if (r < 0)
return r;
assert_se(c = endswith(path, "*.so"));
*c = '\0'; /* truncate the glob part */
STRV_FOREACH(name, names) {
/* This is most likely to run only once, hence let's not optimize anything. */
char *t, *t2;
unsigned version;
t = startswith(*name, path);
if (!t)
continue;
t2 = endswith(t, ".so");
if (!t2)
continue;
t2[0] = '\0'; /* truncate the suffix */
r = safe_atou(t, &version);
if (r < 0) {
log_debug_errno(r, "Found libsystemd shared at \"%s.so\", but failed to parse version: %m", *name);
continue;
}
log_debug("Found libsystemd shared at \"%s.so\", version %u (%s).",
*name, version,
version >= minimal_version ? "OK" : "too old");
if (version >= minimal_version)
return true;
}
}
return false;
}
bool dot_or_dot_dot(const char *path) {
if (!path)
return false;
-10
View File
@@ -77,14 +77,6 @@ char* path_extend_internal(char **x, ...);
char* path_simplify(char *path);
enum {
PATH_CHECK_FATAL = 1 << 0, /* If not set, then error message is appended with 'ignoring'. */
PATH_CHECK_ABSOLUTE = 1 << 1,
PATH_CHECK_RELATIVE = 1 << 2,
};
int path_simplify_and_warn(char *path, unsigned flag, const char *unit, const char *filename, unsigned line, const char *lvalue);
static inline bool path_equal_ptr(const char *a, const char *b) {
return !!a == !!b && (!a || path_equal(a, b));
}
@@ -181,8 +173,6 @@ bool is_device_path(const char *path);
bool valid_device_node_path(const char *path);
bool valid_device_allow_pattern(const char *path);
int systemd_installation_has_version(const char *root, unsigned minimal_version);
bool dot_or_dot_dot(const char *path);
static inline const char *skip_dev_prefix(const char *p) {
+1
View File
@@ -473,6 +473,7 @@ sendmmsg
sendmsg
sendto
set_mempolicy
set_mempolicy_home_node
set_robust_list
set_thread_area
set_tid_address
+1
View File
@@ -473,6 +473,7 @@ sendmmsg 503
sendmsg 114
sendto 133
set_mempolicy 431
set_mempolicy_home_node 560
set_robust_list 466
set_thread_area
set_tid_address 411
+1
View File
@@ -473,6 +473,7 @@ sendmmsg 269
sendmsg 211
sendto 206
set_mempolicy 237
set_mempolicy_home_node 450
set_robust_list 99
set_thread_area
set_tid_address 96
+1
View File
@@ -473,6 +473,7 @@ sendmmsg 374
sendmsg 296
sendto 290
set_mempolicy 321
set_mempolicy_home_node 450
set_robust_list 338
set_thread_area
set_tid_address 256
+1
View File
@@ -473,6 +473,7 @@ sendmmsg 269
sendmsg 211
sendto 206
set_mempolicy 237
set_mempolicy_home_node 450
set_robust_list 99
set_thread_area
set_tid_address 96
+1
View File
@@ -473,6 +473,7 @@ sendmmsg 345
sendmsg 370
sendto 369
set_mempolicy 276
set_mempolicy_home_node 450
set_robust_list 311
set_thread_area 243
set_tid_address 258
+1
View File
@@ -473,6 +473,7 @@ sendmmsg 1331
sendmsg 1205
sendto 1199
set_mempolicy 1261
set_mempolicy_home_node 1474
set_robust_list 1298
set_thread_area
set_tid_address 1233
+1
View File
@@ -473,6 +473,7 @@ sendmmsg 269
sendmsg 211
sendto 206
set_mempolicy 237
set_mempolicy_home_node 450
set_robust_list 99
set_thread_area
set_tid_address 96
+1
View File
@@ -473,6 +473,7 @@ sendmmsg 372
sendmsg 367
sendto 366
set_mempolicy 270
set_mempolicy_home_node 450
set_robust_list 304
set_thread_area 334
set_tid_address 253
+1
View File
@@ -473,6 +473,7 @@ sendmmsg 5302
sendmsg 5045
sendto 5043
set_mempolicy 5229
set_mempolicy_home_node 5450
set_robust_list 5268
set_thread_area 5242
set_tid_address 5212
+1
View File
@@ -473,6 +473,7 @@ sendmmsg 6307
sendmsg 6045
sendto 6043
set_mempolicy 6233
set_mempolicy_home_node 6450
set_robust_list 6272
set_thread_area 6246
set_tid_address 6213
+1
View File
@@ -473,6 +473,7 @@ sendmmsg 4343
sendmsg 4179
sendto 4180
set_mempolicy 4270
set_mempolicy_home_node 4450
set_robust_list 4309
set_thread_area 4283
set_tid_address 4252
+1
View File
@@ -473,6 +473,7 @@ sendmmsg 349
sendmsg 341
sendto 335
set_mempolicy 261
set_mempolicy_home_node 450
set_robust_list 300
set_thread_area
set_tid_address 232
+1
View File
@@ -473,6 +473,7 @@ sendmmsg 349
sendmsg 341
sendto 335
set_mempolicy 261
set_mempolicy_home_node 450
set_robust_list 300
set_thread_area
set_tid_address 232
+1
View File
@@ -473,6 +473,7 @@ sendmmsg 269
sendmsg 211
sendto 206
set_mempolicy 237
set_mempolicy_home_node 450
set_robust_list 99
set_thread_area
set_tid_address 96
+1
View File
@@ -473,6 +473,7 @@ sendmmsg 269
sendmsg 211
sendto 206
set_mempolicy 237
set_mempolicy_home_node 450
set_robust_list 99
set_thread_area
set_tid_address 96
+1
View File
@@ -473,6 +473,7 @@ sendmmsg 358
sendmsg 370
sendto 369
set_mempolicy 270
set_mempolicy_home_node 450
set_robust_list 304
set_thread_area
set_tid_address 252
+1
View File
@@ -473,6 +473,7 @@ sendmmsg 358
sendmsg 370
sendto 369
set_mempolicy 270
set_mempolicy_home_node 450
set_robust_list 304
set_thread_area
set_tid_address 252
+1
View File
@@ -473,6 +473,7 @@ sendmmsg 336
sendmsg 114
sendto 133
set_mempolicy 305
set_mempolicy_home_node 450
set_robust_list 300
set_thread_area
set_tid_address 166
+1
View File
@@ -473,6 +473,7 @@ sendmmsg 307
sendmsg 46
sendto 44
set_mempolicy 238
set_mempolicy_home_node 450
set_robust_list 273
set_thread_area 205
set_tid_address 218