mirror of
https://github.com/systemd/systemd
synced 2026-04-24 16:04:51 +02:00
Compare commits
18 Commits
8dc3c2f197
...
3a3b022d2c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3a3b022d2c | ||
|
|
31cd2dd906 | ||
|
|
124d293268 | ||
|
|
70a3ce51f3 | ||
|
|
bc6bd62c0e | ||
|
|
5645b4976e | ||
|
|
3452ae90ea | ||
|
|
76b53bf54b | ||
|
|
adbe000e3d | ||
|
|
cae7c28272 | ||
|
|
2f88f2936c | ||
|
|
588453b8b4 | ||
|
|
2eeabd4489 | ||
|
|
a9e832092a | ||
|
|
e5f2d77b48 | ||
|
|
226281b36d | ||
|
|
83fe5d8a78 | ||
|
|
e992fd18a8 |
7
README
7
README
@ -353,6 +353,13 @@ WARNINGS and TAINT FLAGS:
|
||||
For more information on this issue consult
|
||||
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
|
||||
requires that /var/run is a symlink to /run. Taint flag 'var-run-bad'
|
||||
will be set when this condition is detected.
|
||||
|
||||
@ -13,6 +13,7 @@ System and Service Manager
|
||||
[](https://jenkins-systemd.apps.ocp.ci.centos.org/job/upstream-centos8/)<br/>
|
||||
[](https://jenkins-systemd.apps.ocp.ci.centos.org/job/upstream-vagrant-archlinux/)<br/>
|
||||
[&job=upstream-vagrant-archlinux-sanitizers)](https://jenkins-systemd.apps.ocp.ci.centos.org/job/upstream-vagrant-archlinux-sanitizers/)<br/>
|
||||
[&job=upstream-vagrant-rawhide-selinux)](https://jenkins-systemd.apps.ocp.ci.centos.org/view/Upstream/job/upstream-vagrant-rawhide-selinux/)<br/>
|
||||
[](https://fossies.org/linux/test/systemd-main.tar.gz/codespell.html)</br>
|
||||
[](https://coveralls.io/github/systemd/systemd?branch=main)</br>
|
||||
[](https://repology.org/project/systemd/versions)
|
||||
|
||||
7
TODO
7
TODO
@ -78,6 +78,13 @@ Janitorial Clean-ups:
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
@ -3,11 +3,6 @@
|
||||
# The lookup keys are composed in:
|
||||
# 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:
|
||||
# evdev:<modalias>
|
||||
# evdev:name:<device name>:dmi:<dmi string>
|
||||
|
||||
@ -3,11 +3,6 @@
|
||||
# The lookup keys are composed in:
|
||||
# 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:
|
||||
# id-input:modalias:<modalias>
|
||||
#
|
||||
|
||||
@ -13,11 +13,6 @@
|
||||
# The lookup keys are composed in:
|
||||
# 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:
|
||||
# - Generic input devices match:
|
||||
# evdev:input:bZZZZvYYYYpXXXXeWWWW-VVVV
|
||||
|
||||
@ -3,11 +3,6 @@
|
||||
# The lookup keys are composed in:
|
||||
# 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:
|
||||
# sensor:modalias:<parent modalias pattern>:dmi:<dmi pattern>
|
||||
#
|
||||
|
||||
@ -6,11 +6,6 @@
|
||||
# The lookup keys are composed in:
|
||||
# 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:
|
||||
# mouse:<subsystem>:v<vid>p<pid>:name:<name>:
|
||||
#
|
||||
|
||||
@ -7,10 +7,6 @@
|
||||
# The lookup keys are composed in:
|
||||
# 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:
|
||||
# - Generic input devices match:
|
||||
# evdev:input:bZZZZvYYYYpXXXXeWWWW-VVVV
|
||||
|
||||
@ -819,10 +819,12 @@ $ systemd-analyze verify /tmp/source:alias.service
|
||||
<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>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. This is the default. With
|
||||
<command>no</command>, return a non-zero process exit status when warnings arise during verification
|
||||
of only the specified unit. With <command>one</command>, return a non-zero process exit status when
|
||||
warnings arise during verification of either the specified unit or its immediate dependencies. </para></listitem>
|
||||
of either the specified unit or any of its associated dependencies. With <command>no</command>,
|
||||
return a non-zero process exit status when warnings arise during verification of only the specified
|
||||
unit. With <command>one</command>, return a non-zero process exit status when warnings arise during
|
||||
verification of either the specified unit or its immediate dependencies. If this option is not
|
||||
specified, zero is returned as the exit status regardless whether warnings arise during verification
|
||||
or not.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
|
||||
@ -90,7 +90,7 @@ PagerFlags arg_pager_flags = 0;
|
||||
BusTransport arg_transport = BUS_TRANSPORT_LOCAL;
|
||||
const char *arg_host = NULL;
|
||||
LookupScope arg_scope = LOOKUP_SCOPE_SYSTEM;
|
||||
RecursiveErrors arg_recursive_errors = RECURSIVE_ERRORS_YES;
|
||||
RecursiveErrors arg_recursive_errors = _RECURSIVE_ERRORS_INVALID;
|
||||
bool arg_man = true;
|
||||
bool arg_generators = false;
|
||||
char *arg_root = NULL;
|
||||
|
||||
@ -351,7 +351,7 @@ int strv_split_colon_pairs(char ***t, const char *s) {
|
||||
return (int) n;
|
||||
}
|
||||
|
||||
char* strv_join_full(char * const *l, const char *separator, const char *prefix, bool unescape_separators) {
|
||||
char* strv_join_full(char * const *l, const char *separator, const char *prefix, bool escape_separator) {
|
||||
char *r, *e;
|
||||
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);
|
||||
m = strlen_ptr(prefix);
|
||||
|
||||
if (unescape_separators) /* If there separator is multi-char, we won't know how to escape it. */
|
||||
if (escape_separator) /* If the separator was multi-char, we wouldn't know how to escape it. */
|
||||
assert(k == 1);
|
||||
|
||||
n = 0;
|
||||
@ -369,7 +369,7 @@ char* strv_join_full(char * const *l, const char *separator, const char *prefix,
|
||||
if (s != l)
|
||||
n += k;
|
||||
|
||||
bool needs_escaping = unescape_separators && strchr(*s, separator[0]);
|
||||
bool needs_escaping = escape_separator && strchr(*s, *separator);
|
||||
|
||||
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)
|
||||
e = stpcpy(e, prefix);
|
||||
|
||||
bool needs_escaping = unescape_separators && strchr(*s, separator[0]);
|
||||
bool needs_escaping = escape_separator && strchr(*s, *separator);
|
||||
|
||||
if (needs_escaping)
|
||||
for (size_t i = 0; (*s)[i]; i++) {
|
||||
if ((*s)[i] == separator[0])
|
||||
if ((*s)[i] == *separator)
|
||||
*(e++) = '\\';
|
||||
*(e++) = (*s)[i];
|
||||
}
|
||||
|
||||
@ -101,7 +101,7 @@ static inline char** strv_split_newlines(const char *s) {
|
||||
* string in the vector is an empty string. */
|
||||
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_separtor);
|
||||
char* strv_join_full(char * const *l, const char *separator, const char *prefix, bool escape_separator);
|
||||
static inline char *strv_join(char * const *l, const char *separator) {
|
||||
return strv_join_full(l, separator, NULL, false);
|
||||
}
|
||||
|
||||
@ -4370,71 +4370,58 @@ static int short_uid_range(const char *path) {
|
||||
return !uid_range_covers(p, n, 0, 65535);
|
||||
}
|
||||
|
||||
char *manager_taint_string(Manager *m) {
|
||||
_cleanup_free_ char *destination = NULL, *overflowuid = NULL, *overflowgid = NULL;
|
||||
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
|
||||
char* manager_taint_string(const Manager *m) {
|
||||
/* 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 known during compilation, emit a warning in the
|
||||
* configuration phase. */
|
||||
|
||||
assert(m);
|
||||
|
||||
buf = new(char, sizeof("split-usr:"
|
||||
"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;
|
||||
const char* stage[12] = {};
|
||||
size_t n = 0;
|
||||
|
||||
if (m->taint_usr)
|
||||
e = stpcpy(e, "split-usr:");
|
||||
stage[n++] = "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)
|
||||
e = stpcpy(e, "cgroups-missing:");
|
||||
stage[n++] = "cgroups-missing";
|
||||
|
||||
if (cg_all_unified() == 0)
|
||||
e = stpcpy(e, "cgroupsv1:");
|
||||
stage[n++] = "cgroupsv1";
|
||||
|
||||
if (clock_is_localtime(NULL) > 0)
|
||||
e = stpcpy(e, "local-hwclock:");
|
||||
stage[n++] = "local-hwclock";
|
||||
|
||||
r = readlink_malloc("/var/run", &destination);
|
||||
if (r < 0 || !PATH_IN_SET(destination, "../run", "/run"))
|
||||
e = stpcpy(e, "var-run-bad:");
|
||||
_cleanup_free_ char *destination = NULL;
|
||||
if (readlink_malloc("/var/run", &destination) < 0 ||
|
||||
!PATH_IN_SET(destination, "../run", "/run"))
|
||||
stage[n++] = "var-run-bad";
|
||||
|
||||
r = read_one_line_file("/proc/sys/kernel/overflowuid", &overflowuid);
|
||||
if (r >= 0 && !streq(overflowuid, "65534"))
|
||||
e = stpcpy(e, "overflowuid-not-65534:");
|
||||
r = read_one_line_file("/proc/sys/kernel/overflowgid", &overflowgid);
|
||||
if (r >= 0 && !streq(overflowgid, "65534"))
|
||||
e = stpcpy(e, "overflowgid-not-65534:");
|
||||
_cleanup_free_ char *overflowuid = NULL, *overflowgid = NULL;
|
||||
if (read_one_line_file("/proc/sys/kernel/overflowuid", &overflowuid) >= 0 &&
|
||||
!streq(overflowuid, "65534"))
|
||||
stage[n++] = "overflowuid-not-65534";
|
||||
if (read_one_line_file("/proc/sys/kernel/overflowgid", &overflowgid) >= 0 &&
|
||||
!streq(overflowgid, "65534"))
|
||||
stage[n++] = "overflowgid-not-65534";
|
||||
|
||||
struct utsname uts;
|
||||
assert_se(uname(&uts) >= 0);
|
||||
if (strverscmp_improved(uts.release, KERNEL_BASELINE_VERSION) < 0)
|
||||
e = stpcpy(e, "old-kernel:");
|
||||
stage[n++] = "old-kernel";
|
||||
|
||||
if (short_uid_range("/proc/self/uid_map") > 0)
|
||||
e = stpcpy(e, "short-uid-range:");
|
||||
stage[n++] = "short-uid-range";
|
||||
if (short_uid_range("/proc/self/gid_map") > 0)
|
||||
e = stpcpy(e, "short-gid-range:");
|
||||
stage[n++] = "short-gid-range";
|
||||
|
||||
/* remove the last ':' */
|
||||
if (e != buf)
|
||||
e[-1] = 0;
|
||||
assert(n < ELEMENTSOF(stage) - 1); /* One extra for NULL terminator */
|
||||
|
||||
return buf;
|
||||
return strv_join((char**) stage, ":");
|
||||
}
|
||||
|
||||
void manager_ref_console(Manager *m) {
|
||||
|
||||
@ -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);
|
||||
int manager_ref_gid(Manager *m, gid_t gid, bool clean_ipc);
|
||||
|
||||
char *manager_taint_string(Manager *m);
|
||||
char* manager_taint_string(const Manager *m);
|
||||
|
||||
void manager_ref_console(Manager *m);
|
||||
void manager_unref_console(Manager *m);
|
||||
|
||||
@ -201,7 +201,7 @@ $D/zzz7 : start= 6291416, size= 98304, type=0FC63DAF-8483-4772-8E79-3D
|
||||
EOF
|
||||
|
||||
LOOP="$(losetup -P --show --find "$D/zzz")"
|
||||
"${udevadm:?}" wait --timeout 60 --initialized=yes --settle "${LOOP:?}"
|
||||
"${udevadm:?}" wait --timeout 60 --settle "${LOOP:?}"
|
||||
|
||||
VOLUME="test-repart-$RANDOM"
|
||||
|
||||
|
||||
@ -9,9 +9,9 @@
|
||||
#include "device-util.h"
|
||||
#include "devnode-acl.h"
|
||||
#include "dirent-util.h"
|
||||
#include "escape.h"
|
||||
#include "fd-util.h"
|
||||
#include "format-util.h"
|
||||
#include "fs-util.h"
|
||||
#include "set.h"
|
||||
#include "string-util.h"
|
||||
#include "util.h"
|
||||
@ -195,21 +195,18 @@ int devnode_acl_all(const char *seat,
|
||||
dir = opendir("/run/udev/static_node-tags/uaccess");
|
||||
if (dir) {
|
||||
FOREACH_DIRENT(de, dir, return -errno) {
|
||||
_cleanup_free_ char *unescaped_devname = NULL;
|
||||
ssize_t l;
|
||||
|
||||
l = cunescape(de->d_name, UNESCAPE_RELAX, &unescaped_devname);
|
||||
if (l < 0)
|
||||
return l;
|
||||
|
||||
n = path_join("/dev", unescaped_devname);
|
||||
if (!n)
|
||||
return -ENOMEM;
|
||||
r = readlinkat_malloc(dirfd(dir), de->d_name, &n);
|
||||
if (r == -ENOENT)
|
||||
continue;
|
||||
if (r < 0) {
|
||||
log_debug_errno(r,
|
||||
"Unable to read symlink '/run/udev/static_node-tags/uaccess/%s', ignoring: %m",
|
||||
de->d_name);
|
||||
continue;
|
||||
}
|
||||
|
||||
log_debug("Found static node %s for seat %s", n, seat);
|
||||
r = set_consume(nodes, n);
|
||||
if (r == -EEXIST)
|
||||
continue;
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -352,9 +352,14 @@ static int md_list_get(MountPoint **head) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
/* Filter out partitions. */
|
||||
r = sd_device_enumerator_add_match_property(e, "DEVTYPE", "disk");
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
FOREACH_DEVICE(e, d) {
|
||||
_cleanup_free_ char *p = NULL;
|
||||
const char *dn;
|
||||
const char *dn, *md_level;
|
||||
MountPoint *m;
|
||||
dev_t devnum;
|
||||
|
||||
@ -362,6 +367,17 @@ static int md_list_get(MountPoint **head) {
|
||||
sd_device_get_devname(d, &dn) < 0)
|
||||
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);
|
||||
if (!p)
|
||||
return -ENOMEM;
|
||||
|
||||
@ -56,6 +56,12 @@ tests += [
|
||||
libblkid],
|
||||
core_includes],
|
||||
|
||||
[files('test-manager.c'),
|
||||
[libcore,
|
||||
libshared],
|
||||
[],
|
||||
core_includes],
|
||||
|
||||
[files('test-emergency-action.c'),
|
||||
[libcore,
|
||||
libshared],
|
||||
|
||||
29
src/test/test-manager.c
Normal file
29
src/test/test-manager.c
Normal file
@ -0,0 +1,29 @@
|
||||
/* 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);
|
||||
@ -442,6 +442,12 @@ static int device_get_whole_disk(sd_device *dev, sd_device **ret_device, const c
|
||||
if (r < 0)
|
||||
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"))
|
||||
goto irrelevant;
|
||||
|
||||
|
||||
@ -173,20 +173,22 @@ rm -r /tmp/testsuite-58.3-defs/
|
||||
# testcase for #21817
|
||||
mkdir -p /tmp/testsuite-58-issue-21817-defs/
|
||||
truncate -s 100m /var/tmp/testsuite-58-issue-21817.img
|
||||
LOOP=$(losetup -P --show -f /var/tmp/testsuite-58-issue-21817.img)
|
||||
udevadm wait --timeout 60 --initialized=yes --settle "${LOOP:?}"
|
||||
printf 'size=50M,type=%s\n,\n' "${root_guid}" | sfdisk -X gpt "$LOOP"
|
||||
sfdisk /var/tmp/testsuite-58-issue-21817.img <<EOF
|
||||
label: gpt
|
||||
|
||||
size=50M, type=${root_guid}
|
||||
,
|
||||
EOF
|
||||
cat >/tmp/testsuite-58-issue-21817-defs/test.conf <<EOF
|
||||
[Partition]
|
||||
Type=root
|
||||
EOF
|
||||
systemd-repart --pretty=yes --definitions /tmp/testsuite-58-issue-21817-defs/ "$LOOP"
|
||||
sfdisk --dump "$LOOP" | tee /tmp/testsuite-58-issue-21817.dump
|
||||
losetup -d "$LOOP"
|
||||
systemd-repart --pretty=yes --definitions /tmp/testsuite-58-issue-21817-defs/ --dry-run=no /var/tmp/testsuite-58-issue-21817.img
|
||||
sfdisk --dump /var/tmp/testsuite-58-issue-21817.img | tee /tmp/testsuite-58-issue-21817.dump
|
||||
|
||||
grep -qiF "p1 : start= 2048, size= 102400, type=${root_guid}," /tmp/testsuite-58-issue-21817.dump
|
||||
grep -qiF "/var/tmp/testsuite-58-issue-21817.img1 : 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
|
||||
grep -qE "p2 : start= 104448, size= (100319| 98304)," /tmp/testsuite-58-issue-21817.dump
|
||||
grep -qE "/var/tmp/testsuite-58-issue-21817.img2 : 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 -r /tmp/testsuite-58-issue-21817-defs/
|
||||
@ -216,7 +218,7 @@ EOF
|
||||
|
||||
truncate -s 100m "/tmp/testsuite-58-sector-$1.img"
|
||||
LOOP=$(losetup -b "$1" -P --show -f "/tmp/testsuite-58-sector-$1.img" )
|
||||
udevadm wait --timeout 60 --initialized=yes --settle "${LOOP:?}"
|
||||
udevadm wait --timeout 60 --settle "${LOOP:?}"
|
||||
systemd-repart --pretty=yes --definitions=/tmp/testsuite-58-sector/ --seed=750b6cd5c4ae4012a15e7be3c29e6a47 --empty=require --dry-run=no "$LOOP"
|
||||
rm -rf /tmp/testsuite-58-sector
|
||||
sfdisk --verify "$LOOP"
|
||||
|
||||
@ -168,7 +168,7 @@ $(printf 'name="test%d", size=2M\n' {1..50})
|
||||
EOF
|
||||
|
||||
# Initial partition table
|
||||
sfdisk -q -X gpt "$blockdev" <"$partscript"
|
||||
udevadm lock --device="$blockdev" sfdisk -q -X gpt "$blockdev" <"$partscript"
|
||||
|
||||
# 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
|
||||
@ -177,8 +177,8 @@ EOF
|
||||
# On unpatched udev versions the delete-recreate cycle may trigger a race
|
||||
# leading to dead symlinks in /dev/disk/
|
||||
for i in {1..100}; do
|
||||
sfdisk -q --delete "$blockdev"
|
||||
sfdisk -q -X gpt "$blockdev" <"$partscript"
|
||||
udevadm lock --device="$blockdev" sfdisk -q --delete "$blockdev"
|
||||
udevadm lock --device="$blockdev" sfdisk -q -X gpt "$blockdev" <"$partscript"
|
||||
|
||||
if ((i % 10 == 0)); then
|
||||
udevadm wait --settle --timeout=30 "$blockdev"
|
||||
@ -281,7 +281,7 @@ testcase_btrfs_basic() {
|
||||
echo "Multiple devices: using partitions, data: single, metadata: raid1"
|
||||
uuid="deadbeef-dead-dead-beef-000000000001"
|
||||
label="btrfs_mpart"
|
||||
sfdisk --wipe=always "${devices[0]}" <<EOF
|
||||
udevadm lock --device="${devices[0]}" sfdisk --wipe=always "${devices[0]}" <<EOF
|
||||
label: gpt
|
||||
|
||||
name="diskpart1", size=85M
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user