Compare commits

...

26 Commits

Author SHA1 Message Date
Muhammad Nuzaihan Bin Kamal Luddin a7a50eb5fb
Merge 5507ec986f into ff831e7c50 2024-09-18 14:11:22 +01:00
Marius Hoch ff831e7c50 hwdb: Add accel orientation quirk for the IdeaPad Duet 3 10IGL5-LTE
Signed-off-by: Marius Hoch <mail@mariushoch.de>
2024-09-18 20:30:11 +09:00
Daan De Meyer 81af8f998e repart: Support specifying multiple directories to ExcludeFiles= 2024-09-18 10:22:33 +02:00
chenjiayi 4fc8a63f9e systemd: rewatch pids under cgroup v1 when sigchld of processes more than main pid and control pid is captured
If `Delegate` is configured in service, cgroup agent will never send out
any datagram as .control subcgroup is generated. Thus systemd will watch
all processes on the cgroup hierarchy for SIGCHLD to deal with unreliable
cgroup notifications.

In this way, systemd should rewatch all processes when any SIGCHLD is
captured, more than the control pid or main pid.
2024-09-18 10:13:20 +02:00
Jason Yundt dfb3155419 man: document ShowStatus and SetShowStatus()
SetShowStatus() was added in order to fix #11447. Recently, I ran into
the exact same problem that OP was experiencing in #11447. I wasn’t able
to figure out how to deal with the problem until I found #11447, and it
took me a while to find #11447.

This commit takes what I learned from reading #11447 and adds it to the
documentation. Hopefully, this will make it easier for other people who
run into the same problem in the future.
2024-09-18 10:11:55 +02:00
Daan De Meyer fc5037e7d7
Merge pull request #34464 from yuwata/test-space-in-path
test: allow to run tests under directory that contains spaces
2024-09-18 08:50:38 +02:00
Yu Watanabe 13f6ec7ce7 test: quote paths to executables
Fixes #34459.
2024-09-18 09:47:04 +09:00
Yu Watanabe 6e1816ef16 kernel-install: unquote plugin paths in KERNEL_INSTALL_PLUGINS
To support the case that paths to plugins contain spaces.

Prompted by #34459
2024-09-18 09:47:00 +09:00
Yu Watanabe 7ac1ad90d0
Merge pull request #34460 from yuwata/test-86-follow-ups
test: follow-ups for TEST-86
2024-09-18 09:31:17 +09:00
Yu Watanabe d265b8afb7 test: drop unused test.sh for TEST-86-MULTI-PROFILE-UKI
The test cannot run with the bash test runner, as it requires python.
Hence, test.sh is not necessary.

Follow-up for a37640653c.
2024-09-18 04:00:05 +09:00
Yu Watanabe 1aab0a5b10 test: minor coding style fixlets
Follow-up for a37640653c.
2024-09-18 03:50:46 +09:00
Muhammad Nuzaihan Bin Kamal Luddin 5507ec986f log invalid dns type with error message 2024-09-18 01:55:35 +08:00
Muhammad Nuzaihan Bin Kamal Luddin fee8a01942 remove unneeded string variable and directly use the data 2024-09-17 18:15:35 +08:00
Muhammad Nuzaihan Bin Kamal Luddin 2e9b9408d2 change log_info to log_debug 2024-09-17 16:25:02 +08:00
Muhammad Nuzaihan Bin Kamal Luddin f8599ea6fb fix: finish up work as recommended 2024-09-17 16:23:48 +08:00
Muhammad Nuzaihan Bin Kamal Luddin 18b5e47238 remove strv.h from include in resolved-dns-stub.c so it is cleaner 2024-09-17 02:28:55 +08:00
Muhammad Nuzaihan Bin Kamal Luddin a7847d744e generate missing header files 2024-09-17 02:28:55 +08:00
Muhammad Nuzaihan Bin Kamal Luddin 04031c10f8 fix meson and make ci/cd happy 2024-09-17 02:28:55 +08:00
Muhammad Nuzaihan Bin Kamal Luddin 84831eff33 Revert "make ci/cd pipelines happy"
This reverts commit 69a6d3b193.
2024-09-17 02:28:55 +08:00
Muhammad Nuzaihan Bin Kamal Luddin a7a4b22282 make ci/cd pipelines happy 2024-09-17 02:28:55 +08:00
Muhammad Nuzaihan Bin Kamal Luddin 7f8faa1b9a remove dns-type-c 2024-09-17 02:28:55 +08:00
Muhammad Nuzaihan Bin Kamal Luddin bfed004837 do not cleanup and free Set * 2024-09-17 02:28:55 +08:00
Muhammad Nuzaihan Bin Kamal Luddin 1e79a8f8d6 Rework RecordRefuseType
* Add new configuration parser which translates configuration values to int
* Store ints in Set*
* Check value if exists in set in DNS stub when user queries
2024-09-17 02:28:55 +08:00
Muhammad Nuzaihan Bin Kamal Luddin 18e8f0f1ce remove stub 2024-09-17 02:28:55 +08:00
Muhammad Nuzaihan Bin Kamal Luddin 4d041317df rework to use RefuseRecordTypes= 2024-09-17 02:28:54 +08:00
Muhammad Nuzaihan Bin Kamal Luddin 9ea2a332c5 add an option to explicitly disable query IPv6 AAAA 2024-09-17 02:28:54 +08:00
24 changed files with 219 additions and 92 deletions

