1
0
mirror of https://github.com/systemd/systemd synced 2026-04-25 00:14:54 +02:00

Compare commits

..

No commits in common. "3a3b022d2cc112803ea7b9beea98bbcad110368a" and "8dc3c2f197370e2a63dce6ab03d48eba85c4ffdf" have entirely different histories.

23 changed files with 112 additions and 143 deletions

7
README
View File

@ -353,13 +353,6 @@ WARNINGS and TAINT FLAGS:
For more information on this issue consult For more information on this issue consult
https://www.freedesktop.org/wiki/Software/systemd/separate-usr-is-broken https://www.freedesktop.org/wiki/Software/systemd/separate-usr-is-broken
systemd will warn if the filesystem is not usr-merged (i.e.: /bin, /sbin
and /lib* are not symlinks to their counterparts under /usr). Taint flag
'unmerged-usr' will be set when this condition is detected.
For more information on this issue consult
https://www.freedesktop.org/wiki/Software/systemd/TheCaseForTheUsrMerge
systemd requires that the /run mount point exists. systemd also systemd requires that the /run mount point exists. systemd also
requires that /var/run is a symlink to /run. Taint flag 'var-run-bad' requires that /var/run is a symlink to /run. Taint flag 'var-run-bad'
will be set when this condition is detected. will be set when this condition is detected.

View File

