Commit Graph

54125 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
5f035b13de meson-render-jinja2: use ast.literal_eval()
Imports are sorted in the usual fashion: stdlib first.

literal_eval() parses string/numbers/lists/sets/dicts, and nothing else, while
eval will execute any python code. Using literal_eval() is generally more
correct, because it avoids the risk of side effects from the parsed expression.
In this case, we generate the parsed strings ourselves, so it's very unlikely
to have anything unexpected in the expressions. But let's do the correct thing
anyway.
2021-11-05 14:56:32 +01:00
Zbigniew Jędrzejewski-Szmek
7f9521d5e1 Merge pull request #21225 from medhefgo/boot-cleanup
Boot cleanup
2021-11-05 14:53:47 +01:00
Luca Boccassi
fac2c3e97d basic/mountpoint-util: detect erofs as a read-only FS 2021-11-05 14:02:04 +01:00
Lennart Poettering
d7654742ee loop-util: reopen device node if we shortcut loop device creation
The LoopDevice object supports a shortcut: if the backing fd we are
supposed to create a loopback device of refers to a
block device alrady then we'll use it as is – if we can – instead of
setting up an unnecessary loopback device that would be pretty much
the same as its backing device.

Previously, when doing this we'd just dup() the original backing fd and
use that. But that's problematic in case O_DIRECT was set on the fd,
since we'll keep that flag set on our copy too, which means we can't do
simple, regular IO on it anymore.

Thus, let's reopen the inode in this case with the exact access flags
we'd apply if we'd actually allocate and open a new loopback device.

Fixes: #21176
2021-11-05 07:08:16 +00:00
Luca Boccassi
7544461cd0 Merge pull request #21229 from keszybz/improve-m-hint
Improve hint to use -M in various tools
2021-11-04 18:40:26 +00:00
Jan Janssen
d1da890004 sd-boot: Fix efi_arch checks
efi_arch is set to whatever meson returns from host_machine.cpu_family() and
gnu_efi_arch is then set accordingly.

On x86, efi_arch == x86 and gnu_efi_arch == ia32. Surprisingly, compilation
worked (without disabling some instruction sets) and nobody ever complained
about systemd-bootia32.efi not working.
2021-11-04 18:54:31 +01:00
Jan Janssen
1840dfc327 sd-boot: Detect supported compile args
This brings the final list of compiler arguments more in line with
how meson does things. In particular, --buildtype=plain will not
add any optimizations on its own (and would have to be provided
through CFLAGS=).
2021-11-04 18:54:31 +01:00
Jan Janssen
f8a738bbc0 sd-boot: Add some link flags
These flags are used by gnu-efi. Adding --no-undefined even allows
us to drop the no-undefined-symbols.sh test in favor of immediate
compile time errors.
2021-11-04 18:54:31 +01:00
Jan Janssen
1f6f233f87 sd-stub: Fix possible memory leak 2021-11-04 18:54:31 +01:00
Jan Janssen
65ff3d2626 sd-boot: Check for existence of required pe sections 2021-11-04 18:48:53 +01:00
Jan Janssen
ff9d65f6ff sd-boot: Move optional header verification into verify_pe 2021-11-04 18:37:07 +01:00
Jan Janssen
785b5fcf5f sd-boot: Use FLAGS_SET 2021-11-04 18:37:07 +01:00
Jan Janssen
a8a7723ba9 sd-boot: Move flags helpers to macro-fundamental.h 2021-11-04 18:37:07 +01:00
Jan Janssen
1224d57ba5 sd-boot: Always compile with -ffreestanding and -fshort-wchar
This is not a hosted environment and we should not pretend otherwise
if -ffreestanding is not supported.

With EFI strings being in UCS2, it is not supported to build without
-fshort-wchar as gcc/clang default to a w_char_t size of 4 bytes.

This also makes the charset for wide chars explicit on gcc. This way
we get a nice error message if anyone ever tries to add 💩 to strings.
2021-11-04 18:37:07 +01:00
Jan Janssen
3c86dcc39c sd-boot: Save and restore console attributes
This also only writes the message on a new line if we aren't at the
beginning of one already.
2021-11-04 18:37:07 +01:00
Lennart Poettering
3663f754f1 Merge pull request #21070 from medhefgo/boot-save
sd-boot: Add support to boot last select entry
2021-11-04 17:37:12 +01:00
Lennart Poettering
71bb9594e9 Merge pull request #21030 from DaanDeMeyer/path-skipped
core: Propagate condition failed state from service to path unit.
2021-11-04 15:20:00 +01:00
Zbigniew Jędrzejewski-Szmek
a4eba5d8cf update-helper: add missing loop over user units
Noticed by Luca.

shellcheck doens't catch this, and somehow it was missed in review
and testing ;(
2021-11-04 11:39:04 +01:00
Zbigniew Jędrzejewski-Szmek
10a7340a97 tree-wide: do not print hint about -M if -M is already used
(Or when -H is used, since -H and -M are incompatible.)

Note that the slightly unusual form with separate boolean variables (hint_vars,
hint_addr) instead of e.g. a const char* variable to hold the message, because this
way we don't trigger the warning about non-literal format.
2021-11-04 11:00:54 +01:00
Zbigniew Jędrzejewski-Szmek
fb293b3c0f busctl: do not print hint about -M if -M is already used
(Or when -H is used, since -H and -M are incompatible.)
2021-11-04 11:00:15 +01:00
Zbigniew Jędrzejewski-Szmek
237fbb6719 shared/bus-util: make bus_log_*_error() functions functions
They were defined as macros, but they are a bit too complicated for this,
so it's getting unwieldy. We can make them functions without any loss.
2021-11-04 11:00:15 +01:00
Lennart Poettering
aedec452b9 tree-wide: always use TAKE_FD() when calling rearrange_stdio()
rearrange_stdio() invalidates specified fds even on failure, which means
we should always invalidate the fds we pass in no matter what. Let's
make this explicit by using TAKE_FD() for that everywhere.

Note that in many places we such invalidation doesnt get us much
behaviour-wise, since we don't use the variables anymore later. But
TAKE_FD() in a way is also documentation, it encodes explicitly that the
fds are invalidated here, so I think it's a good thing to always make
this explicit here.
2021-11-03 23:05:26 +00:00
Daan De Meyer
12ab94a1e4 core: Propagate condition failed state to triggering units.
Alternative to https://github.com/systemd/systemd/pull/20531.

Whenever a service triggered by another unit fails condition checks,
stop the triggering unit to prevent systemd busy looping trying to
start the triggered unit.
2021-11-03 20:25:14 +00:00
Yu Watanabe
829b86bc0f Merge pull request #21217 from keszybz/debug-test-process-util
procfs-util: fix confusion wrt. quantity limit and maximum value
2021-11-04 04:03:56 +09:00
Yu Watanabe
3f5e7edbdb Merge pull request #21216 from poettering/take-fd-tweak
fd-util: make TAKE_FD free of double evaluation
2021-11-04 04:01:45 +09:00