View File

@ -760,8 +760,9 @@ sensor:modalias:i2c:bmc150_accel:dmi:*:svnLENOVO:*:pvrLenovoYoga300-11IBR:*
sensor:modalias:acpi:ACCL0001*:dmi:*:svnLENOVO:pn60072:pvr851*:* sensor:modalias:acpi:ACCL0001*:dmi:*:svnLENOVO:pn60072:pvr851*:*
ACCEL_MOUNT_MATRIX=0, 1, 0; -1, 0, 0; 0, 0, 1 ACCEL_MOUNT_MATRIX=0, 1, 0; -1, 0, 0; 0, 0, 1
# IdeaPad Duet 3 10IGL5 (82AT) # IdeaPad Duet 3 10IGL5 (82AT) and 10IGL5-LTE (82HK)
sensor:modalias:acpi:SMO8B30*:dmi:*:svnLENOVO*:pn82AT:* sensor:modalias:acpi:SMO8B30*:dmi:*:svnLENOVO*:pn82AT:*
sensor:modalias:acpi:SMO8B30*:dmi:*:svnLENOVO*:pn82HK:*
ACCEL_MOUNT_MATRIX=0, 1, 0; -1, 0, 0; 0, 0, 1 ACCEL_MOUNT_MATRIX=0, 1, 0; -1, 0, 0; 0, 0, 1
######################################### #########################################

View File

