sys-apps/systemd: add v256.5 with musl libc patches
- https://code.atwilcox.tech/sphen/scaly/systemd - https://catfox.life/2024/09/05/porting-systemd-to-musl-libc-powered-linux/
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,165 @@
|
||||
From efaf94d0fde9fcd2ed890f4f8674c0c456d14610 Mon Sep 17 00:00:00 2001
|
||||
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
|
||||
Date: Sun, 18 Aug 2024 02:01:56 -0500
|
||||
Subject: [PATCH 02/34] Use XSI strerror_r instead of GNU strerror_r
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This cannot go upstream.
|
||||
|
||||
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
||||
---
|
||||
src/basic/errno-util.h | 2 +-
|
||||
src/libsystemd/sd-bus/bus-error.c | 56 ++++++++----------------
|
||||
src/libsystemd/sd-bus/test-bus-error.c | 1 -
|
||||
src/libsystemd/sd-journal/journal-send.c | 7 +--
|
||||
4 files changed, 20 insertions(+), 46 deletions(-)
|
||||
|
||||
diff --git a/src/basic/errno-util.h b/src/basic/errno-util.h
|
||||
index 48b76e4bf70d..c48679c55cfd 100644
|
||||
--- a/src/basic/errno-util.h
|
||||
+++ b/src/basic/errno-util.h
|
||||
@@ -15,7 +15,7 @@
|
||||
* https://stackoverflow.com/questions/34880638/compound-literal-lifetime-and-if-blocks
|
||||
*
|
||||
* Note that we use the GNU variant of strerror_r() here. */
|
||||
-#define STRERROR(errnum) strerror_r(abs(errnum), (char[ERRNO_BUF_LEN]){}, ERRNO_BUF_LEN)
|
||||
+#define STRERROR(errnum) strerror(abs(errnum))
|
||||
|
||||
/* A helper to print an error message or message for functions that return 0 on EOF.
|
||||
* Note that we can't use ({ … }) to define a temporary variable, so errnum is
|
||||
diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c
|
||||
index f415797700ef..34bc7307bbcf 100644
|
||||
--- a/src/libsystemd/sd-bus/bus-error.c
|
||||
+++ b/src/libsystemd/sd-bus/bus-error.c
|
||||
@@ -403,15 +403,13 @@ static void bus_error_strerror(sd_bus_error *e, int error) {
|
||||
assert(e);
|
||||
|
||||
for (;;) {
|
||||
- char *x;
|
||||
-
|
||||
m = new(char, k);
|
||||
if (!m)
|
||||
return;
|
||||
|
||||
errno = 0;
|
||||
- x = strerror_r(error, m, k);
|
||||
- if (errno == ERANGE || strlen(x) >= k - 1) {
|
||||
+ strerror_r(error, m, k);
|
||||
+ if (errno == ERANGE) {
|
||||
free(m);
|
||||
k *= 2;
|
||||
continue;
|
||||
@@ -422,43 +420,24 @@ static void bus_error_strerror(sd_bus_error *e, int error) {
|
||||
return;
|
||||
}
|
||||
|
||||
- if (x == m) {
|
||||
- if (e->_need_free > 0) {
|
||||
- /* Error is already dynamic, let's just update the message */
|
||||
- free((char*) e->message);
|
||||
- e->message = x;
|
||||
-
|
||||
- } else {
|
||||
- char *t;
|
||||
- /* Error was const so far, let's make it dynamic, if we can */
|
||||
-
|
||||
- t = strdup(e->name);
|
||||
- if (!t) {
|
||||
- free(m);
|
||||
- return;
|
||||
- }
|
||||
+ if (e->_need_free > 0) {
|
||||
+ /* Error is already dynamic, let's just update the message */
|
||||
+ free((char*) e->message);
|
||||
+ e->message = m;
|
||||
|
||||
- e->_need_free = 1;
|
||||
- e->name = t;
|
||||
- e->message = x;
|
||||
- }
|
||||
} else {
|
||||
- free(m);
|
||||
-
|
||||
- if (e->_need_free > 0) {
|
||||
- char *t;
|
||||
-
|
||||
- /* Error is dynamic, let's hence make the message also dynamic */
|
||||
- t = strdup(x);
|
||||
- if (!t)
|
||||
- return;
|
||||
+ char *t;
|
||||
+ /* Error was const so far, let's make it dynamic, if we can */
|
||||
|
||||
- free((char*) e->message);
|
||||
- e->message = t;
|
||||
- } else {
|
||||
- /* Error is const, hence we can just override */
|
||||
- e->message = x;
|
||||
+ t = strdup(e->name);
|
||||
+ if (!t) {
|
||||
+ free(m);
|
||||
+ return;
|
||||
}
|
||||
+
|
||||
+ e->_need_free = 1;
|
||||
+ e->name = t;
|
||||
+ e->message = m;
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -596,7 +575,8 @@ const char* _bus_error_message(const sd_bus_error *e, int error, char buf[static
|
||||
if (e && e->message)
|
||||
return e->message;
|
||||
|
||||
- return strerror_r(abs(error), buf, ERRNO_BUF_LEN);
|
||||
+ strerror_r(abs(error), buf, ERRNO_BUF_LEN);
|
||||
+ return buf;
|
||||
}
|
||||
|
||||
static bool map_ok(const sd_bus_error_map *map) {
|
||||
diff --git a/src/libsystemd/sd-bus/test-bus-error.c b/src/libsystemd/sd-bus/test-bus-error.c
|
||||
index 91045c06c2ae..af3332d29a23 100644
|
||||
--- a/src/libsystemd/sd-bus/test-bus-error.c
|
||||
+++ b/src/libsystemd/sd-bus/test-bus-error.c
|
||||
@@ -232,7 +232,6 @@ TEST(sd_bus_error_set_errnof) {
|
||||
errno = EACCES;
|
||||
assert_se(asprintf(&str, "%m") >= 0);
|
||||
assert_se(streq(error.message, str));
|
||||
- assert_se(error._need_free == 0);
|
||||
|
||||
str = mfree(str);
|
||||
sd_bus_error_free(&error);
|
||||
diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
|
||||
index 7d02b57d7b42..1eea1e885620 100644
|
||||
--- a/src/libsystemd/sd-journal/journal-send.c
|
||||
+++ b/src/libsystemd/sd-journal/journal-send.c
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
-#include <printf.h>
|
||||
#include <stddef.h>
|
||||
#include <sys/un.h>
|
||||
#include <unistd.h>
|
||||
@@ -358,16 +357,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove
|
||||
|
||||
for (;;) {
|
||||
char buffer[n];
|
||||
- char* j;
|
||||
|
||||
errno = 0;
|
||||
- j = strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
|
||||
+ strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
|
||||
if (errno == 0) {
|
||||
char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1];
|
||||
|
||||
- if (j != buffer + 8 + k)
|
||||
- memmove(buffer + 8 + k, j, strlen(j)+1);
|
||||
-
|
||||
memcpy(buffer, "MESSAGE=", 8);
|
||||
|
||||
if (k > 0) {
|
||||
--
|
||||
2.41.0
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
From e14c8f31006bda5cdc2e42d9f7dcc9c00bca1f06 Mon Sep 17 00:00:00 2001
|
||||
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
|
||||
Date: Sun, 18 Aug 2024 02:02:34 -0500
|
||||
Subject: [PATCH 03/34] fileio: Disable use of disabling write buffer
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
It doesn't work properly on musl and it breaks more than it fixes.
|
||||
|
||||
This cannot be sent upstream.
|
||||
|
||||
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
||||
---
|
||||
src/basic/fileio.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/basic/fileio.c b/src/basic/fileio.c
|
||||
index 523378177fb7..2e2875ec171c 100644
|
||||
--- a/src/basic/fileio.c
|
||||
+++ b/src/basic/fileio.c
|
||||
@@ -311,8 +311,8 @@ int write_string_file_ts_at(
|
||||
if (r < 0)
|
||||
goto fail;
|
||||
|
||||
- if (flags & WRITE_STRING_FILE_DISABLE_BUFFER)
|
||||
- setvbuf(f, NULL, _IONBF, 0);
|
||||
+ /*if (flags & WRITE_STRING_FILE_DISABLE_BUFFER)
|
||||
+ setvbuf(f, NULL, _IONBF, 0);*/
|
||||
|
||||
r = write_string_stream_ts(f, line, flags, ts);
|
||||
if (r < 0)
|
||||
--
|
||||
2.41.0
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
From df3fdeb9091977698a3c6775ed835b68105b6ae6 Mon Sep 17 00:00:00 2001
|
||||
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
|
||||
Date: Sun, 18 Aug 2024 02:09:55 -0500
|
||||
Subject: [PATCH 04/34] fs-util: Handle musl O_ACCMODE containing O_PATH
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
O_ACCMODE strictly includes 'O_SEARCH', but that is defined as 'O_PATH'
|
||||
in musl. This makes the read-only test fail when O_PATH is specified as
|
||||
a flag for open_mkdir_at.
|
||||
|
||||
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
||||
---
|
||||
src/basic/fs-util.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/basic/fs-util.c b/src/basic/fs-util.c
|
||||
index 64d309317d52..744ce847ffe5 100644
|
||||
--- a/src/basic/fs-util.c
|
||||
+++ b/src/basic/fs-util.c
|
||||
@@ -1036,7 +1036,7 @@ int open_mkdir_at_full(int dirfd, const char *path, int flags, XOpenFlags xopen_
|
||||
|
||||
if (flags & ~(O_RDONLY|O_CLOEXEC|O_DIRECTORY|O_EXCL|O_NOATIME|O_NOFOLLOW|O_PATH))
|
||||
return -EINVAL;
|
||||
- if ((flags & O_ACCMODE) != O_RDONLY)
|
||||
+ if (((flags & O_ACCMODE) & ~O_PATH) != O_RDONLY)
|
||||
return -EINVAL;
|
||||
|
||||
/* Note that O_DIRECTORY|O_NOFOLLOW is implied, but we allow specifying it anyway. The following
|
||||
--
|
||||
2.41.0
|
||||
|
||||
@@ -0,0 +1,760 @@
|
||||
From f423321481330c5f2f9158c490162b2e62b4c8bd Mon Sep 17 00:00:00 2001
|
||||
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
|
||||
Date: Sun, 18 Aug 2024 02:15:10 -0500
|
||||
Subject: [PATCH 05/34] Use libc over Linux UAPI headers when possible
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The Linux UAPI headers cause a lot of breakage. I can see that upstream
|
||||
has started doing this already with some of the comments, so it is
|
||||
possible this might need to be massaged and upstreamed.
|
||||
|
||||
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
||||
---
|
||||
src/basic/arphrd-util.c | 3 ++-
|
||||
src/basic/generate-arphrd-list.sh | 2 +-
|
||||
src/basic/socket-util.h | 2 +-
|
||||
src/libsystemd-network/sd-dhcp6-client.c | 3 ++-
|
||||
src/libsystemd/sd-netlink/netlink-message-rtnl.c | 1 +
|
||||
src/libsystemd/sd-netlink/netlink-types-rtnl.c | 1 +
|
||||
src/network/netdev/bareudp.c | 3 ++-
|
||||
src/network/netdev/batadv.c | 2 +-
|
||||
src/network/netdev/bond.c | 3 ++-
|
||||
src/network/netdev/bridge.c | 5 +++--
|
||||
src/network/netdev/dummy.c | 2 +-
|
||||
src/network/netdev/geneve.c | 2 +-
|
||||
src/network/netdev/ifb.c | 2 +-
|
||||
src/network/netdev/ipoib.c | 2 +-
|
||||
src/network/netdev/ipvlan.c | 2 +-
|
||||
src/network/netdev/macsec.c | 3 ++-
|
||||
src/network/netdev/macvlan.c | 2 +-
|
||||
src/network/netdev/netdev-gperf.gperf | 1 +
|
||||
src/network/netdev/netdev.c | 3 ++-
|
||||
src/network/netdev/netdevsim.c | 2 +-
|
||||
src/network/netdev/nlmon.c | 2 +-
|
||||
src/network/netdev/tunnel.c | 3 ++-
|
||||
src/network/netdev/tuntap.c | 2 +-
|
||||
src/network/netdev/vcan.c | 2 +-
|
||||
src/network/netdev/veth.c | 2 +-
|
||||
src/network/netdev/vlan.c | 2 +-
|
||||
src/network/netdev/vrf.c | 2 +-
|
||||
src/network/netdev/vxcan.c | 2 +-
|
||||
src/network/netdev/vxlan.c | 2 +-
|
||||
src/network/netdev/wireguard.c | 5 +++--
|
||||
src/network/netdev/xfrm.c | 2 +-
|
||||
src/network/networkctl.c | 1 +
|
||||
src/network/networkd-bridge-mdb.c | 2 ++
|
||||
src/network/networkd-bridge-vlan.c | 1 +
|
||||
src/network/networkd-dhcp-common.c | 4 +++-
|
||||
src/network/networkd-dhcp-prefix-delegation.c | 1 +
|
||||
src/network/networkd-dhcp-server.c | 3 ++-
|
||||
src/network/networkd-dhcp4.c | 3 ++-
|
||||
src/network/networkd-ipv6ll.c | 2 +-
|
||||
src/network/networkd-link.c | 3 ++-
|
||||
src/network/networkd-ndisc.c | 3 ++-
|
||||
src/network/networkd-network.c | 1 +
|
||||
src/network/networkd-route.c | 1 +
|
||||
src/network/networkd-setlink.c | 3 ++-
|
||||
src/network/networkd-sysctl.c | 2 +-
|
||||
src/network/test-network-tables.c | 1 +
|
||||
src/shared/ethtool-util.c | 1 +
|
||||
src/shared/netif-util.c | 2 +-
|
||||
src/test/test-arphrd-util.c | 2 +-
|
||||
src/udev/net/link-config.c | 1 +
|
||||
src/udev/udev-builtin-net_id.c | 3 ++-
|
||||
51 files changed, 71 insertions(+), 41 deletions(-)
|
||||
|
||||
diff --git a/src/basic/arphrd-util.c b/src/basic/arphrd-util.c
|
||||
index 3ea2c9d09a90..e21b60957376 100644
|
||||
--- a/src/basic/arphrd-util.c
|
||||
+++ b/src/basic/arphrd-util.c
|
||||
@@ -1,8 +1,9 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
#include <errno.h>
|
||||
+#include <net/if_arp.h>
|
||||
+#include <netinet/if_ether.h>
|
||||
#include <netinet/in.h>
|
||||
-#include <linux/if_arp.h>
|
||||
#include <linux/if_infiniband.h>
|
||||
#include <string.h>
|
||||
|
||||
diff --git a/src/basic/generate-arphrd-list.sh b/src/basic/generate-arphrd-list.sh
|
||||
index ca1ba7cad4d1..2e8fb64ba305 100755
|
||||
--- a/src/basic/generate-arphrd-list.sh
|
||||
+++ b/src/basic/generate-arphrd-list.sh
|
||||
@@ -3,6 +3,6 @@
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
-${1:?} -dM -include linux/if_arp.h -include "${2:?}" - </dev/null | \
|
||||
+${1:?} -dM -include net/if_arp.h -include "${2:?}" - </dev/null | \
|
||||
awk '/^#define[ \t]+ARPHRD_[^ \t]+[ \t]+[^ \t]/ { print $2; }' | \
|
||||
sed -e 's/ARPHRD_//'
|
||||
diff --git a/src/basic/socket-util.h b/src/basic/socket-util.h
|
||||
index c784125ccb42..4b759a42e648 100644
|
||||
--- a/src/basic/socket-util.h
|
||||
+++ b/src/basic/socket-util.h
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <linux/netlink.h>
|
||||
-#include <linux/if_ether.h>
|
||||
+#include <netinet/if_ether.h>
|
||||
#include <linux/if_infiniband.h>
|
||||
#include <linux/if_packet.h>
|
||||
#include <netinet/in.h>
|
||||
diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
|
||||
index 3e992d7cadcd..131bc83c614c 100644
|
||||
--- a/src/libsystemd-network/sd-dhcp6-client.c
|
||||
+++ b/src/libsystemd-network/sd-dhcp6-client.c
|
||||
@@ -4,8 +4,9 @@
|
||||
***/
|
||||
|
||||
#include <errno.h>
|
||||
+#include <net/if_arp.h>
|
||||
+#include <netinet/if_ether.h>
|
||||
#include <sys/ioctl.h>
|
||||
-#include <linux/if_arp.h>
|
||||
#include <linux/if_infiniband.h>
|
||||
|
||||
#include "sd-dhcp6-client.h"
|
||||
diff --git a/src/libsystemd/sd-netlink/netlink-message-rtnl.c b/src/libsystemd/sd-netlink/netlink-message-rtnl.c
|
||||
index fb11c7e02bb2..5159b122653c 100644
|
||||
--- a/src/libsystemd/sd-netlink/netlink-message-rtnl.c
|
||||
+++ b/src/libsystemd/sd-netlink/netlink-message-rtnl.c
|
||||
@@ -1,5 +1,6 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
+#include <netinet/if_ether.h>
|
||||
#include <netinet/in.h>
|
||||
#include <linux/fib_rules.h>
|
||||
#include <linux/if_addrlabel.h>
|
||||
diff --git a/src/libsystemd/sd-netlink/netlink-types-rtnl.c b/src/libsystemd/sd-netlink/netlink-types-rtnl.c
|
||||
index e39a75cfe475..dbf2583dd815 100644
|
||||
--- a/src/libsystemd/sd-netlink/netlink-types-rtnl.c
|
||||
+++ b/src/libsystemd/sd-netlink/netlink-types-rtnl.c
|
||||
@@ -1,5 +1,6 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
+#include <netinet/if_ether.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/socket.h>
|
||||
#include <linux/batman_adv.h>
|
||||
diff --git a/src/network/netdev/bareudp.c b/src/network/netdev/bareudp.c
|
||||
index 1df886573ba2..d324c716917b 100644
|
||||
--- a/src/network/netdev/bareudp.c
|
||||
+++ b/src/network/netdev/bareudp.c
|
||||
@@ -1,8 +1,9 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
* Copyright © 2020 VMware, Inc. */
|
||||
|
||||
+#include <net/if_arp.h>
|
||||
+#include <netinet/if_ether.h>
|
||||
#include <netinet/in.h>
|
||||
-#include <linux/if_arp.h>
|
||||
|
||||
#include "bareudp.h"
|
||||
#include "netlink-util.h"
|
||||
diff --git a/src/network/netdev/batadv.c b/src/network/netdev/batadv.c
|
||||
index 26da0231d459..dbdfc7f80ee2 100644
|
||||
--- a/src/network/netdev/batadv.c
|
||||
+++ b/src/network/netdev/batadv.c
|
||||
@@ -1,9 +1,9 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
#include <inttypes.h>
|
||||
+#include <net/if_arp.h>
|
||||
#include <netinet/in.h>
|
||||
#include <linux/genetlink.h>
|
||||
-#include <linux/if_arp.h>
|
||||
|
||||
#include "batadv.h"
|
||||
#include "fileio.h"
|
||||
diff --git a/src/network/netdev/bond.c b/src/network/netdev/bond.c
|
||||
index 52a7f126b6db..dc5d1fedb229 100644
|
||||
--- a/src/network/netdev/bond.c
|
||||
+++ b/src/network/netdev/bond.c
|
||||
@@ -1,7 +1,8 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
+#include <net/if_arp.h>
|
||||
+#include <netinet/if_ether.h>
|
||||
#include <netinet/in.h>
|
||||
-#include <linux/if_arp.h>
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "bond.h"
|
||||
diff --git a/src/network/netdev/bridge.c b/src/network/netdev/bridge.c
|
||||
index d426c0c5019f..0f60a7dfae9b 100644
|
||||
--- a/src/network/netdev/bridge.c
|
||||
+++ b/src/network/netdev/bridge.c
|
||||
@@ -2,9 +2,10 @@
|
||||
|
||||
/* Make sure the net/if.h header is included before any linux/ one */
|
||||
#include <net/if.h>
|
||||
-#include <linux/if_arp.h>
|
||||
-#include <linux/if_bridge.h>
|
||||
+#include <net/if_arp.h>
|
||||
+#include <netinet/if_ether.h>
|
||||
#include <netinet/in.h>
|
||||
+#include <linux/if_bridge.h>
|
||||
|
||||
#include "bridge.h"
|
||||
#include "netlink-util.h"
|
||||
diff --git a/src/network/netdev/dummy.c b/src/network/netdev/dummy.c
|
||||
index 00df1d278737..9e03d02b42ea 100644
|
||||
--- a/src/network/netdev/dummy.c
|
||||
+++ b/src/network/netdev/dummy.c
|
||||
@@ -1,6 +1,6 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
-#include <linux/if_arp.h>
|
||||
+#include <net/if_arp.h>
|
||||
|
||||
#include "dummy.h"
|
||||
|
||||
diff --git a/src/network/netdev/geneve.c b/src/network/netdev/geneve.c
|
||||
index 22c2b00e1b70..170aeddfd597 100644
|
||||
--- a/src/network/netdev/geneve.c
|
||||
+++ b/src/network/netdev/geneve.c
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
/* Make sure the net/if.h header is included before any linux/ one */
|
||||
#include <net/if.h>
|
||||
-#include <linux/if_arp.h>
|
||||
+#include <net/if_arp.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include "alloc-util.h"
|
||||
diff --git a/src/network/netdev/ifb.c b/src/network/netdev/ifb.c
|
||||
index d7ff44cb9ea6..747733139ac7 100644
|
||||
--- a/src/network/netdev/ifb.c
|
||||
+++ b/src/network/netdev/ifb.c
|
||||
@@ -1,7 +1,7 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
* Copyright © 2019 VMware, Inc. */
|
||||
|
||||
-#include <linux/if_arp.h>
|
||||
+#include <net/if_arp.h>
|
||||
|
||||
#include "ifb.h"
|
||||
|
||||
diff --git a/src/network/netdev/ipoib.c b/src/network/netdev/ipoib.c
|
||||
index d5fe299b7b43..a3d9309d7b5e 100644
|
||||
--- a/src/network/netdev/ipoib.c
|
||||
+++ b/src/network/netdev/ipoib.c
|
||||
@@ -1,6 +1,6 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
-#include <linux/if_arp.h>
|
||||
+#include <net/if_arp.h>
|
||||
#include <linux/if_link.h>
|
||||
|
||||
#include "ipoib.h"
|
||||
diff --git a/src/network/netdev/ipvlan.c b/src/network/netdev/ipvlan.c
|
||||
index 51ae64341db2..5908733b6b57 100644
|
||||
--- a/src/network/netdev/ipvlan.c
|
||||
+++ b/src/network/netdev/ipvlan.c
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
/* Make sure the net/if.h header is included before any linux/ one */
|
||||
#include <net/if.h>
|
||||
+#include <net/if_arp.h>
|
||||
#include <netinet/in.h>
|
||||
-#include <linux/if_arp.h>
|
||||
|
||||
#include "conf-parser.h"
|
||||
#include "ipvlan.h"
|
||||
diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c
|
||||
index 4b9f19cc95cf..58729ad29461 100644
|
||||
--- a/src/network/netdev/macsec.c
|
||||
+++ b/src/network/netdev/macsec.c
|
||||
@@ -1,7 +1,8 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
+#include <net/if_arp.h>
|
||||
+#include <netinet/if_ether.h>
|
||||
#include <netinet/in.h>
|
||||
-#include <linux/if_arp.h>
|
||||
#include <linux/if_ether.h>
|
||||
#include <linux/if_macsec.h>
|
||||
#include <linux/genetlink.h>
|
||||
diff --git a/src/network/netdev/macvlan.c b/src/network/netdev/macvlan.c
|
||||
index 21933d3970a1..adbe9817e7b3 100644
|
||||
--- a/src/network/netdev/macvlan.c
|
||||
+++ b/src/network/netdev/macvlan.c
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
/* Make sure the net/if.h header is included before any linux/ one */
|
||||
#include <net/if.h>
|
||||
+#include <net/if_arp.h>
|
||||
#include <netinet/in.h>
|
||||
-#include <linux/if_arp.h>
|
||||
|
||||
#include "conf-parser.h"
|
||||
#include "macvlan.h"
|
||||
diff --git a/src/network/netdev/netdev-gperf.gperf b/src/network/netdev/netdev-gperf.gperf
|
||||
index 4883a2652d46..3d2b560941de 100644
|
||||
--- a/src/network/netdev/netdev-gperf.gperf
|
||||
+++ b/src/network/netdev/netdev-gperf.gperf
|
||||
@@ -3,6 +3,7 @@
|
||||
#if __GNUC__ >= 7
|
||||
_Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"")
|
||||
#endif
|
||||
+#include <netinet/if_ether.h>
|
||||
#include <stddef.h>
|
||||
#include "bareudp.h"
|
||||
#include "batadv.h"
|
||||
diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c
|
||||
index 2b411425ba16..db44e67df621 100644
|
||||
--- a/src/network/netdev/netdev.c
|
||||
+++ b/src/network/netdev/netdev.c
|
||||
@@ -2,8 +2,9 @@
|
||||
|
||||
/* Make sure the net/if.h header is included before any linux/ one */
|
||||
#include <net/if.h>
|
||||
+#include <net/if_arp.h>
|
||||
+#include <netinet/if_ether.h>
|
||||
#include <netinet/in.h>
|
||||
-#include <linux/if_arp.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "alloc-util.h"
|
||||
diff --git a/src/network/netdev/netdevsim.c b/src/network/netdev/netdevsim.c
|
||||
index 15d5c132f967..8b1d3440325b 100644
|
||||
--- a/src/network/netdev/netdevsim.c
|
||||
+++ b/src/network/netdev/netdevsim.c
|
||||
@@ -1,6 +1,6 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
-#include <linux/if_arp.h>
|
||||
+#include <net/if_arp.h>
|
||||
|
||||
#include "netdevsim.h"
|
||||
|
||||
diff --git a/src/network/netdev/nlmon.c b/src/network/netdev/nlmon.c
|
||||
index ff372092e614..3118df501054 100644
|
||||
--- a/src/network/netdev/nlmon.c
|
||||
+++ b/src/network/netdev/nlmon.c
|
||||
@@ -1,6 +1,6 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
-#include <linux/if_arp.h>
|
||||
+#include <net/if_arp.h>
|
||||
|
||||
#include "nlmon.h"
|
||||
|
||||
diff --git a/src/network/netdev/tunnel.c b/src/network/netdev/tunnel.c
|
||||
index db84e7cf6eeb..1789f532b762 100644
|
||||
--- a/src/network/netdev/tunnel.c
|
||||
+++ b/src/network/netdev/tunnel.c
|
||||
@@ -1,8 +1,9 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
+#include <net/if_arp.h>
|
||||
+#include <netinet/if_ether.h>
|
||||
#include <netinet/in.h>
|
||||
#include <linux/fou.h>
|
||||
-#include <linux/if_arp.h>
|
||||
#include <linux/if_tunnel.h>
|
||||
#include <linux/ip.h>
|
||||
#include <linux/ip6_tunnel.h>
|
||||
diff --git a/src/network/netdev/tuntap.c b/src/network/netdev/tuntap.c
|
||||
index f5be31ed9438..06a0c3e616f0 100644
|
||||
--- a/src/network/netdev/tuntap.c
|
||||
+++ b/src/network/netdev/tuntap.c
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
/* Make sure the net/if.h header is included before any linux/ one */
|
||||
#include <net/if.h>
|
||||
+#include <netinet/if_ether.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <linux/if_tun.h>
|
||||
-#include <netinet/if_ether.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
diff --git a/src/network/netdev/vcan.c b/src/network/netdev/vcan.c
|
||||
index 380547ee1e85..5dbf74f10c4d 100644
|
||||
--- a/src/network/netdev/vcan.c
|
||||
+++ b/src/network/netdev/vcan.c
|
||||
@@ -1,6 +1,6 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
-#include <linux/if_arp.h>
|
||||
+#include <net/if_arp.h>
|
||||
|
||||
#include "vcan.h"
|
||||
|
||||
diff --git a/src/network/netdev/veth.c b/src/network/netdev/veth.c
|
||||
index 78555286d1a4..4dc4ed146a8a 100644
|
||||
--- a/src/network/netdev/veth.c
|
||||
+++ b/src/network/netdev/veth.c
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
/* Make sure the net/if.h header is included before any linux/ one */
|
||||
#include <net/if.h>
|
||||
+#include <net/if_arp.h>
|
||||
#include <errno.h>
|
||||
-#include <linux/if_arp.h>
|
||||
#include <linux/veth.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
diff --git a/src/network/netdev/vlan.c b/src/network/netdev/vlan.c
|
||||
index 60e49a5b8a9a..1dd2b962ac86 100644
|
||||
--- a/src/network/netdev/vlan.c
|
||||
+++ b/src/network/netdev/vlan.c
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
/* Make sure the net/if.h header is included before any linux/ one */
|
||||
#include <net/if.h>
|
||||
+#include <net/if_arp.h>
|
||||
#include <errno.h>
|
||||
-#include <linux/if_arp.h>
|
||||
#include <linux/if_vlan.h>
|
||||
|
||||
#include "parse-util.h"
|
||||
diff --git a/src/network/netdev/vrf.c b/src/network/netdev/vrf.c
|
||||
index 24079a7203c8..9108c891cc13 100644
|
||||
--- a/src/network/netdev/vrf.c
|
||||
+++ b/src/network/netdev/vrf.c
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
/* Make sure the net/if.h header is included before any linux/ one */
|
||||
#include <net/if.h>
|
||||
-#include <linux/if_arp.h>
|
||||
+#include <net/if_arp.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include "vrf.h"
|
||||
diff --git a/src/network/netdev/vxcan.c b/src/network/netdev/vxcan.c
|
||||
index c0343f45b621..7d74950c33fa 100644
|
||||
--- a/src/network/netdev/vxcan.c
|
||||
+++ b/src/network/netdev/vxcan.c
|
||||
@@ -1,7 +1,7 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
+#include <net/if_arp.h>
|
||||
#include <linux/can/vxcan.h>
|
||||
-#include <linux/if_arp.h>
|
||||
|
||||
#include "vxcan.h"
|
||||
|
||||
diff --git a/src/network/netdev/vxlan.c b/src/network/netdev/vxlan.c
|
||||
index 37f65967a6bd..065b3966bd79 100644
|
||||
--- a/src/network/netdev/vxlan.c
|
||||
+++ b/src/network/netdev/vxlan.c
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
/* Make sure the net/if.h header is included before any linux/ one */
|
||||
#include <net/if.h>
|
||||
+#include <net/if_arp.h>
|
||||
#include <netinet/in.h>
|
||||
-#include <linux/if_arp.h>
|
||||
|
||||
#include "conf-parser.h"
|
||||
#include "alloc-util.h"
|
||||
diff --git a/src/network/netdev/wireguard.c b/src/network/netdev/wireguard.c
|
||||
index fed1be8d1104..ff4d1c1bc501 100644
|
||||
--- a/src/network/netdev/wireguard.c
|
||||
+++ b/src/network/netdev/wireguard.c
|
||||
@@ -5,9 +5,10 @@
|
||||
|
||||
/* Make sure the net/if.h header is included before any linux/ one */
|
||||
#include <net/if.h>
|
||||
-#include <linux/if_arp.h>
|
||||
-#include <linux/ipv6_route.h>
|
||||
+#include <net/if_arp.h>
|
||||
+#include <netinet/if_ether.h>
|
||||
#include <netinet/in.h>
|
||||
+#include <linux/ipv6_route.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include "sd-resolve.h"
|
||||
diff --git a/src/network/netdev/xfrm.c b/src/network/netdev/xfrm.c
|
||||
index 905bfc0bdf03..c4a226da19a0 100644
|
||||
--- a/src/network/netdev/xfrm.c
|
||||
+++ b/src/network/netdev/xfrm.c
|
||||
@@ -1,6 +1,6 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
-#include <linux/if_arp.h>
|
||||
+#include <net/if_arp.h>
|
||||
|
||||
#include "missing_network.h"
|
||||
#include "xfrm.h"
|
||||
diff --git a/src/network/networkctl.c b/src/network/networkctl.c
|
||||
index a447c39a6414..0dbdbe0837f2 100644
|
||||
--- a/src/network/networkctl.c
|
||||
+++ b/src/network/networkctl.c
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
/* Make sure the net/if.h header is included before any linux/ one */
|
||||
#include <net/if.h>
|
||||
+#include <net/ethernet.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <getopt.h>
|
||||
#include <linux/if_addrlabel.h>
|
||||
diff --git a/src/network/networkd-bridge-mdb.c b/src/network/networkd-bridge-mdb.c
|
||||
index 7ff4a1884671..9b417e3bf58b 100644
|
||||
--- a/src/network/networkd-bridge-mdb.c
|
||||
+++ b/src/network/networkd-bridge-mdb.c
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
/* Make sure the net/if.h header is included before any linux/ one */
|
||||
#include <net/if.h>
|
||||
+#include <netinet/if_ether.h>
|
||||
+#include <netinet/in.h>
|
||||
#include <linux/if_bridge.h>
|
||||
|
||||
#include "netlink-util.h"
|
||||
diff --git a/src/network/networkd-bridge-vlan.c b/src/network/networkd-bridge-vlan.c
|
||||
index 0deffa46510d..94b15550205a 100644
|
||||
--- a/src/network/networkd-bridge-vlan.c
|
||||
+++ b/src/network/networkd-bridge-vlan.c
|
||||
@@ -3,6 +3,7 @@
|
||||
Copyright © 2016 BISDN GmbH. All rights reserved.
|
||||
***/
|
||||
|
||||
+#include <netinet/if_ether.h>
|
||||
#include <netinet/in.h>
|
||||
#include <linux/if_bridge.h>
|
||||
#include <stdbool.h>
|
||||
diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c
|
||||
index 9f0268d934e4..a452dafb8a97 100644
|
||||
--- a/src/network/networkd-dhcp-common.c
|
||||
+++ b/src/network/networkd-dhcp-common.c
|
||||
@@ -1,7 +1,9 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
+#include <net/if.h>
|
||||
+#include <net/if_arp.h>
|
||||
+#include <netinet/if_ether.h>
|
||||
#include <netinet/in.h>
|
||||
-#include <linux/if_arp.h>
|
||||
|
||||
#include "bus-error.h"
|
||||
#include "bus-locator.h"
|
||||
diff --git a/src/network/networkd-dhcp-prefix-delegation.c b/src/network/networkd-dhcp-prefix-delegation.c
|
||||
index 2e660b77631a..25b3fb747406 100644
|
||||
--- a/src/network/networkd-dhcp-prefix-delegation.c
|
||||
+++ b/src/network/networkd-dhcp-prefix-delegation.c
|
||||
@@ -1,5 +1,6 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
+#include <netinet/in.h>
|
||||
#include <linux/ipv6_route.h>
|
||||
|
||||
#include "dhcp6-lease-internal.h"
|
||||
diff --git a/src/network/networkd-dhcp-server.c b/src/network/networkd-dhcp-server.c
|
||||
index c35102af74a5..8fb7700e8cd3 100644
|
||||
--- a/src/network/networkd-dhcp-server.c
|
||||
+++ b/src/network/networkd-dhcp-server.c
|
||||
@@ -1,7 +1,8 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
+#include <net/if_arp.h>
|
||||
+#include <netinet/if_ether.h>
|
||||
#include <netinet/in.h>
|
||||
-#include <linux/if_arp.h>
|
||||
#include <linux/if.h>
|
||||
|
||||
#include "sd-dhcp-server.h"
|
||||
diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
|
||||
index 4dd6044b1897..359a8bd3b5e2 100644
|
||||
--- a/src/network/networkd-dhcp4.c
|
||||
+++ b/src/network/networkd-dhcp4.c
|
||||
@@ -1,9 +1,10 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
+#include <net/if_arp.h>
|
||||
+#include <netinet/if_ether.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <linux/if.h>
|
||||
-#include <linux/if_arp.h>
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "dhcp-client-internal.h"
|
||||
diff --git a/src/network/networkd-ipv6ll.c b/src/network/networkd-ipv6ll.c
|
||||
index 32229a3fc70e..5e5d2926f3e2 100644
|
||||
--- a/src/network/networkd-ipv6ll.c
|
||||
+++ b/src/network/networkd-ipv6ll.c
|
||||
@@ -1,7 +1,7 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
+#include <net/if_arp.h>
|
||||
#include <linux/if.h>
|
||||
-#include <linux/if_arp.h>
|
||||
|
||||
#include "in-addr-util.h"
|
||||
#include "networkd-address.h"
|
||||
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
|
||||
index 9ce75361fdca..17ab1b38be15 100644
|
||||
--- a/src/network/networkd-link.c
|
||||
+++ b/src/network/networkd-link.c
|
||||
@@ -2,9 +2,10 @@
|
||||
|
||||
/* Make sure the net/if.h header is included before any linux/ one */
|
||||
#include <net/if.h>
|
||||
+#include <net/if_arp.h>
|
||||
+#include <netinet/if_ether.h>
|
||||
#include <netinet/in.h>
|
||||
#include <linux/if.h>
|
||||
-#include <linux/if_arp.h>
|
||||
#include <linux/if_link.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <sys/socket.h>
|
||||
diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c
|
||||
index 84558a5afc5c..23a0dc06172f 100644
|
||||
--- a/src/network/networkd-ndisc.c
|
||||
+++ b/src/network/networkd-ndisc.c
|
||||
@@ -4,9 +4,10 @@
|
||||
***/
|
||||
|
||||
#include <arpa/inet.h>
|
||||
+#include <net/if_arp.h>
|
||||
+#include <netinet/if_ether.h>
|
||||
#include <netinet/icmp6.h>
|
||||
#include <linux/if.h>
|
||||
-#include <linux/if_arp.h>
|
||||
|
||||
#include "sd-ndisc.h"
|
||||
|
||||
diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c
|
||||
index 8232db06c934..fd3599420831 100644
|
||||
--- a/src/network/networkd-network.c
|
||||
+++ b/src/network/networkd-network.c
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
/* Make sure the net/if.h header is included before any linux/ one */
|
||||
#include <net/if.h>
|
||||
+#include <netinet/if_ether.h>
|
||||
#include <netinet/in.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <unistd.h>
|
||||
diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c
|
||||
index d596fd81e63c..e2dcc87f6c2e 100644
|
||||
--- a/src/network/networkd-route.c
|
||||
+++ b/src/network/networkd-route.c
|
||||
@@ -1,5 +1,6 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
+#include <netinet/in.h>
|
||||
#include <linux/ipv6_route.h>
|
||||
#include <linux/nexthop.h>
|
||||
|
||||
diff --git a/src/network/networkd-setlink.c b/src/network/networkd-setlink.c
|
||||
index 058bc00ba10b..3f84f9ca58a5 100644
|
||||
--- a/src/network/networkd-setlink.c
|
||||
+++ b/src/network/networkd-setlink.c
|
||||
@@ -1,8 +1,9 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
+#include <net/if_arp.h>
|
||||
+#include <netinet/if_ether.h>
|
||||
#include <netinet/in.h>
|
||||
#include <linux/if.h>
|
||||
-#include <linux/if_arp.h>
|
||||
#include <linux/if_bridge.h>
|
||||
|
||||
#include "missing_network.h"
|
||||
diff --git a/src/network/networkd-sysctl.c b/src/network/networkd-sysctl.c
|
||||
index 68c23e0eb796..fb56ee006fdc 100644
|
||||
--- a/src/network/networkd-sysctl.c
|
||||
+++ b/src/network/networkd-sysctl.c
|
||||
@@ -1,8 +1,8 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
+#include <net/if_arp.h>
|
||||
#include <netinet/in.h>
|
||||
#include <linux/if.h>
|
||||
-#include <linux/if_arp.h>
|
||||
|
||||
#include "af-list.h"
|
||||
#include "missing_network.h"
|
||||
diff --git a/src/network/test-network-tables.c b/src/network/test-network-tables.c
|
||||
index f4e14c6d9b30..bc8378c9c946 100644
|
||||
--- a/src/network/test-network-tables.c
|
||||
+++ b/src/network/test-network-tables.c
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
/* Make sure the net/if.h header is included before any linux/ one */
|
||||
#include <net/if.h>
|
||||
+#include <net/ethernet.h>
|
||||
#include <linux/if.h>
|
||||
|
||||
#include "bond.h"
|
||||
diff --git a/src/shared/ethtool-util.c b/src/shared/ethtool-util.c
|
||||
index 1e100c35ef53..2a28b14d6fc5 100644
|
||||
--- a/src/shared/ethtool-util.c
|
||||
+++ b/src/shared/ethtool-util.c
|
||||
@@ -1,6 +1,7 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
#include <net/if.h>
|
||||
+#include <netinet/if_ether.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <linux/ethtool.h>
|
||||
#include <linux/netdevice.h>
|
||||
diff --git a/src/shared/netif-util.c b/src/shared/netif-util.c
|
||||
index 8adc2c89c814..393db78123ca 100644
|
||||
--- a/src/shared/netif-util.c
|
||||
+++ b/src/shared/netif-util.c
|
||||
@@ -1,7 +1,7 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
+#include <net/if_arp.h>
|
||||
#include <linux/if.h>
|
||||
-#include <linux/if_arp.h>
|
||||
|
||||
#include "arphrd-util.h"
|
||||
#include "device-util.h"
|
||||
diff --git a/src/test/test-arphrd-util.c b/src/test/test-arphrd-util.c
|
||||
index 15b799775043..00072979111a 100644
|
||||
--- a/src/test/test-arphrd-util.c
|
||||
+++ b/src/test/test-arphrd-util.c
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
/* Make sure the net/if.h header is included before any linux/ one */
|
||||
#include <net/if.h>
|
||||
-#include <linux/if_arp.h>
|
||||
+#include <net/if_arp.h>
|
||||
|
||||
#include "arphrd-util.h"
|
||||
#include "string-util.h"
|
||||
diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c
|
||||
index 647cdeeb9dba..0325cb3a8e97 100644
|
||||
--- a/src/udev/net/link-config.c
|
||||
+++ b/src/udev/net/link-config.c
|
||||
@@ -1,5 +1,6 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
+#include <netinet/if_ether.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <netinet/ether.h>
|
||||
#include <unistd.h>
|
||||
diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
|
||||
index 384a1f31cbc4..2c97e9651eda 100644
|
||||
--- a/src/udev/udev-builtin-net_id.c
|
||||
+++ b/src/udev/udev-builtin-net_id.c
|
||||
@@ -14,12 +14,13 @@
|
||||
|
||||
/* Make sure the net/if.h header is included before any linux/ one */
|
||||
#include <net/if.h>
|
||||
+#include <net/if_arp.h>
|
||||
+#include <netinet/if_ether.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdarg.h>
|
||||
#include <unistd.h>
|
||||
#include <linux/if.h>
|
||||
-#include <linux/if_arp.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/pci_regs.h>
|
||||
|
||||
--
|
||||
2.41.0
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
From 8c528bcfd198d318fc25b4e75874e74449c2f020 Mon Sep 17 00:00:00 2001
|
||||
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
|
||||
Date: Sun, 18 Aug 2024 02:26:39 -0500
|
||||
Subject: [PATCH 06/34] test: $PATH += /sbin so fstab-generator finds fsck
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Our fsck is in /sbin, not /usr/sbin. (Likely, Debian's was in /sbin
|
||||
before the ill-advised usr-merge, too.)
|
||||
|
||||
This cannot be upstreamed.
|
||||
|
||||
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
||||
---
|
||||
test/test-fstab-generator.sh | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/test/test-fstab-generator.sh b/test/test-fstab-generator.sh
|
||||
index 476312133e43..c265c60e03d6 100755
|
||||
--- a/test/test-fstab-generator.sh
|
||||
+++ b/test/test-fstab-generator.sh
|
||||
@@ -17,7 +17,7 @@ fi
|
||||
src="$(dirname "$0")/testdata/test-fstab-generator"
|
||||
|
||||
# fsck(8) is located in /usr/sbin on Debian
|
||||
-PATH=$PATH:/usr/sbin
|
||||
+PATH=$PATH:/usr/sbin:/sbin
|
||||
|
||||
# systemd-pcrfs@.service could be enabled or not, depending on the host state
|
||||
# of the host system. Override the measurement to avoid the issue.
|
||||
--
|
||||
2.41.0
|
||||
|
||||
416
sys-apps/systemd/files/0007-Handle-lack-of-printf.h.patch
Normal file
416
sys-apps/systemd/files/0007-Handle-lack-of-printf.h.patch
Normal file
@@ -0,0 +1,416 @@
|
||||
From 93a4b034c58490d73a7eaae26d262b7de3d19ef6 Mon Sep 17 00:00:00 2001
|
||||
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
|
||||
Date: Sun, 18 Aug 2024 02:32:31 -0500
|
||||
Subject: [PATCH 07/34] Handle lack of <printf.h>
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
We are more portable about it than most other patchsets, and we
|
||||
conditionalise it well enough, but I doubt upstream will accept this.
|
||||
|
||||
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
||||
---
|
||||
meson.build | 1 +
|
||||
src/basic/meson.build | 5 +
|
||||
src/basic/parse-printf-format.c | 273 ++++++++++++++++++++++++++++++++
|
||||
src/basic/parse-printf-format.h | 57 +++++++
|
||||
src/basic/stdio-util.h | 6 +-
|
||||
5 files changed, 341 insertions(+), 1 deletion(-)
|
||||
create mode 100644 src/basic/parse-printf-format.c
|
||||
create mode 100644 src/basic/parse-printf-format.h
|
||||
|
||||
diff --git a/meson.build b/meson.build
|
||||
index c068acc169a3..b11f73dc0c20 100644
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -800,6 +800,7 @@ foreach header : ['crypt.h',
|
||||
'linux/memfd.h',
|
||||
'linux/time_types.h',
|
||||
'linux/vm_sockets.h',
|
||||
+ 'printf.h',
|
||||
'sys/auxv.h',
|
||||
'sys/sdt.h',
|
||||
'threads.h',
|
||||
diff --git a/src/basic/meson.build b/src/basic/meson.build
|
||||
index b538775576ab..ed5ce81876bc 100644
|
||||
--- a/src/basic/meson.build
|
||||
+++ b/src/basic/meson.build
|
||||
@@ -189,6 +189,11 @@ endforeach
|
||||
|
||||
basic_sources += generated_gperf_headers
|
||||
|
||||
+if conf.get('HAVE_PRINTF_H') != 1
|
||||
+ basic_sources += [files('parse-printf-format.c')]
|
||||
+endif
|
||||
+
|
||||
+
|
||||
############################################################
|
||||
|
||||
arch_list = [
|
||||
diff --git a/src/basic/parse-printf-format.c b/src/basic/parse-printf-format.c
|
||||
new file mode 100644
|
||||
index 000000000000..49437e544540
|
||||
--- /dev/null
|
||||
+++ b/src/basic/parse-printf-format.c
|
||||
@@ -0,0 +1,273 @@
|
||||
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
|
||||
+
|
||||
+/***
|
||||
+ This file is part of systemd.
|
||||
+
|
||||
+ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
|
||||
+
|
||||
+ With parts from the musl C library
|
||||
+ Copyright 2005-2014 Rich Felker, et al.
|
||||
+
|
||||
+ systemd is free software; you can redistribute it and/or modify it
|
||||
+ under the terms of the GNU Lesser General Public License as published by
|
||||
+ the Free Software Foundation; either version 2.1 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ systemd 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
|
||||
+ Lesser General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU Lesser General Public License
|
||||
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
+***/
|
||||
+
|
||||
+#include <stddef.h>
|
||||
+#include <string.h>
|
||||
+
|
||||
+#include "parse-printf-format.h"
|
||||
+
|
||||
+static const char *consume_nonarg(const char *fmt)
|
||||
+{
|
||||
+ do {
|
||||
+ if (*fmt == '\0')
|
||||
+ return fmt;
|
||||
+ } while (*fmt++ != '%');
|
||||
+ return fmt;
|
||||
+}
|
||||
+
|
||||
+static const char *consume_num(const char *fmt)
|
||||
+{
|
||||
+ for (;*fmt >= '0' && *fmt <= '9'; fmt++)
|
||||
+ /* do nothing */;
|
||||
+ return fmt;
|
||||
+}
|
||||
+
|
||||
+static const char *consume_argn(const char *fmt, size_t *arg)
|
||||
+{
|
||||
+ const char *p = fmt;
|
||||
+ size_t val = 0;
|
||||
+
|
||||
+ if (*p < '1' || *p > '9')
|
||||
+ return fmt;
|
||||
+ do {
|
||||
+ val = 10*val + (*p++ - '0');
|
||||
+ } while (*p >= '0' && *p <= '9');
|
||||
+
|
||||
+ if (*p != '$')
|
||||
+ return fmt;
|
||||
+ *arg = val;
|
||||
+ return p+1;
|
||||
+}
|
||||
+
|
||||
+static const char *consume_flags(const char *fmt)
|
||||
+{
|
||||
+ while (1) {
|
||||
+ switch (*fmt) {
|
||||
+ case '#':
|
||||
+ case '0':
|
||||
+ case '-':
|
||||
+ case ' ':
|
||||
+ case '+':
|
||||
+ case '\'':
|
||||
+ case 'I':
|
||||
+ fmt++;
|
||||
+ continue;
|
||||
+ }
|
||||
+ return fmt;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+enum state {
|
||||
+ BARE,
|
||||
+ LPRE,
|
||||
+ LLPRE,
|
||||
+ HPRE,
|
||||
+ HHPRE,
|
||||
+ BIGLPRE,
|
||||
+ ZTPRE,
|
||||
+ JPRE,
|
||||
+ STOP
|
||||
+};
|
||||
+
|
||||
+enum type {
|
||||
+ NONE,
|
||||
+ PTR,
|
||||
+ INT,
|
||||
+ UINT,
|
||||
+ ULLONG,
|
||||
+ LONG,
|
||||
+ ULONG,
|
||||
+ SHORT,
|
||||
+ USHORT,
|
||||
+ CHAR,
|
||||
+ UCHAR,
|
||||
+ LLONG,
|
||||
+ SIZET,
|
||||
+ IMAX,
|
||||
+ UMAX,
|
||||
+ PDIFF,
|
||||
+ UIPTR,
|
||||
+ DBL,
|
||||
+ LDBL,
|
||||
+ MAXTYPE
|
||||
+};
|
||||
+
|
||||
+static const short pa_types[MAXTYPE] = {
|
||||
+ [NONE] = PA_INT,
|
||||
+ [PTR] = PA_POINTER,
|
||||
+ [INT] = PA_INT,
|
||||
+ [UINT] = PA_INT,
|
||||
+ [ULLONG] = PA_INT | PA_FLAG_LONG_LONG,
|
||||
+ [LONG] = PA_INT | PA_FLAG_LONG,
|
||||
+ [ULONG] = PA_INT | PA_FLAG_LONG,
|
||||
+ [SHORT] = PA_INT | PA_FLAG_SHORT,
|
||||
+ [USHORT] = PA_INT | PA_FLAG_SHORT,
|
||||
+ [CHAR] = PA_CHAR,
|
||||
+ [UCHAR] = PA_CHAR,
|
||||
+ [LLONG] = PA_INT | PA_FLAG_LONG_LONG,
|
||||
+ [SIZET] = PA_INT | PA_FLAG_LONG,
|
||||
+ [IMAX] = PA_INT | PA_FLAG_LONG_LONG,
|
||||
+ [UMAX] = PA_INT | PA_FLAG_LONG_LONG,
|
||||
+ [PDIFF] = PA_INT | PA_FLAG_LONG_LONG,
|
||||
+ [UIPTR] = PA_INT | PA_FLAG_LONG,
|
||||
+ [DBL] = PA_DOUBLE,
|
||||
+ [LDBL] = PA_DOUBLE | PA_FLAG_LONG_DOUBLE
|
||||
+};
|
||||
+
|
||||
+#define S(x) [(x)-'A']
|
||||
+#define E(x) (STOP + (x))
|
||||
+
|
||||
+static const unsigned char states[]['z'-'A'+1] = {
|
||||
+ { /* 0: bare types */
|
||||
+ S('d') = E(INT), S('i') = E(INT),
|
||||
+ S('o') = E(UINT),S('u') = E(UINT),S('x') = E(UINT), S('X') = E(UINT),
|
||||
+ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
|
||||
+ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
|
||||
+ S('c') = E(CHAR),S('C') = E(INT),
|
||||
+ S('s') = E(PTR), S('S') = E(PTR), S('p') = E(UIPTR),S('n') = E(PTR),
|
||||
+ S('m') = E(NONE),
|
||||
+ S('l') = LPRE, S('h') = HPRE, S('L') = BIGLPRE,
|
||||
+ S('z') = ZTPRE, S('j') = JPRE, S('t') = ZTPRE
|
||||
+ }, { /* 1: l-prefixed */
|
||||
+ S('d') = E(LONG), S('i') = E(LONG),
|
||||
+ S('o') = E(ULONG),S('u') = E(ULONG),S('x') = E(ULONG),S('X') = E(ULONG),
|
||||
+ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
|
||||
+ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
|
||||
+ S('c') = E(INT), S('s') = E(PTR), S('n') = E(PTR),
|
||||
+ S('l') = LLPRE
|
||||
+ }, { /* 2: ll-prefixed */
|
||||
+ S('d') = E(LLONG), S('i') = E(LLONG),
|
||||
+ S('o') = E(ULLONG),S('u') = E(ULLONG),
|
||||
+ S('x') = E(ULLONG),S('X') = E(ULLONG),
|
||||
+ S('n') = E(PTR)
|
||||
+ }, { /* 3: h-prefixed */
|
||||
+ S('d') = E(SHORT), S('i') = E(SHORT),
|
||||
+ S('o') = E(USHORT),S('u') = E(USHORT),
|
||||
+ S('x') = E(USHORT),S('X') = E(USHORT),
|
||||
+ S('n') = E(PTR),
|
||||
+ S('h') = HHPRE
|
||||
+ }, { /* 4: hh-prefixed */
|
||||
+ S('d') = E(CHAR), S('i') = E(CHAR),
|
||||
+ S('o') = E(UCHAR),S('u') = E(UCHAR),
|
||||
+ S('x') = E(UCHAR),S('X') = E(UCHAR),
|
||||
+ S('n') = E(PTR)
|
||||
+ }, { /* 5: L-prefixed */
|
||||
+ S('e') = E(LDBL),S('f') = E(LDBL),S('g') = E(LDBL), S('a') = E(LDBL),
|
||||
+ S('E') = E(LDBL),S('F') = E(LDBL),S('G') = E(LDBL), S('A') = E(LDBL),
|
||||
+ S('n') = E(PTR)
|
||||
+ }, { /* 6: z- or t-prefixed (assumed to be same size) */
|
||||
+ S('d') = E(PDIFF),S('i') = E(PDIFF),
|
||||
+ S('o') = E(SIZET),S('u') = E(SIZET),
|
||||
+ S('x') = E(SIZET),S('X') = E(SIZET),
|
||||
+ S('n') = E(PTR)
|
||||
+ }, { /* 7: j-prefixed */
|
||||
+ S('d') = E(IMAX), S('i') = E(IMAX),
|
||||
+ S('o') = E(UMAX), S('u') = E(UMAX),
|
||||
+ S('x') = E(UMAX), S('X') = E(UMAX),
|
||||
+ S('n') = E(PTR)
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+size_t parse_printf_format(const char *fmt, size_t n, int *types)
|
||||
+{
|
||||
+ size_t i = 0;
|
||||
+ size_t last = 0;
|
||||
+
|
||||
+ memset(types, 0, n);
|
||||
+
|
||||
+ while (1) {
|
||||
+ size_t arg;
|
||||
+ unsigned int state;
|
||||
+
|
||||
+ fmt = consume_nonarg(fmt);
|
||||
+ if (*fmt == '\0')
|
||||
+ break;
|
||||
+ if (*fmt == '%') {
|
||||
+ fmt++;
|
||||
+ continue;
|
||||
+ }
|
||||
+ arg = 0;
|
||||
+ fmt = consume_argn(fmt, &arg);
|
||||
+ /* flags */
|
||||
+ fmt = consume_flags(fmt);
|
||||
+ /* width */
|
||||
+ if (*fmt == '*') {
|
||||
+ size_t warg = 0;
|
||||
+ fmt = consume_argn(fmt+1, &warg);
|
||||
+ if (warg == 0)
|
||||
+ warg = ++i;
|
||||
+ if (warg > last)
|
||||
+ last = warg;
|
||||
+ if (warg <= n && types[warg-1] == NONE)
|
||||
+ types[warg-1] = INT;
|
||||
+ } else
|
||||
+ fmt = consume_num(fmt);
|
||||
+ /* precision */
|
||||
+ if (*fmt == '.') {
|
||||
+ fmt++;
|
||||
+ if (*fmt == '*') {
|
||||
+ size_t parg = 0;
|
||||
+ fmt = consume_argn(fmt+1, &parg);
|
||||
+ if (parg == 0)
|
||||
+ parg = ++i;
|
||||
+ if (parg > last)
|
||||
+ last = parg;
|
||||
+ if (parg <= n && types[parg-1] == NONE)
|
||||
+ types[parg-1] = INT;
|
||||
+ } else {
|
||||
+ if (*fmt == '-')
|
||||
+ fmt++;
|
||||
+ fmt = consume_num(fmt);
|
||||
+ }
|
||||
+ }
|
||||
+ /* length modifier and conversion specifier */
|
||||
+ state = BARE;
|
||||
+ do {
|
||||
+ unsigned char c = *fmt++;
|
||||
+
|
||||
+ if (c < 'A' || c > 'z')
|
||||
+ continue;
|
||||
+ state = states[state]S(c);
|
||||
+ if (state == 0)
|
||||
+ continue;
|
||||
+ } while (state < STOP);
|
||||
+
|
||||
+ if (state == E(NONE))
|
||||
+ continue;
|
||||
+
|
||||
+ if (arg == 0)
|
||||
+ arg = ++i;
|
||||
+ if (arg > last)
|
||||
+ last = arg;
|
||||
+ if (arg <= n)
|
||||
+ types[arg-1] = state - STOP;
|
||||
+ }
|
||||
+
|
||||
+ if (last > n)
|
||||
+ last = n;
|
||||
+ for (i = 0; i < last; i++)
|
||||
+ types[i] = pa_types[types[i]];
|
||||
+
|
||||
+ return last;
|
||||
+}
|
||||
diff --git a/src/basic/parse-printf-format.h b/src/basic/parse-printf-format.h
|
||||
new file mode 100644
|
||||
index 000000000000..47be7522d7fa
|
||||
--- /dev/null
|
||||
+++ b/src/basic/parse-printf-format.h
|
||||
@@ -0,0 +1,57 @@
|
||||
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
|
||||
+
|
||||
+/***
|
||||
+ This file is part of systemd.
|
||||
+
|
||||
+ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
|
||||
+
|
||||
+ With parts from the GNU C Library
|
||||
+ Copyright 1991-2014 Free Software Foundation, Inc.
|
||||
+
|
||||
+ systemd is free software; you can redistribute it and/or modify it
|
||||
+ under the terms of the GNU Lesser General Public License as published by
|
||||
+ the Free Software Foundation; either version 2.1 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ systemd 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
|
||||
+ Lesser General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU Lesser General Public License
|
||||
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
+***/
|
||||
+
|
||||
+#pragma once
|
||||
+
|
||||
+#include "config.h"
|
||||
+
|
||||
+#if HAVE_PRINTF_H
|
||||
+#include <printf.h>
|
||||
+#else
|
||||
+
|
||||
+#include <stddef.h>
|
||||
+
|
||||
+enum { /* C type: */
|
||||
+ PA_INT, /* int */
|
||||
+ PA_CHAR, /* int, cast to char */
|
||||
+ PA_WCHAR, /* wide char */
|
||||
+ PA_STRING, /* const char *, a '\0'-terminated string */
|
||||
+ PA_WSTRING, /* const wchar_t *, wide character string */
|
||||
+ PA_POINTER, /* void * */
|
||||
+ PA_FLOAT, /* float */
|
||||
+ PA_DOUBLE, /* double */
|
||||
+ PA_LAST
|
||||
+};
|
||||
+
|
||||
+/* Flag bits that can be set in a type returned by `parse_printf_format'. */
|
||||
+#define PA_FLAG_MASK 0xff00
|
||||
+#define PA_FLAG_LONG_LONG (1 << 8)
|
||||
+#define PA_FLAG_LONG_DOUBLE PA_FLAG_LONG_LONG
|
||||
+#define PA_FLAG_LONG (1 << 9)
|
||||
+#define PA_FLAG_SHORT (1 << 10)
|
||||
+#define PA_FLAG_PTR (1 << 11)
|
||||
+
|
||||
+size_t parse_printf_format(const char *fmt, size_t n, int *types);
|
||||
+
|
||||
+#endif /* HAVE_PRINTF_H */
|
||||
diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h
|
||||
index 0a2239d02259..259255fc651d 100644
|
||||
--- a/src/basic/stdio-util.h
|
||||
+++ b/src/basic/stdio-util.h
|
||||
@@ -1,12 +1,16 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
#pragma once
|
||||
|
||||
-#include <printf.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "macro.h"
|
||||
+#if HAVE_PRINTF_H
|
||||
+#include <printf.h>
|
||||
+#else
|
||||
+#include "parse-printf-format.h"
|
||||
+#endif
|
||||
|
||||
_printf_(3, 4)
|
||||
static inline char* snprintf_ok(char *buf, size_t len, const char *format, ...) {
|
||||
--
|
||||
2.41.0
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
From eb5cb893099e14f9228a114b3647df602a1c831e Mon Sep 17 00:00:00 2001
|
||||
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
|
||||
Date: Sun, 18 Aug 2024 02:34:01 -0500
|
||||
Subject: [PATCH 08/34] test: Ensure sysusers test 11 passes on musl libc
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
musl will skip invalid lines, like the o1 group in the sysusers test.
|
||||
Make the line valid so that the test passes.
|
||||
|
||||
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
||||
---
|
||||
test/test-sysusers/test-11.initial-group | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/test/test-sysusers/test-11.initial-group b/test/test-sysusers/test-11.initial-group
|
||||
index 88d31f2c729a..df98ae771c5f 100644
|
||||
--- a/test/test-sysusers/test-11.initial-group
|
||||
+++ b/test/test-sysusers/test-11.initial-group
|
||||
@@ -1,4 +1,4 @@
|
||||
-o1:x:100
|
||||
+o1:x:100:
|
||||
+giant:::bill,tina,alan,hetty
|
||||
-transport:::
|
||||
+:::
|
||||
--
|
||||
2.41.0
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
From 8356019ca35e557a98fbb5ccfbc5b60f64ea38d5 Mon Sep 17 00:00:00 2001
|
||||
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
|
||||
Date: Sun, 18 Aug 2024 02:34:45 -0500
|
||||
Subject: [PATCH 09/34] test: Change expected message for unhappy sysusers
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The error string for ERANGE is different between musl and glibc.
|
||||
|
||||
This cannot be upstreamed.
|
||||
|
||||
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
||||
---
|
||||
test/test-sysusers/unhappy-1.expected-err | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/test/test-sysusers/unhappy-1.expected-err b/test/test-sysusers/unhappy-1.expected-err
|
||||
index f6b1b3c5e6f0..17da5bd2537b 100644
|
||||
--- a/test/test-sysusers/unhappy-1.expected-err
|
||||
+++ b/test/test-sysusers/unhappy-1.expected-err
|
||||
@@ -1 +1 @@
|
||||
- Failed to parse UID: '9999999999': Numerical result out of range
|
||||
+ Failed to parse UID: '9999999999': Result not representable
|
||||
--
|
||||
2.41.0
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
From ff5d3856b452bc6890b54a94b40302029195d965 Mon Sep 17 00:00:00 2001
|
||||
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
|
||||
Date: Sun, 18 Aug 2024 02:44:04 -0500
|
||||
Subject: [PATCH 10/34] basic: Support musl definition of rlim_t
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This cannot be upstreamed, but we should find a better way anyway.
|
||||
|
||||
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
||||
---
|
||||
src/basic/format-util.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/basic/format-util.h b/src/basic/format-util.h
|
||||
index ba7cff6a8b55..6239051d5f88 100644
|
||||
--- a/src/basic/format-util.h
|
||||
+++ b/src/basic/format-util.h
|
||||
@@ -43,7 +43,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32_t));
|
||||
#endif
|
||||
|
||||
#if SIZEOF_RLIM_T == 8
|
||||
-# define RLIM_FMT "%" PRIu64
|
||||
+# define RLIM_FMT "%llu"
|
||||
#elif SIZEOF_RLIM_T == 4
|
||||
# define RLIM_FMT "%" PRIu32
|
||||
#else
|
||||
--
|
||||
2.41.0
|
||||
|
||||
160
sys-apps/systemd/files/0011-Handle-musl-lack-of-GLOB_BRACE.patch
Normal file
160
sys-apps/systemd/files/0011-Handle-musl-lack-of-GLOB_BRACE.patch
Normal file
@@ -0,0 +1,160 @@
|
||||
From 14f2aeac2ca72df478bc9ddd33070f7ec850baa3 Mon Sep 17 00:00:00 2001
|
||||
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
|
||||
Date: Sun, 18 Aug 2024 02:45:11 -0500
|
||||
Subject: [PATCH 11/34] Handle musl lack of GLOB_BRACE
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Based on OE patch. This cannot be upstreamed.
|
||||
|
||||
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
||||
---
|
||||
src/basic/glob-util.c | 12 ++++++++++++
|
||||
src/test/test-glob-util.c | 39 +++++++--------------------------------
|
||||
src/tmpfiles/tmpfiles.c | 10 ++++++++++
|
||||
3 files changed, 29 insertions(+), 32 deletions(-)
|
||||
|
||||
diff --git a/src/basic/glob-util.c b/src/basic/glob-util.c
|
||||
index 802ca8c655fc..23818a67c680 100644
|
||||
--- a/src/basic/glob-util.c
|
||||
+++ b/src/basic/glob-util.c
|
||||
@@ -12,6 +12,12 @@
|
||||
#include "path-util.h"
|
||||
#include "strv.h"
|
||||
|
||||
+/* Don't fail if the standard library
|
||||
+ * doesn't provide brace expansion */
|
||||
+#ifndef GLOB_BRACE
|
||||
+#define GLOB_BRACE 0
|
||||
+#endif
|
||||
+
|
||||
static void closedir_wrapper(void* v) {
|
||||
(void) closedir(v);
|
||||
}
|
||||
@@ -19,6 +25,7 @@ static void closedir_wrapper(void* v) {
|
||||
int safe_glob(const char *path, int flags, glob_t *pglob) {
|
||||
int k;
|
||||
|
||||
+#ifdef GLOB_ALTDIRFUNC
|
||||
/* We want to set GLOB_ALTDIRFUNC ourselves, don't allow it to be set. */
|
||||
assert(!(flags & GLOB_ALTDIRFUNC));
|
||||
|
||||
@@ -32,9 +39,14 @@ int safe_glob(const char *path, int flags, glob_t *pglob) {
|
||||
pglob->gl_lstat = lstat;
|
||||
if (!pglob->gl_stat)
|
||||
pglob->gl_stat = stat;
|
||||
+#endif
|
||||
|
||||
errno = 0;
|
||||
+#ifdef GLOB_ALTDIRFUNC
|
||||
k = glob(path, flags | GLOB_ALTDIRFUNC, NULL, pglob);
|
||||
+#else
|
||||
+ k = glob(path, flags, NULL, pglob);
|
||||
+#endif
|
||||
if (k == GLOB_NOMATCH)
|
||||
return -ENOENT;
|
||||
if (k == GLOB_NOSPACE)
|
||||
diff --git a/src/test/test-glob-util.c b/src/test/test-glob-util.c
|
||||
index 49d71f15c714..65ae0b230dd5 100644
|
||||
--- a/src/test/test-glob-util.c
|
||||
+++ b/src/test/test-glob-util.c
|
||||
@@ -34,6 +34,12 @@ TEST(glob_first) {
|
||||
ASSERT_NULL(first);
|
||||
}
|
||||
|
||||
+/* Don't fail if the standard library
|
||||
+ * doesn't provide brace expansion */
|
||||
+#ifndef GLOB_BRACE
|
||||
+#define GLOB_BRACE 0
|
||||
+#endif
|
||||
+
|
||||
TEST(glob_exists) {
|
||||
char name[] = "/tmp/test-glob_exists.XXXXXX";
|
||||
int fd = -EBADF;
|
||||
@@ -52,37 +58,6 @@ TEST(glob_exists) {
|
||||
assert_se(r == 0);
|
||||
}
|
||||
|
||||
-static void closedir_wrapper(void* v) {
|
||||
- (void) closedir(v);
|
||||
-}
|
||||
-
|
||||
-TEST(glob_no_dot) {
|
||||
- char template[] = "/tmp/test-glob-util.XXXXXXX";
|
||||
- const char *fn;
|
||||
-
|
||||
- _cleanup_globfree_ glob_t g = {
|
||||
- .gl_closedir = closedir_wrapper,
|
||||
- .gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot,
|
||||
- .gl_opendir = (void *(*)(const char *)) opendir,
|
||||
- .gl_lstat = lstat,
|
||||
- .gl_stat = stat,
|
||||
- };
|
||||
-
|
||||
- int r;
|
||||
-
|
||||
- assert_se(mkdtemp(template));
|
||||
-
|
||||
- fn = strjoina(template, "/*");
|
||||
- r = glob(fn, GLOB_NOSORT|GLOB_BRACE|GLOB_ALTDIRFUNC, NULL, &g);
|
||||
- assert_se(r == GLOB_NOMATCH);
|
||||
-
|
||||
- fn = strjoina(template, "/.*");
|
||||
- r = glob(fn, GLOB_NOSORT|GLOB_BRACE|GLOB_ALTDIRFUNC, NULL, &g);
|
||||
- assert_se(r == GLOB_NOMATCH);
|
||||
-
|
||||
- (void) rm_rf(template, REMOVE_ROOT|REMOVE_PHYSICAL);
|
||||
-}
|
||||
-
|
||||
TEST(safe_glob) {
|
||||
char template[] = "/tmp/test-glob-util.XXXXXXX";
|
||||
const char *fn, *fn2, *fname;
|
||||
@@ -96,7 +71,7 @@ TEST(safe_glob) {
|
||||
r = safe_glob(fn, 0, &g);
|
||||
assert_se(r == -ENOENT);
|
||||
|
||||
- fn2 = strjoina(template, "/.*");
|
||||
+ fn2 = strjoina(template, "/.f*");
|
||||
r = safe_glob(fn2, GLOB_NOSORT|GLOB_BRACE, &g);
|
||||
assert_se(r == -ENOENT);
|
||||
|
||||
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
|
||||
index 8cc8c1ccd61f..96111b512b14 100644
|
||||
--- a/src/tmpfiles/tmpfiles.c
|
||||
+++ b/src/tmpfiles/tmpfiles.c
|
||||
@@ -73,6 +73,12 @@
|
||||
#include "user-util.h"
|
||||
#include "virt.h"
|
||||
|
||||
+/* Don't fail if the standard library
|
||||
+ * doesn't provide brace expansion */
|
||||
+#ifndef GLOB_BRACE
|
||||
+#define GLOB_BRACE 0
|
||||
+#endif
|
||||
+
|
||||
/* This reads all files listed in /etc/tmpfiles.d/?*.conf and creates
|
||||
* them in the file system. This is intended to be used to create
|
||||
* properly owned directories beneath /tmp, /var/tmp, /run, which are
|
||||
@@ -2570,7 +2576,9 @@ finish:
|
||||
|
||||
static int glob_item(Context *c, Item *i, action_t action) {
|
||||
_cleanup_globfree_ glob_t g = {
|
||||
+#ifdef GLOB_ALTDIRFUNC
|
||||
.gl_opendir = (void *(*)(const char *)) opendir_nomod,
|
||||
+#endif
|
||||
};
|
||||
int r;
|
||||
|
||||
@@ -2598,7 +2606,9 @@ static int glob_item_recursively(
|
||||
fdaction_t action) {
|
||||
|
||||
_cleanup_globfree_ glob_t g = {
|
||||
+#ifdef GLOB_ALTDIRFUNC
|
||||
.gl_opendir = (void *(*)(const char *)) opendir_nomod,
|
||||
+#endif
|
||||
};
|
||||
int r;
|
||||
|
||||
--
|
||||
2.41.0
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
From 2704e56cc30d04c56943ba1a3133dfcafa73c4dd Mon Sep 17 00:00:00 2001
|
||||
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
|
||||
Date: Sun, 18 Aug 2024 02:46:06 -0500
|
||||
Subject: [PATCH 12/34] Handle musl's longer HOST_NAME_MAX: hardcode 64
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
There are multiple places in systemd, both runtime and test, that assume
|
||||
that HOST_NAME_MAX is 64. Really, that should be fixed, but to make it
|
||||
work at all, we start with hardcoding 64.
|
||||
|
||||
This cannot be upstreamed, but any work to actually fix the 64
|
||||
assumption probably could.
|
||||
|
||||
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
||||
---
|
||||
src/basic/hostname-util.c | 4 ++--
|
||||
src/shared/hostname-setup.c | 2 +-
|
||||
2 files changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/basic/hostname-util.c b/src/basic/hostname-util.c
|
||||
index e743033b1ea1..0581b1b26a06 100644
|
||||
--- a/src/basic/hostname-util.c
|
||||
+++ b/src/basic/hostname-util.c
|
||||
@@ -128,7 +128,7 @@ bool hostname_is_valid(const char *s, ValidHostnameFlags flags) {
|
||||
if (hyphen)
|
||||
return false;
|
||||
|
||||
- if (p-s > HOST_NAME_MAX) /* Note that HOST_NAME_MAX is 64 on Linux, but DNS allows domain names up to
|
||||
+ if (p-s > 64) /* Note that HOST_NAME_MAX is 64 on Linux, but DNS allows domain names up to
|
||||
* 255 characters */
|
||||
return false;
|
||||
|
||||
@@ -141,7 +141,7 @@ char* hostname_cleanup(char *s) {
|
||||
|
||||
assert(s);
|
||||
|
||||
- for (p = s, d = s, dot = hyphen = true; *p && d - s < HOST_NAME_MAX; p++)
|
||||
+ for (p = s, d = s, dot = hyphen = true; *p && d - s < 64; p++)
|
||||
if (*p == '.') {
|
||||
if (dot || hyphen)
|
||||
continue;
|
||||
diff --git a/src/shared/hostname-setup.c b/src/shared/hostname-setup.c
|
||||
index 6cfd4b54bf63..4de610fb50f1 100644
|
||||
--- a/src/shared/hostname-setup.c
|
||||
+++ b/src/shared/hostname-setup.c
|
||||
@@ -66,7 +66,7 @@ int shorten_overlong(const char *s, char **ret) {
|
||||
if (p)
|
||||
*p = 0;
|
||||
|
||||
- strshorten(h, HOST_NAME_MAX);
|
||||
+ strshorten(h, 64);
|
||||
|
||||
if (!hostname_is_valid(h, /* flags= */ 0))
|
||||
return -EDOM;
|
||||
--
|
||||
2.41.0
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
From 149d6484096f5eb328a625357aff063335902208 Mon Sep 17 00:00:00 2001
|
||||
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
|
||||
Date: Sun, 18 Aug 2024 02:48:52 -0500
|
||||
Subject: [PATCH 13/34] basic: Handle musl lack of NI_IDN
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Hopefully musl will grow support for IDN in the stub resolver soon, and
|
||||
this won't matter.
|
||||
|
||||
This cannot be upstreamed.
|
||||
|
||||
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
||||
---
|
||||
src/basic/socket-util.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/basic/socket-util.c b/src/basic/socket-util.c
|
||||
index 6e304e840d2d..11a03f40dad1 100644
|
||||
--- a/src/basic/socket-util.c
|
||||
+++ b/src/basic/socket-util.c
|
||||
@@ -36,7 +36,7 @@
|
||||
#include "user-util.h"
|
||||
#include "utf8.h"
|
||||
|
||||
-#if ENABLE_IDN
|
||||
+#if ENABLE_IDN && defined(NI_IDN)
|
||||
# define IDN_FLAGS NI_IDN
|
||||
#else
|
||||
# define IDN_FLAGS 0
|
||||
--
|
||||
2.41.0
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
From d5dff016a76259ebe40f3739f98d9c2eb47b5172 Mon Sep 17 00:00:00 2001
|
||||
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
|
||||
Date: Sun, 18 Aug 2024 02:49:49 -0500
|
||||
Subject: [PATCH 14/34] basic: Define comparison_fn_t in sort-util.h
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
glibc may define a public comparison_fn_t type, but musl libc doesn't.
|
||||
|
||||
This cannot be upstreamed. Really, we should consider adding it to our
|
||||
musl patchset.
|
||||
|
||||
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
||||
---
|
||||
src/basic/sort-util.h | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h
|
||||
index 9c818bd74706..94069443cf09 100644
|
||||
--- a/src/basic/sort-util.h
|
||||
+++ b/src/basic/sort-util.h
|
||||
@@ -5,6 +5,8 @@
|
||||
|
||||
#include "macro.h"
|
||||
|
||||
+typedef int (*comparison_fn_t)(const void *, const void *);
|
||||
+
|
||||
/* This is the same as glibc's internal __compar_d_fn_t type. glibc exports a public comparison_fn_t, for the
|
||||
* external type __compar_fn_t, but doesn't do anything similar for __compar_d_fn_t. Let's hence do that
|
||||
* ourselves, picking a name that is obvious, but likely enough to not clash with glibc's choice of naming if
|
||||
--
|
||||
2.41.0
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
From 6ef506dbf1d28618d92f0b9bb2b2fa2b989acd99 Mon Sep 17 00:00:00 2001
|
||||
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
|
||||
Date: Sun, 18 Aug 2024 02:50:50 -0500
|
||||
Subject: [PATCH 15/34] basic: Define our own basename
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This prevents issues where the POSIX basename is not the same as the GNU
|
||||
basename. I think maybe upstream could be convinced since glibc does
|
||||
provide the POSIX one as well, but until then, let's do this.
|
||||
|
||||
This cannot be upstreamed.
|
||||
|
||||
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
||||
---
|
||||
src/basic/string-util.h | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/src/basic/string-util.h b/src/basic/string-util.h
|
||||
index ff5efbcf557b..656f5100e202 100644
|
||||
--- a/src/basic/string-util.h
|
||||
+++ b/src/basic/string-util.h
|
||||
@@ -26,6 +26,8 @@
|
||||
#define URI_UNRESERVED ALPHANUMERICAL "-._~" /* [RFC3986] */
|
||||
#define URI_VALID URI_RESERVED URI_UNRESERVED /* [RFC3986] */
|
||||
|
||||
+#define basename(src) (strrchr(src,'/') ? strrchr(src,'/')+1 : src)
|
||||
+
|
||||
static inline char* strstr_ptr(const char *haystack, const char *needle) {
|
||||
if (!haystack || !needle)
|
||||
return NULL;
|
||||
--
|
||||
2.41.0
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
From 61770e8d6c24c01d6a0e35518ba16ec8d4fa8e6a Mon Sep 17 00:00:00 2001
|
||||
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
|
||||
Date: Sun, 18 Aug 2024 02:53:59 -0500
|
||||
Subject: [PATCH 16/34] test: Handle musl's interesting locale decisions
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
All locales exist! But they don't do anything!
|
||||
|
||||
This cannot be upstreamed. And some day, this should be dropable.
|
||||
|
||||
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
||||
---
|
||||
src/test/test-locale-util.c | 2 +-
|
||||
src/test/test-parse-util.c | 2 ++
|
||||
2 files changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/test/test-locale-util.c b/src/test/test-locale-util.c
|
||||
index ab2d1f5746cf..9c95debcae35 100644
|
||||
--- a/src/test/test-locale-util.c
|
||||
+++ b/src/test/test-locale-util.c
|
||||
@@ -51,7 +51,7 @@ TEST(locale_is_installed) {
|
||||
assert_se(locale_is_installed("\x01gar\x02 bage\x03") == 0);
|
||||
|
||||
/* Definitely not installed */
|
||||
- assert_se(locale_is_installed("zz_ZZ") == 0);
|
||||
+ //assert_se(locale_is_installed("zz_ZZ") == 0);
|
||||
}
|
||||
|
||||
TEST(keymaps) {
|
||||
diff --git a/src/test/test-parse-util.c b/src/test/test-parse-util.c
|
||||
index 58d22b6cfeed..3003b891b552 100644
|
||||
--- a/src/test/test-parse-util.c
|
||||
+++ b/src/test/test-parse-util.c
|
||||
@@ -809,6 +809,7 @@ TEST(safe_atod) {
|
||||
assert_se(r == -EINVAL);
|
||||
|
||||
/* Check if this really is locale independent */
|
||||
+#ifdef __GLIBC__
|
||||
if (setlocale(LC_NUMERIC, "de_DE.utf8")) {
|
||||
|
||||
r = safe_atod("0.2244", &d);
|
||||
@@ -824,6 +825,7 @@ TEST(safe_atod) {
|
||||
r = safe_atod("", &d);
|
||||
assert_se(r == -EINVAL);
|
||||
}
|
||||
+#endif
|
||||
|
||||
/* And check again, reset */
|
||||
assert_se(setlocale(LC_NUMERIC, "C"));
|
||||
--
|
||||
2.41.0
|
||||
|
||||
72
sys-apps/systemd/files/0017-Port-to-s6-utmps.patch
Normal file
72
sys-apps/systemd/files/0017-Port-to-s6-utmps.patch
Normal file
@@ -0,0 +1,72 @@
|
||||
From 09647d86120432cf9581e340b72a550df3dc2eb7 Mon Sep 17 00:00:00 2001
|
||||
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
|
||||
Date: Sun, 18 Aug 2024 03:00:43 -0500
|
||||
Subject: [PATCH 17/34] Port to s6-utmps
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This cannot be upstreamed.
|
||||
|
||||
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
||||
---
|
||||
src/basic/user-util.c | 2 +-
|
||||
src/shared/utmp-wtmp.h | 2 ++
|
||||
src/sysusers/sysusers.c | 2 +-
|
||||
src/userdb/userdbctl.c | 2 +-
|
||||
4 files changed, 5 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/basic/user-util.c b/src/basic/user-util.c
|
||||
index 6bdf5bf1cdc9..42fbabec7892 100644
|
||||
--- a/src/basic/user-util.c
|
||||
+++ b/src/basic/user-util.c
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <sys/file.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
-#include <utmp.h>
|
||||
+#include <utmpx.h>
|
||||
|
||||
#include "sd-messages.h"
|
||||
|
||||
diff --git a/src/shared/utmp-wtmp.h b/src/shared/utmp-wtmp.h
|
||||
index 2e04fac40472..f8018ddc0141 100644
|
||||
--- a/src/shared/utmp-wtmp.h
|
||||
+++ b/src/shared/utmp-wtmp.h
|
||||
@@ -8,6 +8,8 @@
|
||||
|
||||
#if ENABLE_UTMP
|
||||
#include <utmpx.h>
|
||||
+#define _PATH_UTMPX UTMPX_FILE
|
||||
+#define _PATH_WTMPX WTMPX_FILE
|
||||
|
||||
int utmp_get_runlevel(int *runlevel, int *previous);
|
||||
|
||||
diff --git a/src/sysusers/sysusers.c b/src/sysusers/sysusers.c
|
||||
index 7758267b17ab..3e2c91bfa323 100644
|
||||
--- a/src/sysusers/sysusers.c
|
||||
+++ b/src/sysusers/sysusers.c
|
||||
@@ -1,7 +1,7 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
#include <getopt.h>
|
||||
-#include <utmp.h>
|
||||
+#include <utmpx.h>
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "build.h"
|
||||
diff --git a/src/userdb/userdbctl.c b/src/userdb/userdbctl.c
|
||||
index 1718419407bc..1da975ed7807 100644
|
||||
--- a/src/userdb/userdbctl.c
|
||||
+++ b/src/userdb/userdbctl.c
|
||||
@@ -1,7 +1,7 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
#include <getopt.h>
|
||||
-#include <utmp.h>
|
||||
+#include <utmpx.h>
|
||||
|
||||
#include "build.h"
|
||||
#include "dirent-util.h"
|
||||
--
|
||||
2.41.0
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
From 2ac7d5c27b23f082c7e7741fa40875f76747ba6a Mon Sep 17 00:00:00 2001
|
||||
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
|
||||
Date: Sun, 18 Aug 2024 03:02:43 -0500
|
||||
Subject: [PATCH 18/34] test: Add definition for __cpu_set type
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
glibc defines this type, but musl does not.
|
||||
|
||||
This cannot be upstreamed.
|
||||
|
||||
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
||||
---
|
||||
src/test/test-cpu-set-util.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/src/test/test-cpu-set-util.c b/src/test/test-cpu-set-util.c
|
||||
index ccb52c96d4d6..5892b7a5c214 100644
|
||||
--- a/src/test/test-cpu-set-util.c
|
||||
+++ b/src/test/test-cpu-set-util.c
|
||||
@@ -6,6 +6,8 @@
|
||||
#include "tests.h"
|
||||
#include "macro.h"
|
||||
|
||||
+typedef unsigned long int __cpu_mask;
|
||||
+
|
||||
TEST(parse_cpu_set) {
|
||||
CPUSet c = {};
|
||||
_cleanup_free_ char *str = NULL;
|
||||
--
|
||||
2.41.0
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
From 1e4e3a0b8024f005919317f51644b98a446a9426 Mon Sep 17 00:00:00 2001
|
||||
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
|
||||
Date: Sun, 18 Aug 2024 03:03:22 -0500
|
||||
Subject: [PATCH 19/34] test: Don't assume unknown errors have their codes
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
glibc will give "Unknown error 200", but musl just says "No error
|
||||
information", which makes these tests seem to fail.
|
||||
|
||||
This cannot be upstreamed.
|
||||
|
||||
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
||||
---
|
||||
src/test/test-errno-util.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/test/test-errno-util.c b/src/test/test-errno-util.c
|
||||
index ab463bd1b394..eafa3624b80e 100644
|
||||
--- a/src/test/test-errno-util.c
|
||||
+++ b/src/test/test-errno-util.c
|
||||
@@ -27,8 +27,8 @@ TEST(STRERROR) {
|
||||
log_info("STRERROR(%d), STRERROR(%d) → %s, %s", 200, 201, STRERROR(200), STRERROR(201));
|
||||
|
||||
const char *a = STRERROR(200), *b = STRERROR(201);
|
||||
- assert_se(strstr(a, "200"));
|
||||
- assert_se(strstr(b, "201"));
|
||||
+ /*assert_se(strstr(a, "200"));
|
||||
+ assert_se(strstr(b, "201"));*/
|
||||
|
||||
/* Check with negative values */
|
||||
ASSERT_STREQ(a, STRERROR(-200));
|
||||
@@ -38,7 +38,7 @@ TEST(STRERROR) {
|
||||
char buf[DECIMAL_STR_MAX(int)];
|
||||
xsprintf(buf, "%d", INT_MAX); /* INT_MAX is hexadecimal, use printf to convert to decimal */
|
||||
log_info("STRERROR(%d) → %s", INT_MAX, c);
|
||||
- assert_se(strstr(c, buf));
|
||||
+ //assert_se(strstr(c, buf));
|
||||
}
|
||||
|
||||
TEST(STRERROR_OR_ELSE) {
|
||||
--
|
||||
2.41.0
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
From b4439d419462902b19cfc72777e476d66a3a878b Mon Sep 17 00:00:00 2001
|
||||
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
|
||||
Date: Sun, 18 Aug 2024 03:04:53 -0500
|
||||
Subject: [PATCH 20/34] test-time-util: Use whole fractions, no 4 digit TZ
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Both of these things are unsupported by musl strptime.
|
||||
|
||||
This cannot be upstreamed.
|
||||
|
||||
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
||||
---
|
||||
src/test/test-time-util.c | 34 +++++++++++++++++-----------------
|
||||
1 file changed, 17 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/src/test/test-time-util.c b/src/test/test-time-util.c
|
||||
index 9943923be30a..bd3292698a0b 100644
|
||||
--- a/src/test/test-time-util.c
|
||||
+++ b/src/test/test-time-util.c
|
||||
@@ -25,13 +25,13 @@ TEST(parse_sec) {
|
||||
assert_se(u == 5 * USEC_PER_SEC + 500 * USEC_PER_MSEC);
|
||||
assert_se(parse_sec(" 5.5s 0.5ms ", &u) >= 0);
|
||||
assert_se(u == 5 * USEC_PER_SEC + 500 * USEC_PER_MSEC + 500);
|
||||
- assert_se(parse_sec(" .22s ", &u) >= 0);
|
||||
+ assert_se(parse_sec(" 0.22s ", &u) >= 0);
|
||||
assert_se(u == 220 * USEC_PER_MSEC);
|
||||
- assert_se(parse_sec(" .50y ", &u) >= 0);
|
||||
+ assert_se(parse_sec(" 0.50y ", &u) >= 0);
|
||||
assert_se(u == USEC_PER_YEAR / 2);
|
||||
assert_se(parse_sec("2.5", &u) >= 0);
|
||||
assert_se(u == 2500 * USEC_PER_MSEC);
|
||||
- assert_se(parse_sec(".7", &u) >= 0);
|
||||
+ assert_se(parse_sec("0.7", &u) >= 0);
|
||||
assert_se(u == 700 * USEC_PER_MSEC);
|
||||
assert_se(parse_sec("23us", &u) >= 0);
|
||||
assert_se(u == 23);
|
||||
@@ -45,11 +45,11 @@ TEST(parse_sec) {
|
||||
assert_se(u == USEC_INFINITY);
|
||||
assert_se(parse_sec("+3.1s", &u) >= 0);
|
||||
assert_se(u == 3100 * USEC_PER_MSEC);
|
||||
- assert_se(parse_sec("3.1s.2", &u) >= 0);
|
||||
+ assert_se(parse_sec("3.1s0.2", &u) >= 0);
|
||||
assert_se(u == 3300 * USEC_PER_MSEC);
|
||||
- assert_se(parse_sec("3.1 .2", &u) >= 0);
|
||||
+ assert_se(parse_sec("3.1 0.2", &u) >= 0);
|
||||
assert_se(u == 3300 * USEC_PER_MSEC);
|
||||
- assert_se(parse_sec("3.1 sec .2 sec", &u) >= 0);
|
||||
+ assert_se(parse_sec("3.1 sec 0.2 sec", &u) >= 0);
|
||||
assert_se(u == 3300 * USEC_PER_MSEC);
|
||||
assert_se(parse_sec("3.1 sec 1.2 sec", &u) >= 0);
|
||||
assert_se(u == 4300 * USEC_PER_MSEC);
|
||||
@@ -145,13 +145,13 @@ TEST(parse_nsec) {
|
||||
assert_se(u == 5 * NSEC_PER_SEC + 500 * NSEC_PER_MSEC);
|
||||
assert_se(parse_nsec(" 5.5s 0.5ms ", &u) >= 0);
|
||||
assert_se(u == 5 * NSEC_PER_SEC + 500 * NSEC_PER_MSEC + 500 * NSEC_PER_USEC);
|
||||
- assert_se(parse_nsec(" .22s ", &u) >= 0);
|
||||
+ assert_se(parse_nsec(" 0.22s ", &u) >= 0);
|
||||
assert_se(u == 220 * NSEC_PER_MSEC);
|
||||
- assert_se(parse_nsec(" .50y ", &u) >= 0);
|
||||
+ assert_se(parse_nsec(" 0.50y ", &u) >= 0);
|
||||
assert_se(u == NSEC_PER_YEAR / 2);
|
||||
assert_se(parse_nsec("2.5", &u) >= 0);
|
||||
assert_se(u == 2);
|
||||
- assert_se(parse_nsec(".7", &u) >= 0);
|
||||
+ assert_se(parse_nsec("0.7", &u) >= 0);
|
||||
assert_se(u == 0);
|
||||
assert_se(parse_nsec("infinity", &u) >= 0);
|
||||
assert_se(u == NSEC_INFINITY);
|
||||
@@ -159,11 +159,11 @@ TEST(parse_nsec) {
|
||||
assert_se(u == NSEC_INFINITY);
|
||||
assert_se(parse_nsec("+3.1s", &u) >= 0);
|
||||
assert_se(u == 3100 * NSEC_PER_MSEC);
|
||||
- assert_se(parse_nsec("3.1s.2", &u) >= 0);
|
||||
+ assert_se(parse_nsec("3.1s0.2", &u) >= 0);
|
||||
assert_se(u == 3100 * NSEC_PER_MSEC);
|
||||
- assert_se(parse_nsec("3.1 .2s", &u) >= 0);
|
||||
+ assert_se(parse_nsec("3.1 0.2s", &u) >= 0);
|
||||
assert_se(u == 200 * NSEC_PER_MSEC + 3);
|
||||
- assert_se(parse_nsec("3.1 sec .2 sec", &u) >= 0);
|
||||
+ assert_se(parse_nsec("3.1 sec 0.2 sec", &u) >= 0);
|
||||
assert_se(u == 3300 * NSEC_PER_MSEC);
|
||||
assert_se(parse_nsec("3.1 sec 1.2 sec", &u) >= 0);
|
||||
assert_se(u == 4300 * NSEC_PER_MSEC);
|
||||
@@ -734,9 +734,9 @@ static void test_parse_timestamp_impl(const char *tz) {
|
||||
assert_se(parse_timestamp("today UTC", &today) == 0);
|
||||
assert_se(parse_timestamp("todayZ", &today2) == 0);
|
||||
assert_se(today == today2);
|
||||
- assert_se(parse_timestamp("today +0200", &today) == 0);
|
||||
+ //assert_se(parse_timestamp("today +0200", &today) == 0);
|
||||
assert_se(parse_timestamp("today+02:00", &today2) == 0);
|
||||
- assert_se(today == today2);
|
||||
+ //assert_se(today == today2);
|
||||
|
||||
/* https://ijmacd.github.io/rfc3339-iso8601/ */
|
||||
test_parse_timestamp_one("2023-09-06 12:49:27-00:00", 0, 1694004567 * USEC_PER_SEC + 000000);
|
||||
@@ -879,7 +879,7 @@ static void test_parse_timestamp_impl(const char *tz) {
|
||||
test_parse_timestamp_one("69-12-31 18:00:01.0010 -06", 0, USEC_PER_SEC + 1000);
|
||||
|
||||
/* -0600 */
|
||||
- test_parse_timestamp_one("Wed 1969-12-31 18:01 -0600", 0, USEC_PER_MINUTE);
|
||||
+ /*test_parse_timestamp_one("Wed 1969-12-31 18:01 -0600", 0, USEC_PER_MINUTE);
|
||||
test_parse_timestamp_one("Wed 1969-12-31 18:00:01 -0600", 0, USEC_PER_SEC);
|
||||
test_parse_timestamp_one("Wed 1969-12-31 18:00:01.001 -0600", 0, USEC_PER_SEC + 1000);
|
||||
test_parse_timestamp_one("Wed 1969-12-31 18:00:01.0010 -0600", 0, USEC_PER_SEC + 1000);
|
||||
@@ -897,7 +897,7 @@ static void test_parse_timestamp_impl(const char *tz) {
|
||||
test_parse_timestamp_one("69-12-31 18:01 -0600", 0, USEC_PER_MINUTE);
|
||||
test_parse_timestamp_one("69-12-31 18:00:01 -0600", 0, USEC_PER_SEC);
|
||||
test_parse_timestamp_one("69-12-31 18:00:01.001 -0600", 0, USEC_PER_SEC + 1000);
|
||||
- test_parse_timestamp_one("69-12-31 18:00:01.0010 -0600", 0, USEC_PER_SEC + 1000);
|
||||
+ test_parse_timestamp_one("69-12-31 18:00:01.0010 -0600", 0, USEC_PER_SEC + 1000);*/
|
||||
|
||||
/* -06:00 */
|
||||
test_parse_timestamp_one("Wed 1969-12-31 18:01 -06:00", 0, USEC_PER_MINUTE);
|
||||
@@ -1063,7 +1063,7 @@ TEST(in_utc_timezone) {
|
||||
assert_se(setenv("TZ", ":UTC", 1) >= 0);
|
||||
assert_se(in_utc_timezone());
|
||||
ASSERT_STREQ(tzname[0], "UTC");
|
||||
- ASSERT_STREQ(tzname[1], "UTC");
|
||||
+ //ASSERT_STREQ(tzname[1], "UTC");
|
||||
assert_se(timezone == 0);
|
||||
assert_se(daylight == 0);
|
||||
|
||||
--
|
||||
2.41.0
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
From aa166c09ba2b70fa093a6ca1d2995e461b16a4c0 Mon Sep 17 00:00:00 2001
|
||||
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
|
||||
Date: Sun, 18 Aug 2024 03:08:13 -0500
|
||||
Subject: [PATCH 21/34] Don't use malloc_trim or malloc_info
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The musl allocator does not define these functions.
|
||||
|
||||
This probably cannot be upstreamed.
|
||||
|
||||
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
||||
---
|
||||
src/libsystemd/sd-event/sd-event.c | 2 +-
|
||||
src/shared/bus-util.c | 4 +++-
|
||||
src/shared/common-signal.c | 2 ++
|
||||
3 files changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
|
||||
index 73a95e7fa135..c62dc07165ab 100644
|
||||
--- a/src/libsystemd/sd-event/sd-event.c
|
||||
+++ b/src/libsystemd/sd-event/sd-event.c
|
||||
@@ -1891,7 +1891,7 @@ _public_ int sd_event_trim_memory(void) {
|
||||
|
||||
usec_t before_timestamp = now(CLOCK_MONOTONIC);
|
||||
hashmap_trim_pools();
|
||||
- r = malloc_trim(0);
|
||||
+ r = 0;
|
||||
usec_t after_timestamp = now(CLOCK_MONOTONIC);
|
||||
|
||||
if (r > 0)
|
||||
diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
|
||||
index 30f9602b1edb..b1a8da36612b 100644
|
||||
--- a/src/shared/bus-util.c
|
||||
+++ b/src/shared/bus-util.c
|
||||
@@ -755,7 +755,7 @@ static int method_dump_memory_state_by_fd(sd_bus_message *message, void *userdat
|
||||
_cleanup_close_ int fd = -EBADF;
|
||||
size_t dump_size;
|
||||
FILE *f;
|
||||
- int r;
|
||||
+ int r = 0;
|
||||
|
||||
assert(message);
|
||||
|
||||
@@ -763,7 +763,9 @@ static int method_dump_memory_state_by_fd(sd_bus_message *message, void *userdat
|
||||
if (!f)
|
||||
return -ENOMEM;
|
||||
|
||||
+#ifdef __GLIBC__
|
||||
r = RET_NERRNO(malloc_info(/* options= */ 0, f));
|
||||
+#endif
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
diff --git a/src/shared/common-signal.c b/src/shared/common-signal.c
|
||||
index 8e70e365dd69..bb68fc56b664 100644
|
||||
--- a/src/shared/common-signal.c
|
||||
+++ b/src/shared/common-signal.c
|
||||
@@ -66,10 +66,12 @@ int sigrtmin18_handler(sd_event_source *s, const struct signalfd_siginfo *si, vo
|
||||
break;
|
||||
}
|
||||
|
||||
+#ifdef __GLIBC__
|
||||
if (malloc_info(0, f) < 0) {
|
||||
log_error_errno(errno, "Failed to invoke malloc_info(): %m");
|
||||
break;
|
||||
}
|
||||
+#endif
|
||||
|
||||
(void) memstream_dump(LOG_INFO, &m);
|
||||
break;
|
||||
--
|
||||
2.41.0
|
||||
|
||||
90
sys-apps/systemd/files/0022-Port-to-musl-strptime.patch
Normal file
90
sys-apps/systemd/files/0022-Port-to-musl-strptime.patch
Normal file
@@ -0,0 +1,90 @@
|
||||
From 3c9ab22f9323726710b931ed478e6d5dd81dca2e Mon Sep 17 00:00:00 2001
|
||||
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
|
||||
Date: Sun, 18 Aug 2024 03:09:47 -0500
|
||||
Subject: [PATCH 22/34] Port to musl strptime
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This cannot be upstreamed.
|
||||
|
||||
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
||||
---
|
||||
src/basic/time-util.c | 25 ++++++++++++++++++++-----
|
||||
src/import/curl-util.c | 6 +++---
|
||||
2 files changed, 23 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/src/basic/time-util.c b/src/basic/time-util.c
|
||||
index b94f37c31c31..1200833a88c5 100644
|
||||
--- a/src/basic/time-util.c
|
||||
+++ b/src/basic/time-util.c
|
||||
@@ -915,6 +915,7 @@ parse_usec:
|
||||
from_tm:
|
||||
assert(plus == 0);
|
||||
assert(minus == 0);
|
||||
+ tm.tm_wday = weekday;
|
||||
|
||||
if (weekday >= 0 && tm.tm_wday != weekday)
|
||||
return -EINVAL;
|
||||
@@ -1003,9 +1004,12 @@ int parse_timestamp(const char *t, usec_t *ret) {
|
||||
return parse_timestamp_impl(t, t_len - 1, /* utc = */ true, /* isdst = */ -1, /* gmtoff = */ 0, ret);
|
||||
|
||||
if (t_len > 7 && IN_SET(t[t_len - 6], '+', '-') && t[t_len - 7] != ' ') { /* RFC3339-style welded offset: "1990-12-31T15:59:60-08:00" */
|
||||
- k = strptime(&t[t_len - 6], "%z", &tm);
|
||||
- if (k && *k == '\0')
|
||||
+ k = strptime(&t[t_len - 5], "%R", &tm);
|
||||
+ if (k && *k == '\0') {
|
||||
+ tm.tm_gmtoff = ((tm.tm_hour * 60) + tm.tm_min) * 60;
|
||||
+ if (t[t_len - 6] == '-') tm.tm_gmtoff *= -1;
|
||||
return parse_timestamp_impl(t, t_len - 6, /* utc = */ true, /* isdst = */ -1, /* gmtoff = */ tm.tm_gmtoff, ret);
|
||||
+ }
|
||||
}
|
||||
|
||||
tz = strrchr(t, ' ');
|
||||
@@ -1022,9 +1026,20 @@ int parse_timestamp(const char *t, usec_t *ret) {
|
||||
/* If the timezone is compatible with RFC-822/ISO 8601 (e.g. +06, or -03:00) then parse the string as
|
||||
* UTC and shift the result. Note, this must be earlier than the timezone check with tzname[], as
|
||||
* tzname[] may be in the same format. */
|
||||
- k = strptime(tz, "%z", &tm);
|
||||
- if (k && *k == '\0')
|
||||
- return parse_timestamp_impl(t, max_len, /* utc = */ true, /* isdst = */ -1, /* gmtoff = */ tm.tm_gmtoff, ret);
|
||||
+ if (*tz == '+' || *tz == '-') {
|
||||
+ k = strptime(tz+1, "%R", &tm);
|
||||
+ if (k && *k == '\0') {
|
||||
+ tm.tm_gmtoff = ((tm.tm_hour * 60) + tm.tm_min) * 60;
|
||||
+ if (*tz == '-') tm.tm_gmtoff *= -1;
|
||||
+ return parse_timestamp_impl(t, max_len, /* utc = */ true, /* isdst = */ -1, /* gmtoff = */ tm.tm_gmtoff, ret);
|
||||
+ }
|
||||
+ k = strptime(tz+1, "%H", &tm);
|
||||
+ if (k && *k == '\0') {
|
||||
+ tm.tm_gmtoff = tm.tm_hour * 3600;
|
||||
+ if (*tz == '-') tm.tm_gmtoff *= -1;
|
||||
+ return parse_timestamp_impl(t, max_len, /* utc = */ true, /* isdst = */ -1, /* gmtoff = */ tm.tm_gmtoff, ret);
|
||||
+ }
|
||||
+ }
|
||||
|
||||
/* If the last word is not a timezone file (e.g. Asia/Tokyo), then let's check if it matches
|
||||
* tzname[] of the local timezone, e.g. JST or CEST. */
|
||||
diff --git a/src/import/curl-util.c b/src/import/curl-util.c
|
||||
index 1628f833a970..4a3003b3e848 100644
|
||||
--- a/src/import/curl-util.c
|
||||
+++ b/src/import/curl-util.c
|
||||
@@ -396,13 +396,13 @@ int curl_parse_http_time(const char *t, usec_t *ret) {
|
||||
return -errno;
|
||||
|
||||
/* RFC822 */
|
||||
- e = strptime_l(t, "%a, %d %b %Y %H:%M:%S %Z", &tm, loc);
|
||||
+ e = strptime(t, "%a, %d %b %Y %H:%M:%S %Z", &tm);
|
||||
if (!e || *e != 0)
|
||||
/* RFC 850 */
|
||||
- e = strptime_l(t, "%A, %d-%b-%y %H:%M:%S %Z", &tm, loc);
|
||||
+ e = strptime(t, "%A, %d-%b-%y %H:%M:%S %Z", &tm);
|
||||
if (!e || *e != 0)
|
||||
/* ANSI C */
|
||||
- e = strptime_l(t, "%a %b %d %H:%M:%S %Y", &tm, loc);
|
||||
+ e = strptime(t, "%a %b %d %H:%M:%S %Y", &tm);
|
||||
if (!e || *e != 0)
|
||||
return -EINVAL;
|
||||
|
||||
--
|
||||
2.41.0
|
||||
|
||||
@@ -0,0 +1,193 @@
|
||||
From 763fe64a51caa25c51a9d68d8e3943b519edf5cb Mon Sep 17 00:00:00 2001
|
||||
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
|
||||
Date: Sun, 18 Aug 2024 03:11:15 -0500
|
||||
Subject: [PATCH 23/34] shared: Conditionalise sgrp on ENABLE_GSHADOW
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Signed-off-by: A. Wilcox <AWilcox@Wilcox-Tech.com>
|
||||
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
||||
---
|
||||
src/shared/user-record-nss.c | 25 ++++++++++++++++++++++++-
|
||||
src/shared/user-record-nss.h | 6 +++++-
|
||||
src/shared/userdb.c | 6 ++++++
|
||||
3 files changed, 35 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/shared/user-record-nss.c b/src/shared/user-record-nss.c
|
||||
index ffb572146628..3e2f61473a6a 100644
|
||||
--- a/src/shared/user-record-nss.c
|
||||
+++ b/src/shared/user-record-nss.c
|
||||
@@ -275,9 +275,12 @@ int nss_user_record_by_uid(
|
||||
|
||||
int nss_group_to_group_record(
|
||||
const struct group *grp,
|
||||
- const struct sgrp *sgrp,
|
||||
+ void *_sgrp,
|
||||
GroupRecord **ret) {
|
||||
|
||||
+#if ENABLE_GSHADOW
|
||||
+ struct sgrp *sgrp = (struct sgrp *)_sgrp;
|
||||
+#endif
|
||||
_cleanup_(group_record_unrefp) GroupRecord *g = NULL;
|
||||
int r;
|
||||
|
||||
@@ -286,8 +289,10 @@ int nss_group_to_group_record(
|
||||
if (isempty(grp->gr_name))
|
||||
return -EINVAL;
|
||||
|
||||
+#if ENABLE_GSHADOW
|
||||
if (sgrp && !streq_ptr(sgrp->sg_namp, grp->gr_name))
|
||||
return -EINVAL;
|
||||
+#endif
|
||||
|
||||
g = group_record_new();
|
||||
if (!g)
|
||||
@@ -303,6 +308,7 @@ int nss_group_to_group_record(
|
||||
|
||||
g->gid = grp->gr_gid;
|
||||
|
||||
+#if ENABLE_GSHADOW
|
||||
if (sgrp) {
|
||||
if (looks_like_hashed_password(utf8_only(sgrp->sg_passwd))) {
|
||||
g->hashed_password = strv_new(sgrp->sg_passwd);
|
||||
@@ -318,6 +324,7 @@ int nss_group_to_group_record(
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
+#endif
|
||||
|
||||
r = json_build(&g->json, JSON_BUILD_OBJECT(
|
||||
JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(g->group_name)),
|
||||
@@ -336,6 +343,7 @@ int nss_group_to_group_record(
|
||||
return 0;
|
||||
}
|
||||
|
||||
+#if ENABLE_GSHADOW
|
||||
int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **ret_buffer) {
|
||||
size_t buflen = 4096;
|
||||
int r;
|
||||
@@ -373,6 +381,7 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
|
||||
buf = mfree(buf);
|
||||
}
|
||||
}
|
||||
+#endif
|
||||
|
||||
int nss_group_record_by_name(
|
||||
const char *name,
|
||||
@@ -382,7 +391,9 @@ int nss_group_record_by_name(
|
||||
_cleanup_free_ char *sbuf = NULL;
|
||||
_cleanup_free_ struct group *result = NULL;
|
||||
bool incomplete = false;
|
||||
+#if ENABLE_GSHADOW
|
||||
struct sgrp sgrp, *sresult = NULL;
|
||||
+#endif
|
||||
int r;
|
||||
|
||||
assert(name);
|
||||
@@ -391,6 +402,7 @@ int nss_group_record_by_name(
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
+#if ENABLE_GSHADOW
|
||||
if (with_shadow) {
|
||||
r = nss_sgrp_for_group(result, &sgrp, &sbuf);
|
||||
if (r < 0) {
|
||||
@@ -402,6 +414,10 @@ int nss_group_record_by_name(
|
||||
incomplete = true;
|
||||
|
||||
r = nss_group_to_group_record(result, sresult, ret);
|
||||
+#else
|
||||
+ incomplete = true;
|
||||
+ r = nss_group_to_group_record(result, NULL, ret);
|
||||
+#endif
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
@@ -418,13 +434,16 @@ int nss_group_record_by_gid(
|
||||
_cleanup_free_ char *sbuf = NULL;
|
||||
_cleanup_free_ struct group *result = NULL;
|
||||
bool incomplete = false;
|
||||
+#if ENABLE_GSHADOW
|
||||
struct sgrp sgrp, *sresult = NULL;
|
||||
+#endif
|
||||
int r;
|
||||
|
||||
r = getgrgid_malloc(gid, &result);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
+#if ENABLE_GSHADOW
|
||||
if (with_shadow) {
|
||||
r = nss_sgrp_for_group(result, &sgrp, &sbuf);
|
||||
if (r < 0) {
|
||||
@@ -436,6 +455,10 @@ int nss_group_record_by_gid(
|
||||
incomplete = true;
|
||||
|
||||
r = nss_group_to_group_record(result, sresult, ret);
|
||||
+#else
|
||||
+ incomplete = true;
|
||||
+ r = nss_group_to_group_record(result, NULL, ret);
|
||||
+#endif
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
diff --git a/src/shared/user-record-nss.h b/src/shared/user-record-nss.h
|
||||
index 22ab04d6eec3..5677a119f6d0 100644
|
||||
--- a/src/shared/user-record-nss.h
|
||||
+++ b/src/shared/user-record-nss.h
|
||||
@@ -2,7 +2,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <grp.h>
|
||||
+#if ENABLE_GSHADOW
|
||||
#include <gshadow.h>
|
||||
+#endif
|
||||
#include <pwd.h>
|
||||
#include <shadow.h>
|
||||
|
||||
@@ -17,8 +19,10 @@ int nss_spwd_for_passwd(const struct passwd *pwd, struct spwd *ret_spwd, char **
|
||||
int nss_user_record_by_name(const char *name, bool with_shadow, UserRecord **ret);
|
||||
int nss_user_record_by_uid(uid_t uid, bool with_shadow, UserRecord **ret);
|
||||
|
||||
-int nss_group_to_group_record(const struct group *grp, const struct sgrp *sgrp, GroupRecord **ret);
|
||||
+int nss_group_to_group_record(const struct group *grp, void *sgrp, GroupRecord **ret);
|
||||
+#if ENABLE_GSHADOW
|
||||
int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **ret_buffer);
|
||||
+#endif
|
||||
|
||||
int nss_group_record_by_name(const char *name, bool with_shadow, GroupRecord **ret);
|
||||
int nss_group_record_by_gid(gid_t gid, bool with_shadow, GroupRecord **ret);
|
||||
diff --git a/src/shared/userdb.c b/src/shared/userdb.c
|
||||
index 353388125f79..002f35c79fc4 100644
|
||||
--- a/src/shared/userdb.c
|
||||
+++ b/src/shared/userdb.c
|
||||
@@ -1038,13 +1038,16 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
|
||||
if (gr) {
|
||||
_cleanup_free_ char *buffer = NULL;
|
||||
bool incomplete = false;
|
||||
+#if ENABLE_GSHADOW
|
||||
struct sgrp sgrp;
|
||||
+#endif
|
||||
|
||||
if (streq_ptr(gr->gr_name, "root"))
|
||||
iterator->synthesize_root = false;
|
||||
if (gr->gr_gid == GID_NOBODY)
|
||||
iterator->synthesize_nobody = false;
|
||||
|
||||
+#if ENABLE_GSHADOW
|
||||
if (!FLAGS_SET(iterator->flags, USERDB_SUPPRESS_SHADOW)) {
|
||||
r = nss_sgrp_for_group(gr, &sgrp, &buffer);
|
||||
if (r < 0) {
|
||||
@@ -1057,6 +1060,9 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
|
||||
}
|
||||
|
||||
r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret);
|
||||
+#else
|
||||
+ r = nss_group_to_group_record(gr, NULL, ret);
|
||||
+#endif
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
--
|
||||
2.41.0
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
From 698acf92b1ce0c182318c02a87b0f874e5e79b2f Mon Sep 17 00:00:00 2001
|
||||
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
|
||||
Date: Sun, 18 Aug 2024 03:12:10 -0500
|
||||
Subject: [PATCH 24/34] basic: Use <sys/prctl.h> vs <linux/prctl.h>
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Signed-off-by: A. Wilcox <AWilcox@Wilcox-Tech.com>
|
||||
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
||||
---
|
||||
src/basic/missing_prctl.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/basic/missing_prctl.h b/src/basic/missing_prctl.h
|
||||
index 2c9f9f6c50ff..ed065828d1ae 100644
|
||||
--- a/src/basic/missing_prctl.h
|
||||
+++ b/src/basic/missing_prctl.h
|
||||
@@ -1,7 +1,7 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
#pragma once
|
||||
|
||||
-#include <linux/prctl.h>
|
||||
+#include <sys/prctl.h>
|
||||
|
||||
#include "macro.h"
|
||||
|
||||
--
|
||||
2.41.0
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
From 0bd6d30dc195911d525877b42f4821355f2f25e4 Mon Sep 17 00:00:00 2001
|
||||
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
|
||||
Date: Sun, 18 Aug 2024 03:12:46 -0500
|
||||
Subject: [PATCH 25/34] man: Ensure notify example includes <string.h>
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This ensures that memcpy and strerror are defined. This is especially
|
||||
important as GCC 14 makes implicit function declarations an error.
|
||||
|
||||
Signed-off-by: A. Wilcox <AWilcox@Wilcox-Tech.com>
|
||||
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
||||
---
|
||||
man/notify-selfcontained-example.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/man/notify-selfcontained-example.c b/man/notify-selfcontained-example.c
|
||||
index 6bbe4f2e3bad..3498d508430d 100644
|
||||
--- a/man/notify-selfcontained-example.c
|
||||
+++ b/man/notify-selfcontained-example.c
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
+#include <string.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
#include <time.h>
|
||||
--
|
||||
2.41.0
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
From c4425b22e47569dd79b611b641de9e1b1a3630b8 Mon Sep 17 00:00:00 2001
|
||||
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
|
||||
Date: Sun, 18 Aug 2024 03:14:44 -0500
|
||||
Subject: [PATCH 26/34] basic: Add needed <signal.h> to pidref.h
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Signed-off-by: A. Wilcox <AWilcox@Wilcox-Tech.com>
|
||||
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
||||
---
|
||||
src/basic/pidref.h | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/src/basic/pidref.h b/src/basic/pidref.h
|
||||
index 9920ebb9b3bc..2fdd4ff50f8f 100644
|
||||
--- a/src/basic/pidref.h
|
||||
+++ b/src/basic/pidref.h
|
||||
@@ -1,6 +1,7 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
#pragma once
|
||||
|
||||
+#include <signal.h>
|
||||
#include "macro.h"
|
||||
|
||||
/* An embeddable structure carrying a reference to a process. Supposed to be used when tracking processes continuously. */
|
||||
--
|
||||
2.41.0
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
From a26ff0a3fb7f8dce6554d0a24cb69263c3551d47 Mon Sep 17 00:00:00 2001
|
||||
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
|
||||
Date: Sun, 18 Aug 2024 03:15:39 -0500
|
||||
Subject: [PATCH 27/34] Add <sys/file.h> include for LOCK_* definitions
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Signed-off-by: A. Wilcox <AWilcox@Wilcox-Tech.com>
|
||||
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
||||
---
|
||||
src/basic/lock-util.h | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/src/basic/lock-util.h b/src/basic/lock-util.h
|
||||
index 8fb4757968c0..f925d971ebe8 100644
|
||||
--- a/src/basic/lock-util.h
|
||||
+++ b/src/basic/lock-util.h
|
||||
@@ -2,6 +2,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <fcntl.h>
|
||||
+#include <sys/file.h>
|
||||
|
||||
typedef struct LockFile {
|
||||
int dir_fd;
|
||||
--
|
||||
2.41.0
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
From cbd2cc7bbdbdb336a5443ddbc3d805cd8e9e962c Mon Sep 17 00:00:00 2001
|
||||
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
|
||||
Date: Sun, 18 Aug 2024 03:16:18 -0500
|
||||
Subject: [PATCH 28/34] basic: Handle NIS compat entries ourselves
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This is needed on musl, which will otherwise mangle them.
|
||||
|
||||
This cannot be upstreamed.
|
||||
|
||||
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
||||
---
|
||||
src/basic/user-util.c | 18 ++++++++++++++++++
|
||||
1 file changed, 18 insertions(+)
|
||||
|
||||
diff --git a/src/basic/user-util.c b/src/basic/user-util.c
|
||||
index 42fbabec7892..c08669691800 100644
|
||||
--- a/src/basic/user-util.c
|
||||
+++ b/src/basic/user-util.c
|
||||
@@ -930,6 +930,11 @@ int putpwent_sane(const struct passwd *pw, FILE *stream) {
|
||||
assert(stream);
|
||||
|
||||
errno = 0;
|
||||
+ if (IN_SET(pw->pw_name[0], '+', '-')) {
|
||||
+ if (fprintf(stream, "%s:%s:::%s:%s:%s\n",
|
||||
+ pw->pw_name, pw->pw_passwd, pw->pw_gecos, pw->pw_dir, pw->pw_shell) >= 0) return 0;
|
||||
+ return errno_or_else(EIO);
|
||||
+ }
|
||||
if (putpwent(pw, stream) != 0)
|
||||
return errno_or_else(EIO);
|
||||
|
||||
@@ -952,6 +957,19 @@ int putgrent_sane(const struct group *gr, FILE *stream) {
|
||||
assert(stream);
|
||||
|
||||
errno = 0;
|
||||
+ if (IN_SET(gr->gr_name[0], '+', '-')) {
|
||||
+ int r = fprintf(stream, "%s:%s::",
|
||||
+ gr->gr_name, gr->gr_passwd);
|
||||
+ if (r < 0) return errno_or_else(EIO);
|
||||
+ if (gr->gr_mem) {
|
||||
+ for (size_t i = 0; gr->gr_mem[i] && r >= 0; i++) {
|
||||
+ r = fprintf(stream, "%s%s", i?",":"", gr->gr_mem[i]);
|
||||
+ }
|
||||
+ if (r < 0) return errno_or_else(EIO);
|
||||
+ }
|
||||
+ if (fputc('\n', stream) >= 0) return 0;
|
||||
+ return errno_or_else(EIO);
|
||||
+ }
|
||||
if (putgrent(gr, stream) != 0)
|
||||
return errno_or_else(EIO);
|
||||
|
||||
--
|
||||
2.41.0
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
From 8b6e1c92f19163707789698860070738c607c2e8 Mon Sep 17 00:00:00 2001
|
||||
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
|
||||
Date: Sun, 18 Aug 2024 03:17:18 -0500
|
||||
Subject: [PATCH 29/34] edit-util: Don't clobber reserved identifier stdin
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
It may be #define'd instead of a global variable, which breaks using it
|
||||
as an identifier for ourselves.
|
||||
|
||||
Signed-off-by: A. Wilcox <AWilcox@Wilcox-Tech.com>
|
||||
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
||||
---
|
||||
src/shared/edit-util.c | 8 ++++----
|
||||
src/shared/edit-util.h | 2 +-
|
||||
src/systemctl/systemctl-edit.c | 2 +-
|
||||
3 files changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/shared/edit-util.c b/src/shared/edit-util.c
|
||||
index b0496032f7b8..412aeb219607 100644
|
||||
--- a/src/shared/edit-util.c
|
||||
+++ b/src/shared/edit-util.c
|
||||
@@ -212,7 +212,7 @@ static int create_edit_temp_file(EditFile *e, const char *contents, size_t conte
|
||||
if (fchmod(fileno(f), 0644) < 0)
|
||||
return log_error_errno(errno, "Failed to change mode of temporary file '%s': %m", temp);
|
||||
|
||||
- if (e->context->stdin) {
|
||||
+ if (e->context->_stdin) {
|
||||
if (fwrite(contents, 1, contents_size, f) != contents_size)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EIO),
|
||||
"Failed to copy input to temporary file '%s'.", temp);
|
||||
@@ -326,7 +326,7 @@ static int strip_edit_temp_file(EditFile *e) {
|
||||
if (!tmp)
|
||||
return log_oom();
|
||||
|
||||
- if (e->context->marker_start && !e->context->stdin) {
|
||||
+ if (e->context->marker_start && !e->context->_stdin) {
|
||||
/* Trim out the lines between the two markers */
|
||||
char *contents_start, *contents_end;
|
||||
|
||||
@@ -374,7 +374,7 @@ int do_edit_files_and_install(EditFileContext *context) {
|
||||
if (context->n_files == 0)
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(ENOENT), "Got no files to edit.");
|
||||
|
||||
- if (context->stdin) {
|
||||
+ if (context->_stdin) {
|
||||
r = read_full_stream(stdin, &data, &data_size);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to read stdin: %m");
|
||||
@@ -386,7 +386,7 @@ int do_edit_files_and_install(EditFileContext *context) {
|
||||
return r;
|
||||
}
|
||||
|
||||
- if (!context->stdin) {
|
||||
+ if (!context->_stdin) {
|
||||
r = run_editor(context);
|
||||
if (r < 0)
|
||||
return r;
|
||||
diff --git a/src/shared/edit-util.h b/src/shared/edit-util.h
|
||||
index 9d9c890f2a97..70b9bff2dd98 100644
|
||||
--- a/src/shared/edit-util.h
|
||||
+++ b/src/shared/edit-util.h
|
||||
@@ -15,7 +15,7 @@ typedef struct EditFileContext {
|
||||
const char *marker_end;
|
||||
bool remove_parent;
|
||||
bool overwrite_with_origin; /* Always overwrite target with original file. */
|
||||
- bool stdin; /* Read contents from stdin instead of launching an editor. */
|
||||
+ bool _stdin; /* Read contents from stdin instead of launching an editor. */
|
||||
} EditFileContext;
|
||||
|
||||
void edit_file_context_done(EditFileContext *context);
|
||||
diff --git a/src/systemctl/systemctl-edit.c b/src/systemctl/systemctl-edit.c
|
||||
index 15398f83646e..ae08d65b0f12 100644
|
||||
--- a/src/systemctl/systemctl-edit.c
|
||||
+++ b/src/systemctl/systemctl-edit.c
|
||||
@@ -316,7 +316,7 @@ int verb_edit(int argc, char *argv[], void *userdata) {
|
||||
.marker_end = DROPIN_MARKER_END,
|
||||
.remove_parent = !arg_full,
|
||||
.overwrite_with_origin = true,
|
||||
- .stdin = arg_stdin,
|
||||
+ ._stdin = arg_stdin,
|
||||
};
|
||||
_cleanup_strv_free_ char **names = NULL;
|
||||
sd_bus *bus;
|
||||
--
|
||||
2.41.0
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
From 13911055682e55f22c0dbbdb0f381360e8c160e2 Mon Sep 17 00:00:00 2001
|
||||
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
|
||||
Date: Sun, 18 Aug 2024 03:18:10 -0500
|
||||
Subject: [PATCH 30/34] test: Define FTW_CONTINUE if not already defined
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
||||
---
|
||||
src/test/test-recurse-dir.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/src/test/test-recurse-dir.c b/src/test/test-recurse-dir.c
|
||||
index 8684d064ec39..9697667f8dfc 100644
|
||||
--- a/src/test/test-recurse-dir.c
|
||||
+++ b/src/test/test-recurse-dir.c
|
||||
@@ -1,6 +1,9 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
#include <ftw.h>
|
||||
+#ifndef FTW_CONTINUE
|
||||
+#define FTW_CONTINUE 0
|
||||
+#endif
|
||||
|
||||
#include "fd-util.h"
|
||||
#include "log.h"
|
||||
--
|
||||
2.41.0
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
From 571037f7f86f2bd4a68a28aa19cb3aadaaacd75b Mon Sep 17 00:00:00 2001
|
||||
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
|
||||
Date: Sun, 18 Aug 2024 03:18:29 -0500
|
||||
Subject: [PATCH 31/34] os-util: Handle negative time_t values properly
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
musl's time framework happily accepts dates before 1970, which can
|
||||
result in negative time_t values being returned. These should still be
|
||||
considered as invalid dates for OS support.
|
||||
|
||||
Signed-off-by: A. Wilcox <AWilcox@Wilcox-Tech.com>
|
||||
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
||||
---
|
||||
src/basic/os-util.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/basic/os-util.c b/src/basic/os-util.c
|
||||
index 79f641b36474..8da1c012a223 100644
|
||||
--- a/src/basic/os-util.c
|
||||
+++ b/src/basic/os-util.c
|
||||
@@ -460,7 +460,7 @@ int os_release_support_ended(const char *support_end, bool quiet, usec_t *ret_eo
|
||||
"Failed to parse SUPPORT_END= in os-release file, ignoring: %m");
|
||||
|
||||
time_t eol = timegm(&tm);
|
||||
- if (eol == (time_t) -1)
|
||||
+ if (eol <= (time_t) -1)
|
||||
return log_full_errno(quiet ? LOG_DEBUG : LOG_WARNING, SYNTHETIC_ERRNO(EINVAL),
|
||||
"Failed to convert SUPPORT_END= in os-release file, ignoring: %m");
|
||||
|
||||
--
|
||||
2.41.0
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
From e6071a579fa7d28ace8c34ab90300b4f8be9bb47 Mon Sep 17 00:00:00 2001
|
||||
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
|
||||
Date: Sun, 18 Aug 2024 03:19:34 -0500
|
||||
Subject: [PATCH 32/34] test: Disable fileio test that fails on musl
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Needs further investigation.
|
||||
|
||||
This cannot be upstreamed.
|
||||
|
||||
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
||||
---
|
||||
src/test/test-fileio.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/test/test-fileio.c b/src/test/test-fileio.c
|
||||
index 474eacaf0468..472d653532fb 100644
|
||||
--- a/src/test/test-fileio.c
|
||||
+++ b/src/test/test-fileio.c
|
||||
@@ -432,7 +432,7 @@ TEST(write_string_stream) {
|
||||
|
||||
f = fdopen(fd, "r");
|
||||
assert_se(f);
|
||||
- assert_se(write_string_stream(f, "boohoo", 0) < 0);
|
||||
+ //assert_se(write_string_stream(f, "boohoo", 0) < 0);
|
||||
f = safe_fclose(f);
|
||||
|
||||
f = fopen(fn, "r+");
|
||||
--
|
||||
2.41.0
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
From c357ca7be7cd70c4b62c1889f7f110d50a85aa02 Mon Sep 17 00:00:00 2001
|
||||
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
|
||||
Date: Sun, 18 Aug 2024 06:18:40 -0500
|
||||
Subject: [PATCH 33/34] recurse-dir: Perform correct pointer math on de
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Without this, we are casting the pointer math itself to struct dirent*
|
||||
which causes invalid calculations on systems with structs aligned to a
|
||||
different width than uint8_t* (i.e. ppc64).
|
||||
|
||||
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
||||
---
|
||||
src/basic/recurse-dir.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/basic/recurse-dir.c b/src/basic/recurse-dir.c
|
||||
index 776733148b05..8c4b044ea0fb 100644
|
||||
--- a/src/basic/recurse-dir.c
|
||||
+++ b/src/basic/recurse-dir.c
|
||||
@@ -56,7 +56,8 @@ int readdir_all(int dir_fd,
|
||||
bs = MIN(MALLOC_SIZEOF_SAFE(de) - offsetof(DirectoryEntries, buffer), (size_t) SSIZE_MAX);
|
||||
assert(bs > de->buffer_size);
|
||||
|
||||
- n = getdents64(dir_fd, (uint8_t*) de->buffer + de->buffer_size, bs - de->buffer_size);
|
||||
+ uint8_t *ptr = (uint8_t*) de->buffer + de->buffer_size;
|
||||
+ n = getdents64(dir_fd, (struct dirent *)ptr, bs - de->buffer_size);
|
||||
if (n < 0)
|
||||
return -errno;
|
||||
if (n == 0)
|
||||
--
|
||||
2.41.0
|
||||
|
||||
35
sys-apps/systemd/files/0034-build-path-Disable-for-now.patch
Normal file
35
sys-apps/systemd/files/0034-build-path-Disable-for-now.patch
Normal file
@@ -0,0 +1,35 @@
|
||||
From 5cfb7905b38ca0e537b93403a7ef577bc3b19a82 Mon Sep 17 00:00:00 2001
|
||||
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
|
||||
Date: Sun, 18 Aug 2024 20:23:03 -0500
|
||||
Subject: [PATCH 34/34] build-path: Disable for now
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Digging for RPATH is broken on musl, and causes segfaults all throughout
|
||||
the systemd manager when running. This means we lose the ability to run
|
||||
systemd applets from a build tree, but we can just iterate in our
|
||||
virthosts until this can be fixed.
|
||||
|
||||
This cannot be upstreamed.
|
||||
|
||||
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
||||
---
|
||||
src/basic/build-path.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/basic/build-path.c b/src/basic/build-path.c
|
||||
index b5972658dfea..9c4c6233f76b 100644
|
||||
--- a/src/basic/build-path.c
|
||||
+++ b/src/basic/build-path.c
|
||||
@@ -157,7 +157,7 @@ int get_build_exec_dir(char **ret) {
|
||||
runpath_cached = get_runpath(&runpath);
|
||||
|
||||
/* We only care if the runpath starts with $ORIGIN/ */
|
||||
- if (runpath_cached > 0 && !startswith(runpath, "$ORIGIN/"))
|
||||
+ //if (runpath_cached > 0 && !startswith(runpath, "$ORIGIN/"))
|
||||
runpath_cached = 0;
|
||||
}
|
||||
if (runpath_cached < 0)
|
||||
--
|
||||
2.41.0
|
||||
|
||||
26
sys-apps/systemd/files/256-bpf-gcc.patch
Normal file
26
sys-apps/systemd/files/256-bpf-gcc.patch
Normal file
@@ -0,0 +1,26 @@
|
||||
https://github.com/systemd/systemd/commit/dde6f1d7456db7aa72d24b1d6956b419b6f9945c
|
||||
|
||||
From dde6f1d7456db7aa72d24b1d6956b419b6f9945c Mon Sep 17 00:00:00 2001
|
||||
From: Sam James <sam@gentoo.org>
|
||||
Date: Sat, 24 Aug 2024 13:09:47 +0100
|
||||
Subject: [PATCH] meson: search for 'bpf-unknown-none' too
|
||||
|
||||
We currently search for 'bpf-gcc' and 'bpf-none-gcc'. Gentoo's
|
||||
sys-devel/bpf-toolchain package uses 'bpf-unknown-none-gcc', as does Fedora's
|
||||
cross-binutils. Search for this name too.
|
||||
---
|
||||
meson.build | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/meson.build b/meson.build
|
||||
index 5e0b666c64b17..fbc2bbdf2f22f 100644
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -1109,6 +1109,7 @@ else
|
||||
elif bpf_compiler == 'gcc'
|
||||
bpf_gcc = find_program('bpf-gcc',
|
||||
'bpf-none-gcc',
|
||||
+ 'bpf-unknown-none-gcc',
|
||||
required : true,
|
||||
version : '>= 13.1.0')
|
||||
bpf_gcc_found = bpf_gcc.found()
|
||||
51
sys-apps/systemd/files/gentoo-journald-audit-r1.patch
Normal file
51
sys-apps/systemd/files/gentoo-journald-audit-r1.patch
Normal file
@@ -0,0 +1,51 @@
|
||||
From 2de502ccff1cc780d9d29c4ff7e6c1e0f2d7a082 Mon Sep 17 00:00:00 2001
|
||||
From: Mike Gilbert <floppym@gentoo.org>
|
||||
Date: Fri, 21 Aug 2020 13:16:17 -0400
|
||||
Subject: [PATCH] journald: do not change the kernel audit setting by default
|
||||
|
||||
Bug: https://bugs.gentoo.org/736910
|
||||
---
|
||||
man/journald.conf.xml | 2 +-
|
||||
src/journal/journald-server.c | 2 +-
|
||||
src/journal/journald.conf | 2 +-
|
||||
3 files changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/man/journald.conf.xml b/man/journald.conf.xml
|
||||
index 50c33e4792..2e14674f42 100644
|
||||
--- a/man/journald.conf.xml
|
||||
+++ b/man/journald.conf.xml
|
||||
@@ -427,7 +427,7 @@
|
||||
kernel auditing on start-up. If disabled it will turn it off. If unset it will neither enable nor
|
||||
disable it, leaving the previous state unchanged. This means if another tool turns on auditing even
|
||||
if <command>systemd-journald</command> left it off, it will still collect the generated
|
||||
- messages. Defaults to on.</para>
|
||||
+ messages.</para>
|
||||
|
||||
<para>Note that this option does not control whether <command>systemd-journald</command> collects
|
||||
generated audit records, it just controls whether it tells the kernel to generate them. If you need
|
||||
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
|
||||
index 022e12d83d..6b3d261af6 100644
|
||||
--- a/src/journal/journald-server.c
|
||||
+++ b/src/journal/journald-server.c
|
||||
@@ -2367,7 +2367,7 @@ int server_init(Server *s, const char *namespace) {
|
||||
.compress.threshold_bytes = UINT64_MAX,
|
||||
.seal = true,
|
||||
|
||||
- .set_audit = true,
|
||||
+ .set_audit = -1,
|
||||
|
||||
.watchdog_usec = USEC_INFINITY,
|
||||
|
||||
diff --git a/src/journal/journald.conf b/src/journal/journald.conf
|
||||
index 5a60a9d39c..64156d5463 100644
|
||||
--- a/src/journal/journald.conf
|
||||
+++ b/src/journal/journald.conf
|
||||
@@ -44,4 +44,4 @@
|
||||
#MaxLevelWall=emerg
|
||||
#LineMax=48K
|
||||
#ReadKMsg=yes
|
||||
-#Audit=yes
|
||||
+#Audit=
|
||||
--
|
||||
2.39.1
|
||||
|
||||
3
sys-apps/systemd/files/legacy.conf
Normal file
3
sys-apps/systemd/files/legacy.conf
Normal file
@@ -0,0 +1,3 @@
|
||||
# Based on legacy.conf from systemd
|
||||
d /run/lock
|
||||
L /var/lock - - - - ../run/lock
|
||||
31
sys-apps/systemd/files/systemd-test-process-util.patch
Normal file
31
sys-apps/systemd/files/systemd-test-process-util.patch
Normal file
@@ -0,0 +1,31 @@
|
||||
From c3f91c76af292e3bd2c6e2b12e37de88cf5d7c72 Mon Sep 17 00:00:00 2001
|
||||
From: Mike Gilbert <floppym@gentoo.org>
|
||||
Date: Thu, 18 Apr 2024 00:04:44 -0400
|
||||
Subject: [PATCH] test-process-util: remove assert that fails under pid-sandbox
|
||||
|
||||
Upstream refuses to fix this.
|
||||
|
||||
Bug: https://bugs.gentoo.org/674458
|
||||
Bug: https://github.com/systemd/systemd/issues/25015
|
||||
---
|
||||
src/test/test-process-util.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/test/test-process-util.c b/src/test/test-process-util.c
|
||||
index c96bd4341b..9ff1bdc082 100644
|
||||
--- a/src/test/test-process-util.c
|
||||
+++ b/src/test/test-process-util.c
|
||||
@@ -92,8 +92,8 @@ static void test_pid_get_comm_one(pid_t pid) {
|
||||
assert_se(r >= 0 || r == -EACCES);
|
||||
log_info("PID"PID_FMT" strlen(environ): %zi", pid, env ? (ssize_t)strlen(env) : (ssize_t)-errno);
|
||||
|
||||
- if (!detect_container())
|
||||
- assert_se(get_ctty_devnr(pid, &h) == -ENXIO || pid != 1);
|
||||
+
|
||||
+
|
||||
|
||||
(void) getenv_for_pid(pid, "PATH", &i);
|
||||
log_info("PID"PID_FMT" $PATH: '%s'", pid, strna(i));
|
||||
--
|
||||
2.44.0
|
||||
|
||||
5
sys-apps/systemd/files/systemd-user.pam
Normal file
5
sys-apps/systemd/files/systemd-user.pam
Normal file
@@ -0,0 +1,5 @@
|
||||
account include system-auth
|
||||
|
||||
session required pam_loginuid.so
|
||||
session include system-auth
|
||||
session optional pam_systemd.so
|
||||
Reference in New Issue
Block a user