Gentoo Archives: gentoo-commits

From: Mike Gilbert <floppym@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-fs/udev/, sys-fs/udev/files/
Date: Tue, 30 Jul 2019 14:46:08
Message-Id: 1564497904.bedd1302f0fdf5d892f9bf8be663e6b3bfa3cb0e.floppym@gentoo
1 commit: bedd1302f0fdf5d892f9bf8be663e6b3bfa3cb0e
2 Author: Mike Gilbert <floppym <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jul 30 14:44:29 2019 +0000
4 Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org>
5 CommitDate: Tue Jul 30 14:45:04 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bedd1302
7
8 sys-fs/udev: backport fixes for gcc 9
9
10 Closes: https://bugs.gentoo.org/690356
11 Package-Manager: Portage-2.3.69_p3, Repoman-2.3.16_p12
12 Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>
13
14 sys-fs/udev/files/242-gcc-9.patch | 163 ++++++++++++++++++++++++++++++++++++++
15 sys-fs/udev/udev-242.ebuild | 1 +
16 2 files changed, 164 insertions(+)
17
18 diff --git a/sys-fs/udev/files/242-gcc-9.patch b/sys-fs/udev/files/242-gcc-9.patch
19 new file mode 100644
20 index 00000000000..e9f690a65be
21 --- /dev/null
22 +++ b/sys-fs/udev/files/242-gcc-9.patch
23 @@ -0,0 +1,163 @@
24 +From c98b3545008d8e984ab456dcf79787418fcbfe13 Mon Sep 17 00:00:00 2001
25 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@××××××.pl>
26 +Date: Tue, 7 May 2019 13:46:55 +0200
27 +Subject: [PATCH] network: remove redunant link name in message
28 +
29 +Fixes #12454.
30 +
31 +gcc was complaining that the link->ifname argument is NULL. Adding
32 +assert(link->ifname) right before the call has no effect. It seems that
33 +gcc is confused by the fact that log_link_warning_errno() internally
34 +calls log_object(), with link->ifname passed as the object. log_object()
35 +is also a macro and is does a check whether the passed object is NULL.
36 +So we have a check if something is NULL right next an unconditional use
37 +of it where it cannot be NULL. I think it's a bug in gcc.
38 +
39 +Anyway, we don't need to use link->ifname here. log_object() already prepends
40 +the object name to the message.
41 +---
42 + src/network/networkd-link.c | 3 +--
43 + 1 file changed, 1 insertion(+), 2 deletions(-)
44 +
45 +diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
46 +index 533193ac932..6fc82940033 100644
47 +--- a/src/network/networkd-link.c
48 ++++ b/src/network/networkd-link.c
49 +@@ -338,8 +338,7 @@ static int link_enable_ipv6(Link *link) {
50 +
51 + r = sysctl_write_ip_property_boolean(AF_INET6, link->ifname, "disable_ipv6", disabled);
52 + if (r < 0)
53 +- log_link_warning_errno(link, r, "Cannot %s IPv6 for interface %s: %m",
54 +- enable_disable(!disabled), link->ifname);
55 ++ log_link_warning_errno(link, r, "Cannot %s IPv6: %m", enable_disable(!disabled));
56 + else
57 + log_link_info(link, "IPv6 successfully %sd", enable_disable(!disabled));
58 +
59 +From bcb846f30f9ca8f42e79d109706aee9f2032261b Mon Sep 17 00:00:00 2001
60 +From: Mike Gilbert <floppym@g.o>
61 +Date: Wed, 22 May 2019 10:31:01 -0400
62 +Subject: [PATCH] shared/machine-image: avoid passing NULL to log_debug_errno
63 +
64 +Fixes: https://github.com/systemd/systemd/issues/12534
65 +---
66 + src/shared/machine-image.c | 11 ++++++++---
67 + 1 file changed, 8 insertions(+), 3 deletions(-)
68 +
69 +diff --git a/src/shared/machine-image.c b/src/shared/machine-image.c
70 +index 6b9d8fb97a6..6a6d952b424 100644
71 +--- a/src/shared/machine-image.c
72 ++++ b/src/shared/machine-image.c
73 +@@ -201,11 +201,13 @@ static int image_make(
74 + Image **ret) {
75 +
76 + _cleanup_free_ char *pretty_buffer = NULL;
77 ++ _cleanup_free_ char *cwd = NULL;
78 + struct stat stbuf;
79 + bool read_only;
80 + int r;
81 +
82 + assert(dfd >= 0 || dfd == AT_FDCWD);
83 ++ assert(path || dfd == AT_FDCWD);
84 + assert(filename);
85 +
86 + /* We explicitly *do* follow symlinks here, since we want to allow symlinking trees, raw files and block
87 +@@ -221,6 +223,9 @@ static int image_make(
88 + st = &stbuf;
89 + }
90 +
91 ++ if (!path)
92 ++ safe_getcwd(&cwd);
93 ++
94 + read_only =
95 + (path && path_startswith(path, "/usr")) ||
96 + (faccessat(dfd, filename, W_OK, AT_EACCESS) < 0 && errno == EROFS);
97 +@@ -359,7 +364,7 @@ static int image_make(
98 +
99 + block_fd = openat(dfd, filename, O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_NOCTTY);
100 + if (block_fd < 0)
101 +- log_debug_errno(errno, "Failed to open block device %s/%s, ignoring: %m", path, filename);
102 ++ log_debug_errno(errno, "Failed to open block device %s/%s, ignoring: %m", path ?: strnull(cwd), filename);
103 + else {
104 + /* Refresh stat data after opening the node */
105 + if (fstat(block_fd, &stbuf) < 0)
106 +@@ -373,13 +378,13 @@ static int image_make(
107 + int state = 0;
108 +
109 + if (ioctl(block_fd, BLKROGET, &state) < 0)
110 +- log_debug_errno(errno, "Failed to issue BLKROGET on device %s/%s, ignoring: %m", path, filename);
111 ++ log_debug_errno(errno, "Failed to issue BLKROGET on device %s/%s, ignoring: %m", path ?: strnull(cwd), filename);
112 + else if (state)
113 + read_only = true;
114 + }
115 +
116 + if (ioctl(block_fd, BLKGETSIZE64, &size) < 0)
117 +- log_debug_errno(errno, "Failed to issue BLKGETSIZE64 on device %s/%s, ignoring: %m", path, filename);
118 ++ log_debug_errno(errno, "Failed to issue BLKGETSIZE64 on device %s/%s, ignoring: %m", path ?: strnull(cwd), filename);
119 +
120 + block_fd = safe_close(block_fd);
121 + }
122 +From 2570578d908a8e010828fa1f88826b1c45d534ff Mon Sep 17 00:00:00 2001
123 +From: Lennart Poettering <lennart@××××××××××.net>
124 +Date: Fri, 24 May 2019 10:54:09 +0200
125 +Subject: [PATCH] machine-image: openat() doesn't operate on the cwd if the
126 + first argument is specified
127 +
128 +A fix-up for bcb846f30f9ca8f42e79d109706aee9f2032261b.
129 +---
130 + src/shared/machine-image.c | 17 ++++++++++-------
131 + 1 file changed, 10 insertions(+), 7 deletions(-)
132 +
133 +diff --git a/src/shared/machine-image.c b/src/shared/machine-image.c
134 +index 6a6d952b424..55e5f08f91e 100644
135 +--- a/src/shared/machine-image.c
136 ++++ b/src/shared/machine-image.c
137 +@@ -200,8 +200,7 @@ static int image_make(
138 + const struct stat *st,
139 + Image **ret) {
140 +
141 +- _cleanup_free_ char *pretty_buffer = NULL;
142 +- _cleanup_free_ char *cwd = NULL;
143 ++ _cleanup_free_ char *pretty_buffer = NULL, *parent = NULL;
144 + struct stat stbuf;
145 + bool read_only;
146 + int r;
147 +@@ -223,8 +222,12 @@ static int image_make(
148 + st = &stbuf;
149 + }
150 +
151 +- if (!path)
152 +- safe_getcwd(&cwd);
153 ++ if (!path) {
154 ++ if (dfd == AT_FDCWD)
155 ++ (void) safe_getcwd(&parent);
156 ++ else
157 ++ (void) fd_get_path(dfd, &parent);
158 ++ }
159 +
160 + read_only =
161 + (path && path_startswith(path, "/usr")) ||
162 +@@ -364,7 +367,7 @@ static int image_make(
163 +
164 + block_fd = openat(dfd, filename, O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_NOCTTY);
165 + if (block_fd < 0)
166 +- log_debug_errno(errno, "Failed to open block device %s/%s, ignoring: %m", path ?: strnull(cwd), filename);
167 ++ log_debug_errno(errno, "Failed to open block device %s/%s, ignoring: %m", path ?: strnull(parent), filename);
168 + else {
169 + /* Refresh stat data after opening the node */
170 + if (fstat(block_fd, &stbuf) < 0)
171 +@@ -378,13 +381,13 @@ static int image_make(
172 + int state = 0;
173 +
174 + if (ioctl(block_fd, BLKROGET, &state) < 0)
175 +- log_debug_errno(errno, "Failed to issue BLKROGET on device %s/%s, ignoring: %m", path ?: strnull(cwd), filename);
176 ++ log_debug_errno(errno, "Failed to issue BLKROGET on device %s/%s, ignoring: %m", path ?: strnull(parent), filename);
177 + else if (state)
178 + read_only = true;
179 + }
180 +
181 + if (ioctl(block_fd, BLKGETSIZE64, &size) < 0)
182 +- log_debug_errno(errno, "Failed to issue BLKGETSIZE64 on device %s/%s, ignoring: %m", path ?: strnull(cwd), filename);
183 ++ log_debug_errno(errno, "Failed to issue BLKGETSIZE64 on device %s/%s, ignoring: %m", path ?: strnull(parent), filename);
184 +
185 + block_fd = safe_close(block_fd);
186 + }
187
188 diff --git a/sys-fs/udev/udev-242.ebuild b/sys-fs/udev/udev-242.ebuild
189 index 0490d5f1dea..126aa9ccf37 100644
190 --- a/sys-fs/udev/udev-242.ebuild
191 +++ b/sys-fs/udev/udev-242.ebuild
192 @@ -97,6 +97,7 @@ src_prepare() {
193 fi
194
195 local PATCHES=(
196 + "${FILESDIR}"/242-gcc-9.patch
197 )
198
199 default