From 631427d6228992660d1681296da0a1235d833b5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 20 Mar 2019 11:28:35 +0100 Subject: [PATCH 1/5] TODO: add some bootctl items --- TODO | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/TODO b/TODO index d8e13e5e61..7b678e06c4 100644 --- a/TODO +++ b/TODO @@ -700,6 +700,10 @@ Features: - honor language efi variables for default language selection (if there are any?) - honor timezone efi variables for default timezone selection (if there are any?) - change bootctl to be backed by systemd-bootd to control temporary and persistent default boot goal plus efi variables +* bootctl + - verify that the files boot entries point to exist + - recognize the case when not booted on EFI + - specify paths for boot entries * maybe do not install getty@tty1.service symlink in /etc but in /usr? From cc99274d7d40eae23c09e82cab55a3fd853be849 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 20 Mar 2019 11:30:34 +0100 Subject: [PATCH 2/5] test-alloc-util: add a smoke test for greedy_realloc --- src/test/test-alloc-util.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/test/test-alloc-util.c b/src/test/test-alloc-util.c index 0f2897a376..ad10eb178a 100644 --- a/src/test/test-alloc-util.c +++ b/src/test/test-alloc-util.c @@ -19,6 +19,25 @@ static void test_alloca(void) { assert_se(!memcmp(t, zero, 997)); } +static void test_GREEDY_REALLOC(void) { + _cleanup_free_ int *a = NULL, *b = NULL; + size_t n_allocated = 0, i; + + /* Give valgrind a chance to verify our realloc operations */ + + for (i = 0; i < 2048; i++) { + assert_se(GREEDY_REALLOC(a, n_allocated, i + 1)); + a[i] = i; + assert_se(GREEDY_REALLOC(a, n_allocated, i / 2)); + } + + for (i = 30, n_allocated = 0; i < 2048; i+=7) { + assert_se(GREEDY_REALLOC(b, n_allocated, i + 1)); + b[i] = i; + assert_se(GREEDY_REALLOC(b, n_allocated, i / 2)); + } +} + static void test_memdup_multiply_and_greedy_realloc(void) { int org[] = {1, 2, 3}; _cleanup_free_ int *dup; @@ -74,6 +93,7 @@ static void test_bool_assign(void) { int main(int argc, char *argv[]) { test_alloca(); + test_GREEDY_REALLOC(); test_memdup_multiply_and_greedy_realloc(); test_bool_assign(); From 96d2e0978db7e67927a364890d7ca6c5579fbe2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 20 Mar 2019 13:28:29 +0100 Subject: [PATCH 3/5] sd-bus: avoid IN_SET() invocation with two identical values MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #12036. ../../../src/systemd/src/libsystemd/sd-bus/bus-objects.c: In function ‘add_object_vtable_internal’: ../../../src/systemd/src/basic/macro.h:423:19: error: duplicate case value --- src/libsystemd/sd-bus/bus-objects.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libsystemd/sd-bus/bus-objects.c b/src/libsystemd/sd-bus/bus-objects.c index 1e45e18557..d9fc25605a 100644 --- a/src/libsystemd/sd-bus/bus-objects.c +++ b/src/libsystemd/sd-bus/bus-objects.c @@ -1744,7 +1744,9 @@ static int add_object_vtable_internal( assert_return(interface_name_is_valid(interface), -EINVAL); assert_return(vtable, -EINVAL); assert_return(vtable[0].type == _SD_BUS_VTABLE_START, -EINVAL); - assert_return(IN_SET(vtable[0].x.start.element_size, VTABLE_ELEMENT_SIZE_ORIGINAL, VTABLE_ELEMENT_SIZE), -EINVAL); + assert_return(vtable[0].x.start.element_size == VTABLE_ELEMENT_SIZE_ORIGINAL || + vtable[0].x.start.element_size == VTABLE_ELEMENT_SIZE, + -EINVAL); assert_return(!bus_pid_changed(bus), -ECHILD); assert_return(!streq(interface, "org.freedesktop.DBus.Properties") && !streq(interface, "org.freedesktop.DBus.Introspectable") && From afd5c1e37365d09648b6f11076d2a42008032ba7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 20 Mar 2019 13:34:35 +0100 Subject: [PATCH 4/5] sd-bus: reduce scope of variable --- src/libsystemd/sd-bus/bus-socket.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/libsystemd/sd-bus/bus-socket.c b/src/libsystemd/sd-bus/bus-socket.c index 4a50b5fad4..9221b33d48 100644 --- a/src/libsystemd/sd-bus/bus-socket.c +++ b/src/libsystemd/sd-bus/bus-socket.c @@ -160,7 +160,6 @@ static int bus_socket_write_auth(sd_bus *b) { static int bus_socket_auth_verify_client(sd_bus *b) { char *d, *e, *f, *start; sd_id128_t peer; - unsigned i; int r; assert(b); @@ -205,9 +204,8 @@ static int bus_socket_auth_verify_client(sd_bus *b) { */ if (memcmp(b->rbuffer, "OK ", 3)) return -EPERM; - } else { + } else return -EPERM; - } /* Now check the OK line. */ @@ -219,7 +217,7 @@ static int bus_socket_auth_verify_client(sd_bus *b) { b->auth = b->anonymous_auth ? BUS_AUTH_ANONYMOUS : BUS_AUTH_EXTERNAL; - for (i = 0; i < 32; i += 2) { + for (unsigned i = 0; i < 32; i += 2) { int x, y; x = unhexchar(d[2 + 3 + i]); From d3bdba381607364d0b3ef9e150fbaa107441cf51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 20 Mar 2019 13:43:35 +0100 Subject: [PATCH 5/5] test-fileio: avoid warning about ineffective comparison On arm64 with gcc-8.2.1-5.fc29.aarch64: ../src/test/test-fileio.c:645:29: warning: comparison is always false due to limited range of data type [-Wtype-limits] assert_se(c == EOF || safe_fgetc(f, &c) == 1); ^~ Casting c to int is not enough, gcc is able to figure out that the original type was unsigned and still warns. So let's just silence the warning like in test-sizeof.c. --- src/test/test-fileio.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/test/test-fileio.c b/src/test/test-fileio.c index 2ddaabe7f8..3dd4287ff0 100644 --- a/src/test/test-fileio.c +++ b/src/test/test-fileio.c @@ -629,6 +629,10 @@ static void test_tempfn(void) { static const char chars[] = "Aąę„”\n루\377"; + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wtype-limits" + static void test_fgetc(void) { _cleanup_fclose_ FILE *f = NULL; char c; @@ -640,7 +644,7 @@ static void test_fgetc(void) { assert_se(safe_fgetc(f, &c) == 1); assert_se(c == chars[i]); - /* EOF is -1, and hence we can't push value 255 in this way */ + /* EOF is -1, and hence we can't push value 255 in this way if char is signed */ assert_se(ungetc(c, f) != EOF || c == EOF); assert_se(c == EOF || safe_fgetc(f, &c) == 1); assert_se(c == chars[i]); @@ -654,6 +658,8 @@ static void test_fgetc(void) { assert_se(safe_fgetc(f, &c) == 0); } +#pragma GCC diagnostic pop + static const char buffer[] = "Some test data\n" "루Non-ascii chars: ąę„”\n"