1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-26 03:22:00 +03:00
Commit Graph

68352 Commits

Author SHA1 Message Date
Lennart Poettering
d66ff6fe77 cryptenroll: add addition asserts 2023-10-25 09:29:34 +02:00
Lennart Poettering
c588cf9720 repart: reduce scope of two variables
This replicates what 475c473d32 did for
cryptenroll for repart, which has very similar code for this.
2023-10-25 09:29:34 +02:00
Lennart Poettering
4af7f27aeb tpm2-util: add line breaks in compound struct init, like we usually do 2023-10-25 09:29:20 +02:00
Lennart Poettering
3ee5e9d5f3 tpm2-util: dont't find best PCR bank if no PCRs are selected whatsoever
This will otherwise just yield weird log message, complaining that PCRs
were not initialized. But which PCRs if we have none selected?
2023-10-25 09:29:20 +02:00
Lennart Poettering
adabcbabff execute: log about failures when opening a terminal to reset 2023-10-25 09:28:17 +02:00
Lennart Poettering
83d5bbaf1b mount-util: add one more const 2023-10-25 15:53:10 +09:00
Lennart Poettering
8f21b3b21b update TODO 2023-10-24 23:18:51 +02:00
Luca Boccassi
b7180e43a6
Merge pull request #29689 from mrc0mmand/test-shutdown
test: shorten service stop/abort timeouts for TEST-69-SHUTDOWN
2023-10-24 20:39:34 +01:00
Luca Boccassi
648fbfe621
Merge pull request #29677 from keszybz/rewinddir-alternative-fix
Rewind dir fd before using it for cleanup
2023-10-24 19:41:02 +01:00
Mike Yuan
828ad30470 sleep-config: make hybrid sleep always use 'suspend' disk mode
If user requests hybrid sleep, we should always use 'suspend'
disk mode. If that's not supported, let's correctly report it
so they can choose plain hibernation instead. HybridSleepMode=
serves no purpose in this case and should be removed.

Addresses https://github.com/systemd/systemd/pull/29681#discussion_r1369812785
2023-10-24 19:07:03 +02:00
Zbigniew Jędrzejewski-Szmek
c04cec128f shared/pretty-print: skip redundant section headers with --tldr
If the same section appears consecutively in a given file, subsequent
occurenced are not printed.

[Slice]
Foo=bar
[Slice]   # this is not printed
Bar=bar

Requested in
https://github.com/systemd/systemd/pull/29553#pullrequestreview-1677310352.
2023-10-24 18:32:18 +02:00
Zbigniew Jędrzejewski-Szmek
5737c890d6 binfmt: add --tldr 2023-10-24 18:32:18 +02:00
Zbigniew Jędrzejewski-Szmek
f80f5dd6cc sysctl: add --tldr 2023-10-24 18:32:18 +02:00
Zbigniew Jędrzejewski-Szmek
918560d70f sysusers: add --tldr 2023-10-24 18:32:17 +02:00
Zbigniew Jędrzejewski-Szmek
1be6a5db21 tmpfiles: add --tldr
This is like --cat-config, but omits the comments and empty lines.
The name is incoungrous with --cat-config, but I don't see a nice way to
call it that wouldn't be annoyingly long.

pager_open() is moved to cat_config() to remove some lines from run().
2023-10-24 18:32:17 +02:00
Zbigniew Jędrzejewski-Szmek
a9e6803582 shared/pretty-print: add highlighting 2023-10-24 18:24:12 +02:00
Yu Watanabe
0f9efffaeb test-network: wait for the state file being updated
Also, sync state files before read.

Addresses the first issue in #29678.
2023-10-24 23:22:27 +09:00
Zbigniew Jędrzejewski-Szmek
063c838206 analyze/cat-config: add switch to print only "interesting" parts of config files
When looking at configuration, often a user wants to suppress the comments and
just look at the parts that actually configure something, roughly equivalent to
  systemd-analyze cat-config … | rg -v '^(#|;|$)
This switch implements this natively, skipping lines that start with a comment
character or only contain whitespace.