@ -13,7 +13,6 @@ System and Service Manager
[![CentOS CI - CentOS 8](https://jenkins-systemd.apps.ocp.ci.centos.org/buildStatus/icon?subject=CentOS%20CI%20-%20CentOS%208&job=upstream-centos8)](https://jenkins-systemd.apps.ocp.ci.centos.org/job/upstream-centos8/)<br/> [![CentOS CI - CentOS 8](https://jenkins-systemd.apps.ocp.ci.centos.org/buildStatus/icon?subject=CentOS%20CI%20-%20CentOS%208&job=upstream-centos8)](https://jenkins-systemd.apps.ocp.ci.centos.org/job/upstream-centos8/)<br/>
[![CentOS CI - Arch](https://jenkins-systemd.apps.ocp.ci.centos.org/buildStatus/icon?subject=CentOS%20CI%20-%20Arch&job=upstream-vagrant-archlinux)](https://jenkins-systemd.apps.ocp.ci.centos.org/job/upstream-vagrant-archlinux/)<br/> [![CentOS CI - Arch](https://jenkins-systemd.apps.ocp.ci.centos.org/buildStatus/icon?subject=CentOS%20CI%20-%20Arch&job=upstream-vagrant-archlinux)](https://jenkins-systemd.apps.ocp.ci.centos.org/job/upstream-vagrant-archlinux/)<br/>
[![CentOS CI - Arch (sanitizers)](https://jenkins-systemd.apps.ocp.ci.centos.org/buildStatus/icon?subject=CentOS%20CI%20-%20Arch%20(sanitizers)&job=upstream-vagrant-archlinux-sanitizers)](https://jenkins-systemd.apps.ocp.ci.centos.org/job/upstream-vagrant-archlinux-sanitizers/)<br/> [![CentOS CI - Arch (sanitizers)](https://jenkins-systemd.apps.ocp.ci.centos.org/buildStatus/icon?subject=CentOS%20CI%20-%20Arch%20(sanitizers)&job=upstream-vagrant-archlinux-sanitizers)](https://jenkins-systemd.apps.ocp.ci.centos.org/job/upstream-vagrant-archlinux-sanitizers/)<br/>
[![CentOS CI - Rawhide (SELinux)](https://jenkins-systemd.apps.ocp.ci.centos.org/buildStatus/icon?subject=CentOS%20CI%20-%20Rawhide%20(SELinux)&job=upstream-vagrant-rawhide-selinux)](https://jenkins-systemd.apps.ocp.ci.centos.org/view/Upstream/job/upstream-vagrant-rawhide-selinux/)<br/>
[![Fossies codespell report](https://fossies.org/linux/test/systemd-main.tar.gz/codespell.svg)](https://fossies.org/linux/test/systemd-main.tar.gz/codespell.html)</br> [![Fossies codespell report](https://fossies.org/linux/test/systemd-main.tar.gz/codespell.svg)](https://fossies.org/linux/test/systemd-main.tar.gz/codespell.html)</br>
[![Coverage Status](https://coveralls.io/repos/github/systemd/systemd/badge.svg?branch=main)](https://coveralls.io/github/systemd/systemd?branch=main)</br> [![Coverage Status](https://coveralls.io/repos/github/systemd/systemd/badge.svg?branch=main)](https://coveralls.io/github/systemd/systemd?branch=main)</br>
[![Packaging status](https://repology.org/badge/tiny-repos/systemd.svg)](https://repology.org/project/systemd/versions) [![Packaging status](https://repology.org/badge/tiny-repos/systemd.svg)](https://repology.org/project/systemd/versions)

7
TODO
View File

@ -78,13 +78,6 @@ Janitorial Clean-ups:
Features: Features:
* get_color_mode() should probably check the $COLORTERM environment variable
which most terminal environments appear to set.
* firstboot: maybe just default to C.UTF-8 locale if nothing is set, so that we
don't query this unnecessarily in entirely uninitialized
containers. (i.e. containers with empty /etc).
* systemd creds hookup with qemu fw_cfg. (Quite possibly might not need any * systemd creds hookup with qemu fw_cfg. (Quite possibly might not need any
code at all, given the fw_cfg stuff are just files, but we should then code at all, given the fw_cfg stuff are just files, but we should then
document how to use it). Goal: provide symmetric ways to pass creds to nspawn document how to use it). Goal: provide symmetric ways to pass creds to nspawn

View File

@ -3,6 +3,11 @@
# The lookup keys are composed in: # The lookup keys are composed in:
# 60-evdev.rules # 60-evdev.rules
# #
# Note: The format of the "evdev:" prefix match key is a contract between the
# rules file and the hardware data, it might change in later revisions to
# support more or better matches, it is not necessarily expected to be a stable
# ABI.
#
# Match string formats: # Match string formats:
# evdev:<modalias> # evdev:<modalias>
# evdev:name:<device name>:dmi:<dmi string> # evdev:name:<device name>:dmi:<dmi string>

View File

@ -3,6 +3,11 @@
# The lookup keys are composed in: # The lookup keys are composed in:
# 60-input-id.rules # 60-input-id.rules
# #
# Note: The format of the "input-id:" prefix match key is a contract between
# the rules file and the hardware data, it might change in later revisions to
# support more or better matches, it is not necessarily expected to be a stable
# ABI.
#
# Match string formats: # Match string formats:
# id-input:modalias:<modalias> # id-input:modalias:<modalias>
# #

View File

@ -13,6 +13,11 @@
# The lookup keys are composed in: # The lookup keys are composed in:
# 60-evdev.rules # 60-evdev.rules
# #
# Note: The format of the "evdev:" prefix match key is a contract between the
# rules file and the hardware data, it might change in later revisions to
# support more or better matches, it is not necessarily expected to be a stable
# ABI.
#
# Supported hardware matches are: # Supported hardware matches are:
# - Generic input devices match: # - Generic input devices match:
# evdev:input:bZZZZvYYYYpXXXXeWWWW-VVVV # evdev:input:bZZZZvYYYYpXXXXeWWWW-VVVV

View File

@ -3,6 +3,11 @@
# The lookup keys are composed in: # The lookup keys are composed in:
# 60-sensor.rules # 60-sensor.rules
# #
# Note: The format of the "sensor:" prefix match key is a contract between the
# rules file and the hardware data, it might change in later revisions to
# support more or better matches, it is not necessarily expected to be a stable
# ABI.
#
# Match string formats: # Match string formats:
# sensor:modalias:<parent modalias pattern>:dmi:<dmi pattern> # sensor:modalias:<parent modalias pattern>:dmi:<dmi pattern>
# #

View File

@ -6,6 +6,11 @@
# The lookup keys are composed in: # The lookup keys are composed in:
# 70-mouse.rules # 70-mouse.rules
# #
# Note: The format of the "mouse:" prefix match key is a contract between the
# rules file and the hardware data, it might change in later revisions to
# support more or better matches, it is not necessarily expected to be a stable
# ABI.
#
# Match key format: # Match key format:
# mouse:<subsystem>:v<vid>p<pid>:name:<name>: # mouse:<subsystem>:v<vid>p<pid>:name:<name>:
# #

View File

@ -7,6 +7,10 @@
# The lookup keys are composed in: # The lookup keys are composed in:
# 60-evdev.rules # 60-evdev.rules
# #
# Note: The format of the "evdev:" prefix match key is a contract between the
# rules file and the hardware data, it might change in later revisions to
# support more or better matches, it is not necessarily a stable ABI.
#
# Supported hardware matches are: # Supported hardware matches are:
# - Generic input devices match: # - Generic input devices match:
# evdev:input:bZZZZvYYYYpXXXXeWWWW-VVVV # evdev:input:bZZZZvYYYYpXXXXeWWWW-VVVV

View File

@ -819,12 +819,10 @@ $ systemd-analyze verify /tmp/source:alias.service
<listitem><para>Control verification of units and their dependencies and whether <listitem><para>Control verification of units and their dependencies and whether
<command>systemd-analyze verify</command> exits with a non-zero process exit status or not. With <command>systemd-analyze verify</command> exits with a non-zero process exit status or not. With
<command>yes</command>, return a non-zero process exit status when warnings arise during verification <command>yes</command>, return a non-zero process exit status when warnings arise during verification
of either the specified unit or any of its associated dependencies. With <command>no</command>, of either the specified unit or any of its associated dependencies. This is the default. With
return a non-zero process exit status when warnings arise during verification of only the specified <command>no</command>, return a non-zero process exit status when warnings arise during verification
unit. With <command>one</command>, return a non-zero process exit status when warnings arise during of only the specified unit. With <command>one</command>, return a non-zero process exit status when
verification of either the specified unit or its immediate dependencies. If this option is not warnings arise during verification of either the specified unit or its immediate dependencies. </para></listitem>
specified, zero is returned as the exit status regardless whether warnings arise during verification
or not.</para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>

View File

@ -90,7 +90,7 @@ PagerFlags arg_pager_flags = 0;
BusTransport arg_transport = BUS_TRANSPORT_LOCAL; BusTransport arg_transport = BUS_TRANSPORT_LOCAL;
const char *arg_host = NULL; const char *arg_host = NULL;
LookupScope arg_scope = LOOKUP_SCOPE_SYSTEM; LookupScope arg_scope = LOOKUP_SCOPE_SYSTEM;
RecursiveErrors arg_recursive_errors = _RECURSIVE_ERRORS_INVALID; RecursiveErrors arg_recursive_errors = RECURSIVE_ERRORS_YES;
bool arg_man = true; bool arg_man = true;
bool arg_generators = false; bool arg_generators = false;
char *arg_root = NULL; char *arg_root = NULL;

View File

@ -351,7 +351,7 @@ int strv_split_colon_pairs(char ***t, const char *s) {
return (int) n; return (int) n;
} }
char* strv_join_full(char * const *l, const char *separator, const char *prefix, bool escape_separator) { char* strv_join_full(char * const *l, const char *separator, const char *prefix, bool unescape_separators) {
char *r, *e; char *r, *e;
size_t n, k, m; size_t n, k, m;
@ -361,7 +361,7 @@ char* strv_join_full(char * const *l, const char *separator, const char *prefix,
k = strlen(separator); k = strlen(separator);
m = strlen_ptr(prefix); m = strlen_ptr(prefix);
if (escape_separator) /* If the separator was multi-char, we wouldn't know how to escape it. */ if (unescape_separators) /* If there separator is multi-char, we won't know how to escape it. */
assert(k == 1); assert(k == 1);
n = 0; n = 0;
@ -369,7 +369,7 @@ char* strv_join_full(char * const *l, const char *separator, const char *prefix,
if (s != l) if (s != l)
n += k; n += k;
bool needs_escaping = escape_separator && strchr(*s, *separator); bool needs_escaping = unescape_separators && strchr(*s, separator[0]);
n += m + strlen(*s) * (1 + needs_escaping); n += m + strlen(*s) * (1 + needs_escaping);
} }
@ -386,11 +386,11 @@ char* strv_join_full(char * const *l, const char *separator, const char *prefix,
if (prefix) if (prefix)
e = stpcpy(e, prefix); e = stpcpy(e, prefix);
bool needs_escaping = escape_separator && strchr(*s, *separator); bool needs_escaping = unescape_separators && strchr(*s, separator[0]);
if (needs_escaping) if (needs_escaping)
for (size_t i = 0; (*s)[i]; i++) { for (size_t i = 0; (*s)[i]; i++) {
if ((*s)[i] == *separator) if ((*s)[i] == separator[0])
*(e++) = '\\'; *(e++) = '\\';
*(e++) = (*s)[i]; *(e++) = (*s)[i];
} }

View File

@ -101,7 +101,7 @@ static inline char** strv_split_newlines(const char *s) {
* string in the vector is an empty string. */ * string in the vector is an empty string. */
int strv_split_colon_pairs(char ***t, const char *s); int strv_split_colon_pairs(char ***t, const char *s);
char* strv_join_full(char * const *l, const char *separator, const char *prefix, bool escape_separator); char* strv_join_full(char * const *l, const char *separator, const char *prefix, bool escape_separtor);
static inline char *strv_join(char * const *l, const char *separator) { static inline char *strv_join(char * const *l, const char *separator) {
return strv_join_full(l, separator, NULL, false); return strv_join_full(l, separator, NULL, false);
} }

View File

@ -4370,58 +4370,71 @@ static int short_uid_range(const char *path) {
return !uid_range_covers(p, n, 0, 65535); return !uid_range_covers(p, n, 0, 65535);
} }
char* manager_taint_string(const Manager *m) { char *manager_taint_string(Manager *m) {
/* Returns a "taint string", e.g. "local-hwclock:var-run-bad". Only things that are detected at _cleanup_free_ char *destination = NULL, *overflowuid = NULL, *overflowgid = NULL;
* runtime should be tagged here. For stuff that is known during compilation, emit a warning in the struct utsname uts;
char *buf, *e;
int r;
/* Returns a "taint string", e.g. "local-hwclock:var-run-bad". Only things that are detected at
* runtime should be tagged here. For stuff that is set during compilation, emit a warning in the
* configuration phase. */ * configuration phase. */
assert(m); assert(m);
const char* stage[12] = {}; buf = new(char, sizeof("split-usr:"
size_t n = 0; "cgroups-missing:"
"cgroupsv1:"
"local-hwclock:"
"var-run-bad:"
"overflowuid-not-65534:"
"overflowgid-not-65534:"
"old-kernel:"
"short-uid-range:"
"short-gid-range:"));
if (!buf)
return NULL;
e = buf;
buf[0] = 0;
if (m->taint_usr) if (m->taint_usr)
stage[n++] = "split-usr"; e = stpcpy(e, "split-usr:");
_cleanup_free_ char *usrbin = NULL;
if (readlink_malloc("/bin", &usrbin) < 0 || !PATH_IN_SET(usrbin, "usr/bin", "/usr/bin"))
stage[n++] = "unmerged-usr";
if (access("/proc/cgroups", F_OK) < 0) if (access("/proc/cgroups", F_OK) < 0)
stage[n++] = "cgroups-missing"; e = stpcpy(e, "cgroups-missing:");
if (cg_all_unified() == 0) if (cg_all_unified() == 0)
stage[n++] = "cgroupsv1"; e = stpcpy(e, "cgroupsv1:");
if (clock_is_localtime(NULL) > 0) if (clock_is_localtime(NULL) > 0)
stage[n++] = "local-hwclock"; e = stpcpy(e, "local-hwclock:");
_cleanup_free_ char *destination = NULL; r = readlink_malloc("/var/run", &destination);
if (readlink_malloc("/var/run", &destination) < 0 || if (r < 0 || !PATH_IN_SET(destination, "../run", "/run"))
!PATH_IN_SET(destination, "../run", "/run")) e = stpcpy(e, "var-run-bad:");
stage[n++] = "var-run-bad";
_cleanup_free_ char *overflowuid = NULL, *overflowgid = NULL; r = read_one_line_file("/proc/sys/kernel/overflowuid", &overflowuid);
if (read_one_line_file("/proc/sys/kernel/overflowuid", &overflowuid) >= 0 && if (r >= 0 && !streq(overflowuid, "65534"))
!streq(overflowuid, "65534")) e = stpcpy(e, "overflowuid-not-65534:");
stage[n++] = "overflowuid-not-65534"; r = read_one_line_file("/proc/sys/kernel/overflowgid", &overflowgid);
if (read_one_line_file("/proc/sys/kernel/overflowgid", &overflowgid) >= 0 && if (r >= 0 && !streq(overflowgid, "65534"))
!streq(overflowgid, "65534")) e = stpcpy(e, "overflowgid-not-65534:");
stage[n++] = "overflowgid-not-65534";
struct utsname uts;
assert_se(uname(&uts) >= 0); assert_se(uname(&uts) >= 0);
if (strverscmp_improved(uts.release, KERNEL_BASELINE_VERSION) < 0) if (strverscmp_improved(uts.release, KERNEL_BASELINE_VERSION) < 0)
stage[n++] = "old-kernel"; e = stpcpy(e, "old-kernel:");
if (short_uid_range("/proc/self/uid_map") > 0) if (short_uid_range("/proc/self/uid_map") > 0)
stage[n++] = "short-uid-range"; e = stpcpy(e, "short-uid-range:");
if (short_uid_range("/proc/self/gid_map") > 0) if (short_uid_range("/proc/self/gid_map") > 0)
stage[n++] = "short-gid-range"; e = stpcpy(e, "short-gid-range:");
assert(n < ELEMENTSOF(stage) - 1); /* One extra for NULL terminator */ /* remove the last ':' */
if (e != buf)
e[-1] = 0;
return strv_join((char**) stage, ":"); return buf;
} }
void manager_ref_console(Manager *m) { void manager_ref_console(Manager *m) {

View File

@ -551,7 +551,7 @@ int manager_ref_uid(Manager *m, uid_t uid, bool clean_ipc);
void manager_unref_gid(Manager *m, gid_t gid, bool destroy_now); void manager_unref_gid(Manager *m, gid_t gid, bool destroy_now);
int manager_ref_gid(Manager *m, gid_t gid, bool clean_ipc); int manager_ref_gid(Manager *m, gid_t gid, bool clean_ipc);
char* manager_taint_string(const Manager *m); char *manager_taint_string(Manager *m);
void manager_ref_console(Manager *m); void manager_ref_console(Manager *m);
void manager_unref_console(Manager *m); void manager_unref_console(Manager *m);

View File

@ -201,7 +201,7 @@ $D/zzz7 : start= 6291416, size= 98304, type=0FC63DAF-8483-4772-8E79-3D
EOF EOF
LOOP="$(losetup -P --show --find "$D/zzz")" LOOP="$(losetup -P --show --find "$D/zzz")"
"${udevadm:?}" wait --timeout 60 --settle "${LOOP:?}" "${udevadm:?}" wait --timeout 60 --initialized=yes --settle "${LOOP:?}"
VOLUME="test-repart-$RANDOM" VOLUME="test-repart-$RANDOM"

View File

@ -9,9 +9,9 @@
#include "device-util.h" #include "device-util.h"
#include "devnode-acl.h" #include "devnode-acl.h"
#include "dirent-util.h" #include "dirent-util.h"
#include "escape.h"
#include "fd-util.h" #include "fd-util.h"
#include "format-util.h" #include "format-util.h"
#include "fs-util.h"
#include "set.h" #include "set.h"
#include "string-util.h" #include "string-util.h"
#include "util.h" #include "util.h"
@ -195,18 +195,21 @@ int devnode_acl_all(const char *seat,
dir = opendir("/run/udev/static_node-tags/uaccess"); dir = opendir("/run/udev/static_node-tags/uaccess");
if (dir) { if (dir) {
FOREACH_DIRENT(de, dir, return -errno) { FOREACH_DIRENT(de, dir, return -errno) {
r = readlinkat_malloc(dirfd(dir), de->d_name, &n); _cleanup_free_ char *unescaped_devname = NULL;
if (r == -ENOENT) ssize_t l;
continue;
if (r < 0) { l = cunescape(de->d_name, UNESCAPE_RELAX, &unescaped_devname);
log_debug_errno(r, if (l < 0)
"Unable to read symlink '/run/udev/static_node-tags/uaccess/%s', ignoring: %m", return l;
de->d_name);
continue; n = path_join("/dev", unescaped_devname);
} if (!n)
return -ENOMEM;
log_debug("Found static node %s for seat %s", n, seat); log_debug("Found static node %s for seat %s", n, seat);
r = set_consume(nodes, n); r = set_consume(nodes, n);
if (r == -EEXIST)
continue;
if (r < 0) if (r < 0)
return r; return r;
} }

View File

@ -352,14 +352,9 @@ static int md_list_get(MountPoint **head) {
if (r < 0) if (r < 0)
return r; return r;
/* Filter out partitions. */
r = sd_device_enumerator_add_match_property(e, "DEVTYPE", "disk");
if (r < 0)
return r;
FOREACH_DEVICE(e, d) { FOREACH_DEVICE(e, d) {
_cleanup_free_ char *p = NULL; _cleanup_free_ char *p = NULL;
const char *dn, *md_level; const char *dn;
MountPoint *m; MountPoint *m;
dev_t devnum; dev_t devnum;
@ -367,17 +362,6 @@ static int md_list_get(MountPoint **head) {
sd_device_get_devname(d, &dn) < 0) sd_device_get_devname(d, &dn) < 0)
continue; continue;
r = sd_device_get_property_value(d, "MD_LEVEL", &md_level);
if (r < 0) {
log_warning_errno(r, "Failed to get MD_LEVEL property for %s, ignoring: %m", dn);
continue;
}
/* MD "containers" are a special type of MD devices, used for external metadata.
* Since it doesn't provide RAID functionality in itself we don't need to stop it. */
if (streq(md_level, "container"))
continue;
p = strdup(dn); p = strdup(dn);
if (!p) if (!p)
return -ENOMEM; return -ENOMEM;

View File

@ -56,12 +56,6 @@ tests += [
libblkid], libblkid],
core_includes], core_includes],
[files('test-manager.c'),
[libcore,
libshared],
[],
core_includes],
[files('test-emergency-action.c'), [files('test-emergency-action.c'),
[libcore, [libcore,
libshared], libshared],

View File

@ -1,29 +0,0 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "manager.h"
#include "tests.h"
TEST(manager_taint_string) {
Manager m = {};
_cleanup_free_ char *a = manager_taint_string(&m);
assert_se(a);
log_debug("taint string w/o split-usr: '%s'", a);
/* split-usr is the only one that is cached in Manager, so we know it's not present.
* The others are queried dynamically, so we'd need to duplicate the logic here
* to test for them. Let's do just one. */
assert_se(!strstr(a, "split-usr"));
if (cg_all_unified() == 0)
assert_se(strstr(a, "cgroupsv1"));
else
assert_se(!strstr(a, "cgroupsv1"));
m.taint_usr = true;
_cleanup_free_ char *b = manager_taint_string(&m);
assert_se(b);
log_debug("taint string w/ split-usr: '%s'", b);
assert_se(strstr(b, "split-usr"));
}
DEFINE_TEST_MAIN(LOG_DEBUG);

View File

@ -442,12 +442,6 @@ static int device_get_whole_disk(sd_device *dev, sd_device **ret_device, const c
if (r < 0) if (r < 0)
return log_device_debug_errno(dev, r, "Failed to get sysname: %m"); return log_device_debug_errno(dev, r, "Failed to get sysname: %m");
/* Exclude the following devices:
* For "dm-", see the comment added by e918a1b5a94f270186dca59156354acd2a596494.
* For "md", see the commit message of 2e5b17d01347d3c3118be2b8ad63d20415dbb1f0,
* but not sure the assumption is still valid even when partitions are created on the md
* devices, surprisingly which seems to be possible, see PR #22973.
* For "drbd", see the commit message of fee854ee8ccde0cd28e0f925dea18cce35f3993d. */
if (STARTSWITH_SET(val, "dm-", "md", "drbd")) if (STARTSWITH_SET(val, "dm-", "md", "drbd"))
goto irrelevant; goto irrelevant;

View File

@ -173,22 +173,20 @@ rm -r /tmp/testsuite-58.3-defs/
# testcase for #21817 # testcase for #21817
mkdir -p /tmp/testsuite-58-issue-21817-defs/ mkdir -p /tmp/testsuite-58-issue-21817-defs/
truncate -s 100m /var/tmp/testsuite-58-issue-21817.img truncate -s 100m /var/tmp/testsuite-58-issue-21817.img
sfdisk /var/tmp/testsuite-58-issue-21817.img <<EOF LOOP=$(losetup -P --show -f /var/tmp/testsuite-58-issue-21817.img)
label: gpt udevadm wait --timeout 60 --initialized=yes --settle "${LOOP:?}"
printf 'size=50M,type=%s\n,\n' "${root_guid}" | sfdisk -X gpt "$LOOP"
size=50M, type=${root_guid}
,
EOF
cat >/tmp/testsuite-58-issue-21817-defs/test.conf <<EOF cat >/tmp/testsuite-58-issue-21817-defs/test.conf <<EOF
[Partition] [Partition]
Type=root Type=root
EOF EOF
systemd-repart --pretty=yes --definitions /tmp/testsuite-58-issue-21817-defs/ --dry-run=no /var/tmp/testsuite-58-issue-21817.img systemd-repart --pretty=yes --definitions /tmp/testsuite-58-issue-21817-defs/ "$LOOP"
sfdisk --dump /var/tmp/testsuite-58-issue-21817.img | tee /tmp/testsuite-58-issue-21817.dump sfdisk --dump "$LOOP" | tee /tmp/testsuite-58-issue-21817.dump
losetup -d "$LOOP"
grep -qiF "/var/tmp/testsuite-58-issue-21817.img1 : start= 2048, size= 102400, type=${root_guid}," /tmp/testsuite-58-issue-21817.dump grep -qiF "p1 : start= 2048, size= 102400, type=${root_guid}," /tmp/testsuite-58-issue-21817.dump
# Accept both unpadded (pre-v2.38 util-linux) and padded (v2.38+ util-linux) sizes # Accept both unpadded (pre-v2.38 util-linux) and padded (v2.38+ util-linux) sizes
grep -qE "/var/tmp/testsuite-58-issue-21817.img2 : start= 104448, size= (100319| 98304)," /tmp/testsuite-58-issue-21817.dump grep -qE "p2 : start= 104448, size= (100319| 98304)," /tmp/testsuite-58-issue-21817.dump
rm /var/tmp/testsuite-58-issue-21817.img /tmp/testsuite-58-issue-21817.dump rm /var/tmp/testsuite-58-issue-21817.img /tmp/testsuite-58-issue-21817.dump
rm -r /tmp/testsuite-58-issue-21817-defs/ rm -r /tmp/testsuite-58-issue-21817-defs/
@ -218,7 +216,7 @@ EOF
truncate -s 100m "/tmp/testsuite-58-sector-$1.img" truncate -s 100m "/tmp/testsuite-58-sector-$1.img"
LOOP=$(losetup -b "$1" -P --show -f "/tmp/testsuite-58-sector-$1.img" ) LOOP=$(losetup -b "$1" -P --show -f "/tmp/testsuite-58-sector-$1.img" )
udevadm wait --timeout 60 --settle "${LOOP:?}" udevadm wait --timeout 60 --initialized=yes --settle "${LOOP:?}"
systemd-repart --pretty=yes --definitions=/tmp/testsuite-58-sector/ --seed=750b6cd5c4ae4012a15e7be3c29e6a47 --empty=require --dry-run=no "$LOOP" systemd-repart --pretty=yes --definitions=/tmp/testsuite-58-sector/ --seed=750b6cd5c4ae4012a15e7be3c29e6a47 --empty=require --dry-run=no "$LOOP"
rm -rf /tmp/testsuite-58-sector rm -rf /tmp/testsuite-58-sector
sfdisk --verify "$LOOP" sfdisk --verify "$LOOP"

View File

@ -168,7 +168,7 @@ $(printf 'name="test%d", size=2M\n' {1..50})
EOF EOF
# Initial partition table # Initial partition table
udevadm lock --device="$blockdev" sfdisk -q -X gpt "$blockdev" <"$partscript" sfdisk -q -X gpt "$blockdev" <"$partscript"
# Delete the partitions, immediately recreate them, wait for udev to settle # Delete the partitions, immediately recreate them, wait for udev to settle
# down, and then check if we have any dangling symlinks in /dev/disk/. Rinse # down, and then check if we have any dangling symlinks in /dev/disk/. Rinse
@ -177,8 +177,8 @@ EOF
# On unpatched udev versions the delete-recreate cycle may trigger a race # On unpatched udev versions the delete-recreate cycle may trigger a race
# leading to dead symlinks in /dev/disk/ # leading to dead symlinks in /dev/disk/
for i in {1..100}; do for i in {1..100}; do
udevadm lock --device="$blockdev" sfdisk -q --delete "$blockdev" sfdisk -q --delete "$blockdev"
udevadm lock --device="$blockdev" sfdisk -q -X gpt "$blockdev" <"$partscript" sfdisk -q -X gpt "$blockdev" <"$partscript"
if ((i % 10 == 0)); then if ((i % 10 == 0)); then
udevadm wait --settle --timeout=30 "$blockdev" udevadm wait --settle --timeout=30 "$blockdev"
@ -281,7 +281,7 @@ testcase_btrfs_basic() {
echo "Multiple devices: using partitions, data: single, metadata: raid1" echo "Multiple devices: using partitions, data: single, metadata: raid1"
uuid="deadbeef-dead-dead-beef-000000000001" uuid="deadbeef-dead-dead-beef-000000000001"
label="btrfs_mpart" label="btrfs_mpart"
udevadm lock --device="${devices[0]}" sfdisk --wipe=always "${devices[0]}" <<EOF sfdisk --wipe=always "${devices[0]}" <<EOF
label: gpt label: gpt
name="diskpart1", size=85M name="diskpart1", size=85M