@ -593,8 +593,6 @@ node /org/freedesktop/systemd1 {
<!--method GetJobBefore is not documented!--> <!--method GetJobBefore is not documented!-->
<!--method SetShowStatus is not documented!-->
<!--method ListUnitsFiltered is not documented!--> <!--method ListUnitsFiltered is not documented!-->
<!--method ListUnitsByPatterns is not documented!--> <!--method ListUnitsByPatterns is not documented!-->
@ -673,8 +671,6 @@ node /org/freedesktop/systemd1 {
<!--property ConfirmSpawn is not documented!--> <!--property ConfirmSpawn is not documented!-->
<!--property ShowStatus is not documented!-->
<!--property DefaultStandardOutput is not documented!--> <!--property DefaultStandardOutput is not documented!-->
<!--property DefaultStandardError is not documented!--> <!--property DefaultStandardError is not documented!-->
@ -1362,6 +1358,24 @@ node /org/freedesktop/systemd1 {
<para><function>ResetFailedUnit()</function> resets the "failed" state of a specific unit.</para> <para><function>ResetFailedUnit()</function> resets the "failed" state of a specific unit.</para>
<para><function>SetShowStatus()</function> configures the display of status messages during bootup and
shutdown. The <varname>mode</varname> parameter can be set to any value that's valid for the
<varname>systemd.show_status</varname> kernel parameter. For more information about
<varname>systemd.show_status</varname>, see
<citerefentry project="man-pages"><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
The <varname>mode</varname> parameter can also be set to an empty string. When <varname>mode</varname>
is set to an empty string, <function>SetShowStatus()</function> will reset
<varname>ShowStatus</varname> back to its original value. You can use
<function>SetShowStatus()</function> create a service that does something like this:
<orderedlist>
<listitem><para>Send a D-Bus message that will turn off status messages.</para></listitem>
<listitem><para>Block until a reply to that message is received.</para></listitem>
<listitem><para>Print multiples lines without being interrupted by status messages.</para></listitem>
<listitem><para>Send a D-Bus message that will reset <varname>ShowStatus</varname> back to its
original value.</para></listitem>
</orderedlist>
</para>
<para><function>ResetFailed()</function> resets the "failed" state of all units.</para> <para><function>ResetFailed()</function> resets the "failed" state of all units.</para>
<para><function>ListUnits()</function> returns an array of all currently loaded units. Note that <para><function>ListUnits()</function> returns an array of all currently loaded units. Note that
@ -1788,6 +1802,12 @@ node /org/freedesktop/systemd1 {
<para><varname>Environment</varname> encodes the environment block passed to all executed services. It <para><varname>Environment</varname> encodes the environment block passed to all executed services. It
may be altered with bus calls such as <function>SetEnvironment()</function> (see above).</para> may be altered with bus calls such as <function>SetEnvironment()</function> (see above).</para>
<para><varname>ShowStatus</varname> encodes systemd's current policy for displaying status messages
during bootup and shutdown. Its value can be any valid value for the
<varname>systemd.show_status</varname> kernel parameter (see
<citerefentry project="man-pages"><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>).
It may be altered using <function>SetShowStatus()</function> (see above).</para>
<para><varname>UnitPath</varname> encodes the currently active unit file search path. It is an array of <para><varname>UnitPath</varname> encodes the currently active unit file search path. It is an array of
file system paths encoded as strings.</para> file system paths encoded as strings.</para>

View File

@ -483,18 +483,18 @@
<term><varname>ExcludeFiles=</varname></term> <term><varname>ExcludeFiles=</varname></term>
<term><varname>ExcludeFilesTarget=</varname></term> <term><varname>ExcludeFilesTarget=</varname></term>
<listitem><para>Takes an absolute file system path referring to a source file or directory on the <listitem><para>Takes one or more absolute paths, separated by whitespace, each referring to a
host. This setting may be used to exclude files or directories from the host from being copied into source file or directory on the host. This setting may be used to exclude files or directories from
the file system when <varname>CopyFiles=</varname> is used. This option may be used multiple times to the host from being copied into the file system when <varname>CopyFiles=</varname> is used. This
exclude multiple files or directories from host from being copied into the newly formatted file option may be used multiple times to exclude multiple files or directories from host from being
system.</para> copied into the newly formatted file system.</para>
<para>If the path is a directory and ends with <literal>/</literal>, only the directory's <para>If the path is a directory and ends with <literal>/</literal>, only the directory's
contents are excluded but not the directory itself. If the path is a directory and does not end with contents are excluded but not the directory itself. If the path is a directory and does not end with
<literal>/</literal>, both the directory and its contents are excluded.</para> <literal>/</literal>, both the directory and its contents are excluded.</para>
<para><varname>ExcludeFilesTarget=</varname> is like <varname>ExcludeFiles=</varname> except that <para><varname>ExcludeFilesTarget=</varname> is like <varname>ExcludeFiles=</varname> except that
instead of excluding the path on the host from being copied into the partition, we exclude any files instead of excluding the path on the host from being copied into the partition, it exclude any files
and directories from being copied into the given path in the partition.</para> and directories from being copied into the given path in the partition.</para>
<para>When <para>When

View File

@ -3001,7 +3001,12 @@ SystemCallErrorNumber=EPERM</programlisting>
<para><option>tty</option> connects standard output to a tty (as configured via <varname>TTYPath=</varname>, <para><option>tty</option> connects standard output to a tty (as configured via <varname>TTYPath=</varname>,
see below). If the TTY is used for output only, the executed process will not become the controlling process of see below). If the TTY is used for output only, the executed process will not become the controlling process of
the terminal, and will not fail or wait for other processes to release the terminal.</para> the terminal, and will not fail or wait for other processes to release the terminal. Note: if a unit
tries to print multiple lines to a TTY during bootup or shutdown, then there's a chance that those
lines will be broken up by status messages. <function>SetShowStatus()</function> can be used to
prevent this problem. See
<citerefentry project="man-pages"><refentrytitle>org.freedesktop.systemd1</refentrytitle><manvolnum>5</manvolnum></citerefentry>
for details.</para>
<para><option>journal</option> connects standard output with the journal, which is accessible via <para><option>journal</option> connects standard output with the journal, which is accessible via
<citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>. Note <citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>. Note

View File

@ -568,7 +568,11 @@
<listitem><para>Enables display of status messages on the <listitem><para>Enables display of status messages on the
console, as controlled via console, as controlled via
<varname>systemd.show_status=1</varname> on the kernel command <varname>systemd.show_status=1</varname> on the kernel command
line.</para></listitem> line.</para>
<para>You may want to use <function>SetShowStatus()</function> instead of
<constant>SIGRTMIN+20</constant> in order to prevent race conditions. See
<citerefentry project="man-pages"><refentrytitle>org.freedesktop.systemd1</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
</para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
@ -579,7 +583,11 @@
controlled via controlled via
<varname>systemd.show_status=0</varname> <varname>systemd.show_status=0</varname>
on the kernel command on the kernel command
line.</para></listitem> line.</para>
<para>You may want to use <function>SetShowStatus()</function> instead of
<constant>SIGRTMIN+21</constant> in order to prevent race conditions. See
<citerefentry project="man-pages"><refentrytitle>org.freedesktop.systemd1</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
</para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>

View File

@ -702,6 +702,7 @@ env = find_program('env')
rsync = find_program('rsync', required : false) rsync = find_program('rsync', required : false)
diff = find_program('diff') diff = find_program('diff')
find = find_program('find') find = find_program('find')
cp = find_program('cp')
ln_s = ln.full_path() + ' -frsT -- "${DESTDIR:-}@0@" "${DESTDIR:-}@1@"' ln_s = ln.full_path() + ' -frsT -- "${DESTDIR:-}@0@" "${DESTDIR:-}@1@"'

View File

@ -4169,7 +4169,7 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) {
* detect when the cgroup becomes empty. Note that the control process is always * detect when the cgroup becomes empty. Note that the control process is always
* our child so it's pointless to watch all other processes. */ * our child so it's pointless to watch all other processes. */
if (!control_pid_good(s)) if (!control_pid_good(s))
if (!s->main_pid_known || s->main_pid_alien) if (!s->main_pid_known || s->main_pid_alien || unit_cgroup_delegate(u))
(void) unit_enqueue_rewatch_pids(u); (void) unit_enqueue_rewatch_pids(u);
} }

View File

@ -404,15 +404,16 @@ static int context_set_path_strv(Context *c, char* const* strv, const char *sour
static int context_set_plugins(Context *c, const char *s, const char *source) { static int context_set_plugins(Context *c, const char *s, const char *source) {
_cleanup_strv_free_ char **v = NULL; _cleanup_strv_free_ char **v = NULL;
int r;
assert(c); assert(c);
if (c->plugins || !s) if (c->plugins || !s)
return 0; return 0;
v = strv_split(s, NULL); r = strv_split_full(&v, s, NULL, EXTRACT_UNQUOTE);
if (!v) if (r < 0)
return log_oom(); return log_error_errno(r, "Failed to parse plugin paths from %s: %m", source);
return context_set_path_strv(c, v, source, "plugins", &c->plugins); return context_set_path_strv(c, v, source, "plugins", &c->plugins);
} }

View File

@ -46,7 +46,13 @@ echo 'DTBDTBDTBDTB' >"$D/sources/subdir/whatever.dtb"
export KERNEL_INSTALL_CONF_ROOT="$D/sources" export KERNEL_INSTALL_CONF_ROOT="$D/sources"
# We "install" multiple plugins, but control which ones will be active via install.conf. # We "install" multiple plugins, but control which ones will be active via install.conf.
export KERNEL_INSTALL_PLUGINS="${ukify_install} ${loaderentry_install} ${uki_copy_install}" KERNEL_INSTALL_PLUGINS="'${loaderentry_install}' '${uki_copy_install}'"
if [[ -n "$ukify_install" ]]; then
# shellcheck disable=SC2089
KERNEL_INSTALL_PLUGINS="'${ukify_install}' $KERNEL_INSTALL_PLUGINS"
fi
# shellcheck disable=SC2090
export KERNEL_INSTALL_PLUGINS
export BOOT_ROOT="$D/boot" export BOOT_ROOT="$D/boot"
export BOOT_MNT="$D/boot" export BOOT_MNT="$D/boot"
export MACHINE_ID='3e0484f3634a418b8e6a39e8828b03e3' export MACHINE_ID='3e0484f3634a418b8e6a39e8828b03e3'

View File

@ -1742,8 +1742,9 @@ static int config_parse_exclude_files(
const char *rvalue, const char *rvalue,
void *data, void *data,
void *userdata) { void *userdata) {
_cleanup_free_ char *resolved = NULL;
char ***exclude_files = ASSERT_PTR(data); char ***exclude_files = ASSERT_PTR(data);
const char *p = ASSERT_PTR(rvalue);
int r; int r;
if (isempty(rvalue)) { if (isempty(rvalue)) {
@ -1751,10 +1752,23 @@ static int config_parse_exclude_files(
return 0; return 0;
} }
r = specifier_printf(rvalue, PATH_MAX-1, system_and_tmp_specifier_table, arg_root, NULL, &resolved); for (;;) {
_cleanup_free_ char *word = NULL, *resolved = NULL;
r = extract_first_word(&p, &word, NULL, EXTRACT_UNQUOTE);
if (r == -ENOMEM)
return log_oom();
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r, "Invalid syntax, ignoring: %s", p);
return 0;
}
if (r == 0)
return 0;
r = specifier_printf(word, PATH_MAX-1, system_and_tmp_specifier_table, arg_root, NULL, &resolved);
if (r < 0) { if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r, log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to expand specifiers in ExcludeFiles= path, ignoring: %s", rvalue); "Failed to expand specifiers in %s path, ignoring: %s", lvalue, word);
return 0; return 0;
} }
@ -1764,6 +1778,7 @@ static int config_parse_exclude_files(
if (strv_consume(exclude_files, TAKE_PTR(resolved)) < 0) if (strv_consume(exclude_files, TAKE_PTR(resolved)) < 0)
return log_oom(); return log_oom();
}
return 0; return 0;
} }

View File

@ -414,3 +414,61 @@ int manager_parse_config_file(Manager *m) {
return 0; return 0;
} }
int config_parse_refuse_record_types(
const char *unit,
const char *filename,
unsigned line,
const char *section,
unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
void *data,
void *userdata) {
Manager *m = ASSERT_PTR(userdata);
int r;
assert(filename);
assert(lvalue);
assert(rvalue);
if (isempty(rvalue)) {
data = mfree(data);
return 1;
}
r = free_and_strdup_warn(data, empty_to_null(rvalue));
if (r < 0)
return r;
char* record_type_string;
int refused_record_type;
/* Get int values of DNS type for example "AAAA" string to get int value and store in Set */
Set *refused_records = NULL;
for (;;) {
r = extract_first_word(data, &record_type_string, ",", 0);
if (r < 0)
return r;
if (r == 0)
break;
refused_record_type = dns_type_from_string(record_type_string);
/* log error of invalid dns type */
if (refused_record_type == _DNS_TYPE_INVALID)
log_error("dns type is invalid");
r = set_ensure_put(&refused_records, NULL, INT_TO_PTR(refused_record_type));
if (r == -ENOMEM)
return log_oom();
}
m->refuse_record_types = refused_records;
return 1;
}