For formats that have section headers, section headers are skipped, if only
followed by stuff that would be skipped. (The last section header is printed
when we're about to print some actual output.)

Note that the caller doesn't know if the format has headers or not. We do format
type detection in pretty-print.c. So the caller only specifies tldr=true|false, and
conf_files_cat() figures out if the format has headers and whether those should
be handled specially.

The comments that show the file name are always printed, even if all of the file
is suppressed.

This is a partial answer to the discussions in
https://github.com/systemd/systemd/pull/28919,
https://github.com/systemd/systemd/pull/29248. If the default config is shown in
config files, the user can conveniently use '--tldr' to show the relevant parts.
2023-10-24 15:59:34 +02:00
Zbigniew Jędrzejewski-Szmek
e3b84b105e shared/copy: rewind dir fd before using it for cleanup
This seems to be the only place where rm_rf_children() is called with a
possibly used fd, which is then passed through to rm_rf_children_impl().

This also fixes #29606.
(Tested on Fedora rawhide with kernel 6.5.6-300.fc39.x86_64.)
2023-10-24 13:37:10 +02:00
Luca Boccassi
e5cd8bc060
Merge pull request #29601 from yuwata/mmap-check-overflow
mmap: check offset and size more carefully
2023-10-24 12:20:04 +01:00
Frantisek Sumsal
270b20b98b test: shorten service stop/abort timeouts for TEST-69-SHUTDOWN
In several Ubuntu CI jobs I noticed timeouts in TEST-69, which are
apparently caused by a very stubborn bash/login process:

$ journalctl -o short-monotonic --no-hostname --file artifacts/TEST-69-SHUTDOWN.journal
[ 2011.698430] systemd[1]: shutdown.target: starting held back, waiting for: veritysetup.target
[ 2011.698473] systemd[1]: sysinit.target: stopping held back, waiting for: user@0.service
[ 2045.884982] systemd[1]: systemd-oomd.service: Got notification message from PID 54 (WATCHDOG=1)
[ 2071.576424] systemd[1]: Received SIGCHLD from PID 65 (bash).
[ 2071.576941] systemd[1]: Child 65 (bash) died (code=killed, status=1/HUP)
[ 2071.577026] systemd[1]: session-13.scope: Child 65 belongs to session-13.scope.
[ 2071.577100] systemd[1]: session-13.scope: cgroup is empty
[ 2071.577249] systemd[1]: session-13.scope: Deactivated successfully.

$ journalctl -o short-monotonic --no-hostname --file artifacts/TEST-69-SHUTDOWN.journal _PID=65
[ 3038.661488] login[65]: ROOT LOGIN  on '/dev/pts/0'

Since, in this case, we really care only about the actual shutdown,
let's shorten the service stop/abort timeouts to let systemd SIGKILL all
remaining processes in the 60s `expect` window.
2023-10-24 12:51:03 +02:00
Frantisek Sumsal
5ab2f737cd test: introduce $TEST_SKIP_SHUTDOWN
To get rid of some boilerplate.
2023-10-24 12:35:03 +02:00
Luca Boccassi
50dbadc9d1
Merge pull request #29685 from poettering/cryptenroll-reduce-scope
cryptenroll: two minor simplifications
2023-10-24 10:49:37 +01:00
Yu Watanabe
bd7d902884 network: also synchronously update manager state file 2023-10-24 18:39:47 +09:00
Yu Watanabe
a70c27b834 network: make link_save() static 2023-10-24 18:39:47 +09:00
Yu Watanabe
ac4a69500e network: do not try to save link state file twice on boot
On enumeration, (that is, before manager_start() is called), enumerated
links may already have the dirty flag. In that case, saving the state
file in manager_start() should clear the flag.
2023-10-24 18:39:47 +09:00
Mike Yuan
cf6416612c
Merge pull request #29681 from YHNdnzj/sleep-round-three
sleep-config: cleanup round three
2023-10-24 17:03:54 +08:00
Yu Watanabe
8875639a7c
Merge pull request #29679 from keszybz/drop-iovec-null
Drop IOVEC_NULL
2023-10-24 17:05:45 +09:00
Zbigniew Jędrzejewski-Szmek
1dd33bf3e4 basic/iovec-util: use FOREACH_ARRAY in one more place 2023-10-23 22:30:37 +02:00
Zbigniew Jędrzejewski-Szmek
3c9783c7f4 basic/iovec-util: drop TAKE_IOVEC
As suggested in
https://github.com/systemd/systemd/pull/29679#discussion_r1368678932.
2023-10-23 22:23:13 +02:00
Lennart Poettering
475c473d32 cryptenroll: merge two if checks with same condition
This removes a duplicate condition check by adding a common surrounding
if block.

This also change a confusing if check: "(X && Y) && Z" to simply "X && Y && Z"
2023-10-23 22:19:40 +02:00
Lennart Poettering
91a1632a4c cryptenroll: reduce scope of two global variables
No change in behaviour
2023-10-23 22:19:29 +02:00
Luca Boccassi
d334c1211f systemctl: fallback if logind doesn't support new flag
Follow-up for 665a3d6d15
2023-10-23 19:43:15 +01:00
Luca Boccassi
28d2c32f0b
Merge pull request #29633 from yuwata/dhcp-ipv6-only-mode-follow-ups
dhcp: several follow-ups for IPv6 only mode
2023-10-23 18:39:10 +01:00
Mike Yuan
fefddffa53
sleep-config: check sleep mode only when hibernation
With the previous change, this should only be used when
doing hibernation.
2023-10-23 23:12:27 +08:00
Mike Yuan
1f82c21dce
sleep-config: remove HibernateState= & HybridSleepState=, restrict
SuspendState= not to include "disk"

I don't know why these existed in the first place, but as I
justified in the comments, it's simply not sensible to allow
HibernateState= or HybridSleepState= to take values other than
'disk'. So let's just remove those options. Also, SuspendState=
should not contain 'disk'.
2023-10-23 23:12:27 +08:00
Mike Yuan
080105d77a
hibernate-util: add missing assertion 2023-10-23 23:12:27 +08:00
Mike Yuan
a3f7047f00
hibernate-resume: add missing static for arg_info 2023-10-23 23:12:27 +08:00
Antonio Alvarez Feijoo
2c87b71b00 timedatectl: add missing commands to the help output
Follow up to 159a855b34
2023-10-23 15:48:58 +01:00
Zbigniew Jędrzejewski-Szmek
7dc951ef91 basic/iovec-util: drop IOVEC_NULL
The macro isn't very useful, we can just use the direct setting to increase
readability.
2023-10-23 15:04:08 +02:00
Zbigniew Jędrzejewski-Szmek
1ca0b482b6 basic/iovec-util: always call the iovec "iovec"
We were using "i", "iov", and "iovec" in variuos places. Let's be
consistent.
2023-10-23 15:04:08 +02:00
Zbigniew Jędrzejewski-Szmek
59ccbad65e Revert "rm-rf: Make sure we rewinddir() before readdir()"
This reverts commit 6bbb893b90.

Let's try a different approach where we make sure that all callers only pass in
a fd that is "clean", i.e. at offset 0. The majority of callers of this function
(both direct and indirect) pass a freshly-opened fd, so the rewind call is not
needed.
2023-10-23 13:56:38 +02:00
Luca Boccassi
f04333210b
Merge pull request #29674 from poettering/unexport-marshal-blob
tpm2-util: make tpm2_marshal_blob()/tpm2_unmarshal_blob() static
2023-10-23 11:43:15 +01:00
Lennart Poettering
24aeaf4e7f glyph-util: add 'full block' glyph 2023-10-23 11:24:35 +01:00
Lennart Poettering
4cdef9f08c pcrextend: split out word to measure code into shared helper file
Let's split out the logic that actually generates the word to measure to
PCRs into a new helper file pcrextend-util.[ch].

This we can later reuse to calculate PCR measurement predictions ahead
of time.
2023-10-23 11:24:18 +01:00
Lennart Poettering
10cb55eef1 efi-api: export UUID converter calls
(while exporting, do some minor simplifications)
2023-10-23 11:23:56 +01:00
Lennart Poettering
add8091c97 tpm2-util: make tpm2_read_public() static, as we use it only internally in tpm2-util.c 2023-10-23 10:36:22 +02:00
Lennart Poettering
9122edf907 tpm2-util: make tpm2_marshal_blob()/tpm2_unmarshal_blob() static
These are not used outside of tpm2-util.[ch], and the way they merge
public/private key pair into one blob is kinda specific to our
implementation, hence better should be hidden away, and not used for new
code anyway.
2023-10-23 10:36:22 +02:00
Julien Malka
f64b9a1897 creds-utils: fix read_full_file_full call in read_credential_with_decryption
data was passed as a null pointer when an address was expected.
As a result, the assert was always tripped.
2023-10-23 09:36:04 +02:00
NAHO
e6e5a272ed docs: correct parenthesis placement in 'man/tmpfiles.d.xml'
Correct the parenthesis placement in 'man/tmpfiles.d.xml' to prevent the
following formatting:

> lock ( shared or exclusive) is
2023-10-22 18:12:58 +01:00