View File

@ -480,6 +480,14 @@ int dns_query_new(
assert(m); assert(m);
/* Check for records that is refused and refuse query for the records if matched in configuration */
DNS_QUESTION_FOREACH(key, question_utf8) {
if (set_contains(m->refuse_record_types, INT_TO_PTR(key->type))) {
log_debug("Got request for %s record that is refused.", dns_type_to_string(key->type));
return -ENOSYS;
}
}
if (question_bypass) { if (question_bypass) {
/* It's either a "bypass" query, or a regular one, but can't be both. */ /* It's either a "bypass" query, or a regular one, but can't be both. */
if (question_utf8 || question_idna) if (question_utf8 || question_idna)

View File

@ -992,6 +992,13 @@ static void dns_stub_process_query(Manager *m, DnsStubListenerExtra *l, DnsStrea
SD_RESOLVED_NO_SEARCH| SD_RESOLVED_NO_SEARCH|
(DNS_PACKET_DO(p) ? SD_RESOLVED_REQUIRE_PRIMARY : 0)| (DNS_PACKET_DO(p) ? SD_RESOLVED_REQUIRE_PRIMARY : 0)|
SD_RESOLVED_CLAMP_TTL); SD_RESOLVED_CLAMP_TTL);
/* Refuse query if there is -ENOSYS */
if (r == -ENOSYS) {
dns_stub_send_failure(m, l, s, p, DNS_RCODE_REFUSED, false);
return;
}
if (r < 0) { if (r < 0) {
log_error_errno(r, "Failed to generate query object: %m"); log_error_errno(r, "Failed to generate query object: %m");
dns_stub_send_failure(m, l, s, p, DNS_RCODE_SERVFAIL, false); dns_stub_send_failure(m, l, s, p, DNS_RCODE_SERVFAIL, false);

View File

@ -33,3 +33,4 @@ Resolve.ResolveUnicastSingleLabel, config_parse_bool, 0,
Resolve.DNSStubListenerExtra, config_parse_dns_stub_listener_extra, 0, offsetof(Manager, dns_extra_stub_listeners) Resolve.DNSStubListenerExtra, config_parse_dns_stub_listener_extra, 0, offsetof(Manager, dns_extra_stub_listeners)
Resolve.CacheFromLocalhost, config_parse_bool, 0, offsetof(Manager, cache_from_localhost) Resolve.CacheFromLocalhost, config_parse_bool, 0, offsetof(Manager, cache_from_localhost)
Resolve.StaleRetentionSec, config_parse_sec, 0, offsetof(Manager, stale_retention_usec) Resolve.StaleRetentionSec, config_parse_sec, 0, offsetof(Manager, stale_retention_usec)
Resolve.RefuseRecordTypes, config_parse_refuse_record_types, 0, offsetof(Manager, refuse_record_types)

View File

@ -137,6 +137,9 @@ struct Manager {
struct stat etc_hosts_stat; struct stat etc_hosts_stat;
bool read_etc_hosts; bool read_etc_hosts;
/* List of refused DNS Record Types*/
Set *refuse_record_types;
OrderedSet *dns_extra_stub_listeners; OrderedSet *dns_extra_stub_listeners;
/* Local DNS stub on 127.0.0.53:53 */ /* Local DNS stub on 127.0.0.53:53 */

View File

@ -35,3 +35,4 @@
#ReadEtcHosts=yes #ReadEtcHosts=yes
#ResolveUnicastSingleLabel=no #ResolveUnicastSingleLabel=no
#StaleRetentionSec=0 #StaleRetentionSec=0
#RefuseRecordTypes=

View File

@ -278,6 +278,7 @@ CONFIG_PARSER_PROTOTYPE(config_parse_uint32_invert_flag);
CONFIG_PARSER_PROTOTYPE(config_parse_id128); CONFIG_PARSER_PROTOTYPE(config_parse_id128);
CONFIG_PARSER_PROTOTYPE(config_parse_tristate); CONFIG_PARSER_PROTOTYPE(config_parse_tristate);
CONFIG_PARSER_PROTOTYPE(config_parse_string); CONFIG_PARSER_PROTOTYPE(config_parse_string);
CONFIG_PARSER_PROTOTYPE(config_parse_refuse_record_types);
CONFIG_PARSER_PROTOTYPE(config_parse_dns_name); CONFIG_PARSER_PROTOTYPE(config_parse_dns_name);
CONFIG_PARSER_PROTOTYPE(config_parse_hostname); CONFIG_PARSER_PROTOTYPE(config_parse_hostname);
CONFIG_PARSER_PROTOTYPE(config_parse_path); CONFIG_PARSER_PROTOTYPE(config_parse_path);

View File

@ -197,7 +197,7 @@ _unused_ static void test_compress_stream(const char *compression,
ASSERT_OK(compress(src, dst, -1, &uncompressed_size)); ASSERT_OK(compress(src, dst, -1, &uncompressed_size));
if (cat) { if (cat) {
assert_se(asprintf(&cmd, "%s %s | diff %s -", cat, pattern, srcfile) > 0); assert_se(asprintf(&cmd, "%s %s | diff '%s' -", cat, pattern, srcfile) > 0);
assert_se(system(cmd) == 0); assert_se(system(cmd) == 0);
} }
@ -212,7 +212,7 @@ _unused_ static void test_compress_stream(const char *compression,
r = decompress(dst, dst2, st.st_size); r = decompress(dst, dst2, st.st_size);
assert_se(r == 0); assert_se(r == 0);
assert_se(asprintf(&cmd2, "diff %s %s", srcfile, pattern2) > 0); assert_se(asprintf(&cmd2, "diff '%s' %s", srcfile, pattern2) > 0);
assert_se(system(cmd2) == 0); assert_se(system(cmd2) == 0);
log_debug("/* test faulty decompression */"); log_debug("/* test faulty decompression */");

View File

@ -52,7 +52,8 @@ static void test_event_spawn_self(const char *self, const char *arg, bool with_p
log_debug("/* %s(%s, %s) */", __func__, arg, yes_no(with_pidfd)); log_debug("/* %s(%s, %s) */", __func__, arg, yes_no(with_pidfd));
assert_se(cmd = strjoin(self, " ", arg)); /* 'self' may contain spaces, hence needs to be quoted. */
assert_se(cmd = strjoin("'", self, "' ", arg));
test_event_spawn_core(with_pidfd, cmd, result_buf, BUF_SIZE); test_event_spawn_core(with_pidfd, cmd, result_buf, BUF_SIZE);

View File

@ -1,10 +0,0 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: LGPL-2.1-or-later
set -e
TEST_DESCRIPTION="Test Multi-Profile UKI Boots"
# shellcheck source=test/test-functions
. "${TEST_BASE_DIR:?}/test-functions"
do_test "$@"

View File

@ -4,32 +4,32 @@ set -e
ANALYZE="${1:-systemd-analyze}" ANALYZE="${1:-systemd-analyze}"
$ANALYZE compare-versions 1 lt 2 "$ANALYZE" compare-versions 1 lt 2
$ANALYZE compare-versions 1 '<' 2 "$ANALYZE" compare-versions 1 '<' 2
$ANALYZE compare-versions 1 le 2 "$ANALYZE" compare-versions 1 le 2
$ANALYZE compare-versions 1 '<=' 2 "$ANALYZE" compare-versions 1 '<=' 2
$ANALYZE compare-versions 1 ne 2 "$ANALYZE" compare-versions 1 ne 2
$ANALYZE compare-versions 1 '!=' 2 "$ANALYZE" compare-versions 1 '!=' 2
( ! $ANALYZE compare-versions 1 ge 2 ) ( ! "$ANALYZE" compare-versions 1 ge 2 )
( ! $ANALYZE compare-versions 1 '>=' 2 ) ( ! "$ANALYZE" compare-versions 1 '>=' 2 )
( ! $ANALYZE compare-versions 1 eq 2 ) ( ! "$ANALYZE" compare-versions 1 eq 2 )
( ! $ANALYZE compare-versions 1 '==' 2 ) ( ! "$ANALYZE" compare-versions 1 '==' 2 )
( ! $ANALYZE compare-versions 1 gt 2 ) ( ! "$ANALYZE" compare-versions 1 gt 2 )
( ! $ANALYZE compare-versions 1 '>' 2 ) ( ! "$ANALYZE" compare-versions 1 '>' 2 )
test "$($ANALYZE compare-versions 1 2)" = '1 < 2' test "$("$ANALYZE" compare-versions 1 2)" = '1 < 2'
test "$($ANALYZE compare-versions 2 2)" = '2 == 2' test "$("$ANALYZE" compare-versions 2 2)" = '2 == 2'
test "$($ANALYZE compare-versions 2 1)" = '2 > 1' test "$("$ANALYZE" compare-versions 2 1)" = '2 > 1'
test "$($ANALYZE compare-versions '' '')" = "'' == ''" test "$("$ANALYZE" compare-versions '' '')" = "'' == ''"
set +e set +e
$ANALYZE compare-versions 1 2; ret1=$? "$ANALYZE" compare-versions 1 2; ret1=$?
$ANALYZE compare-versions 2 2; ret2=$? "$ANALYZE" compare-versions 2 2; ret2=$?
$ANALYZE compare-versions 2 1; ret3=$? "$ANALYZE" compare-versions 2 1; ret3=$?
set -e set -e
test $ret1 == 12 test "$ret1" == 12
test $ret2 == 0 test "$ret2" == 0
test $ret3 == 11 test "$ret3" == 11

View File

@ -44,9 +44,9 @@ test_one() (
fi fi
if [[ "${input##*/}" =~ \.fstab\.input ]]; then if [[ "${input##*/}" =~ \.fstab\.input ]]; then
SYSTEMD_LOG_LEVEL=debug SYSTEMD_IN_INITRD="$initrd" SYSTEMD_SYSFS_CHECK=no SYSTEMD_PROC_CMDLINE="fstab=yes root=fstab" SYSTEMD_FSTAB="$input" SYSTEMD_SYSROOT_FSTAB="/dev/null" $generator "$out" "$out" "$out" SYSTEMD_LOG_LEVEL=debug SYSTEMD_IN_INITRD="$initrd" SYSTEMD_SYSFS_CHECK=no SYSTEMD_PROC_CMDLINE="fstab=yes root=fstab" SYSTEMD_FSTAB="$input" SYSTEMD_SYSROOT_FSTAB="/dev/null" "$generator" "$out" "$out" "$out"
else else
SYSTEMD_LOG_LEVEL=debug SYSTEMD_IN_INITRD="$initrd" SYSTEMD_SYSFS_CHECK=no SYSTEMD_PROC_CMDLINE="fstab=no $(cat "$input")" $generator "$out" "$out" "$out" SYSTEMD_LOG_LEVEL=debug SYSTEMD_IN_INITRD="$initrd" SYSTEMD_SYSFS_CHECK=no SYSTEMD_PROC_CMDLINE="fstab=no $(cat "$input")" "$generator" "$out" "$out" "$out"
fi fi
# The option x-systemd.growfs creates symlink to system's systemd-growfs@.service in .mount.wants directory. # The option x-systemd.growfs creates symlink to system's systemd-growfs@.service in .mount.wants directory.

View File

@ -53,7 +53,7 @@ for f in $(find "$SOURCE"/test-*.input | sort -V); do
echo "*** Running $f" echo "*** Running $f"
prepare_testdir "${f%.input}" prepare_testdir "${f%.input}"
cp "$f" "$TESTDIR/usr/lib/sysusers.d/test.conf" cp "$f" "$TESTDIR/usr/lib/sysusers.d/test.conf"
$SYSUSERS --root="$TESTDIR" "$SYSUSERS" --root="$TESTDIR"
compare "${f%.*}" "" compare "${f%.*}" ""
done done
@ -62,7 +62,7 @@ for f in $(find "$SOURCE"/test-*.input | sort -V); do
echo "*** Running $f on stdin" echo "*** Running $f on stdin"
prepare_testdir "${f%.input}" prepare_testdir "${f%.input}"
touch "$TESTDIR/etc/sysusers.d/test.conf" touch "$TESTDIR/etc/sysusers.d/test.conf"
$SYSUSERS --root="$TESTDIR" - <"$f" "$SYSUSERS" --root="$TESTDIR" - <"$f"
compare "${f%.*}" "on stdin" compare "${f%.*}" "on stdin"
done done
@ -72,9 +72,9 @@ for f in $(find "$SOURCE"/test-*.input | sort -V); do
prepare_testdir "${f%.input}" prepare_testdir "${f%.input}"
touch "$TESTDIR/etc/sysusers.d/test.conf" touch "$TESTDIR/etc/sysusers.d/test.conf"
# this overrides test.conf which is masked on disk # this overrides test.conf which is masked on disk
$SYSUSERS --root="$TESTDIR" --replace=/etc/sysusers.d/test.conf - <"$f" "$SYSUSERS" --root="$TESTDIR" --replace=/etc/sysusers.d/test.conf - <"$f"
# this should be ignored # this should be ignored
$SYSUSERS --root="$TESTDIR" --replace=/usr/lib/sysusers.d/test.conf - <"$SOURCE/test-1.input" "$SYSUSERS" --root="$TESTDIR" --replace=/usr/lib/sysusers.d/test.conf - <"$SOURCE/test-1.input"
compare "${f%.*}" "on stdin with --replace" compare "${f%.*}" "on stdin with --replace"
done done
@ -84,7 +84,7 @@ echo "*** Testing --inline"
prepare_testdir "$SOURCE/inline" prepare_testdir "$SOURCE/inline"
# copy a random file to make sure it is ignored # copy a random file to make sure it is ignored
cp "$f" "$TESTDIR/etc/sysusers.d/confuse.conf" cp "$f" "$TESTDIR/etc/sysusers.d/confuse.conf"
$SYSUSERS --root="$TESTDIR" --inline \ "$SYSUSERS" --root="$TESTDIR" --inline \
"u u1 222 - - /bin/zsh" \ "u u1 222 - - /bin/zsh" \
"g g1 111" "g g1 111"
@ -95,7 +95,7 @@ echo "*** Testing --inline with --replace"
prepare_testdir "$SOURCE/inline" prepare_testdir "$SOURCE/inline"
# copy a random file to make sure it is ignored # copy a random file to make sure it is ignored
cp "$f" "$TESTDIR/etc/sysusers.d/confuse.conf" cp "$f" "$TESTDIR/etc/sysusers.d/confuse.conf"
$SYSUSERS --root="$TESTDIR" \ "$SYSUSERS" --root="$TESTDIR" \
--inline \ --inline \
--replace=/etc/sysusers.d/confuse.conf \ --replace=/etc/sysusers.d/confuse.conf \
"u u1 222 - - /bin/zsh" \ "u u1 222 - - /bin/zsh" \
@ -105,7 +105,7 @@ compare "$SOURCE/inline" "(--inline --replace=…)"
echo "*** Testing --inline with no /etc" echo "*** Testing --inline with no /etc"
rm -rf "${TESTDIR:?}/etc" rm -rf "${TESTDIR:?}/etc"
$SYSUSERS --root="$TESTDIR" --inline \ "$SYSUSERS" --root="$TESTDIR" --inline \
"u u1 222 - - /bin/zsh" \ "u u1 222 - - /bin/zsh" \
"g g1 111" "g g1 111"
@ -136,7 +136,7 @@ for f in $(find "$SOURCE"/test-*.input | sort -V); do
echo "*** Running $f (with login.defs)" echo "*** Running $f (with login.defs)"
prepare_testdir "${f%.input}" prepare_testdir "${f%.input}"
cp "$f" "$TESTDIR/usr/lib/sysusers.d/test.conf" cp "$f" "$TESTDIR/usr/lib/sysusers.d/test.conf"
$SYSUSERS --root="$TESTDIR" "$SYSUSERS" --root="$TESTDIR"
# shellcheck disable=SC2050 # shellcheck disable=SC2050
[ @ENABLE_COMPAT_MUTABLE_UID_BOUNDARIES@ = 1 ] && bound=555 || bound=$system_guid_max [ @ENABLE_COMPAT_MUTABLE_UID_BOUNDARIES@ = 1 ] && bound=555 || bound=$system_guid_max
@ -152,7 +152,7 @@ for f in $(find "$SOURCE"/test-*.input | sort -V); do
echo "*** Running $f (with login.defs symlinked)" echo "*** Running $f (with login.defs symlinked)"
prepare_testdir "${f%.input}" prepare_testdir "${f%.input}"
cp "$f" "$TESTDIR/usr/lib/sysusers.d/test.conf" cp "$f" "$TESTDIR/usr/lib/sysusers.d/test.conf"
$SYSUSERS --root="$TESTDIR" "$SYSUSERS" --root="$TESTDIR"
# shellcheck disable=SC2050 # shellcheck disable=SC2050
[ @ENABLE_COMPAT_MUTABLE_UID_BOUNDARIES@ = 1 ] && bound=555 || bound=$system_guid_max [ @ENABLE_COMPAT_MUTABLE_UID_BOUNDARIES@ = 1 ] && bound=555 || bound=$system_guid_max
@ -166,7 +166,7 @@ for f in $(find "$SOURCE"/unhappy-*.input | sort -V); do
echo "*** Running test $f" echo "*** Running test $f"
prepare_testdir "${f%.input}" prepare_testdir "${f%.input}"
cp "$f" "$TESTDIR/usr/lib/sysusers.d/test.conf" cp "$f" "$TESTDIR/usr/lib/sysusers.d/test.conf"
SYSTEMD_LOG_LEVEL=info $SYSUSERS --root="$TESTDIR" 2>&1 | tail -n1 | sed -r 's/^[^:]+:[^:]+://' >"$TESTDIR/err" SYSTEMD_LOG_LEVEL=info "$SYSUSERS" --root="$TESTDIR" 2>&1 | tail -n1 | sed -r 's/^[^:]+:[^:]+://' >"$TESTDIR/err"
if ! diff -u "$TESTDIR/err" "${f%.*}.expected-err"; then if ! diff -u "$TESTDIR/err" "${f%.*}.expected-err"; then
echo >&2 "**** Unexpected error output for $f" echo >&2 "**** Unexpected error output for $f"
cat >&2 "$TESTDIR/err" cat >&2 "$TESTDIR/err"