1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-02 10:51:20 +03:00
Commit Graph

52437 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
ddedf7ca69 basic/escape: use _cleanup_ in one more place
Also, let's not use 'r' for a char*.
2021-07-09 15:07:13 +02:00
Frantisek Sumsal
e68e473ba2 test: strip binaries by default
Since 23f8e01 we always kept binaries unstripped, since $STRIP_BINARIES
is unset by default.
2021-07-09 14:59:11 +02:00
Frantisek Sumsal
7fb4ee7aa5 test: bump the test timeout to give ldconfig.service enough time to finish
Sometimes the ldconfig.service might take a bit longer to finish,
causing spurious test timeouts:

```
[ 1025.858923] systemd[24]: ldconfig.service: Executing: /sbin/ldconfig -X
...
[ 1043.883620] systemd[1]: ldconfig.service: Main process exited, code=exited, status=0/SUCCESS (success)
...
Trying to halt container. Send SIGTERM again to trigger immediate
termination.
Container TEST-52-HONORFIRSTSHUTDOWN terminated by signal KILL.
E: Test timed out after 20s
```
2021-07-09 14:47:29 +02:00
nl6720
250db1bf02 docs: improve wording when mentioning the acronym "ESP"
"ESP" is "EFI system partition", so "ESP partition" is redundant.
2021-07-09 13:41:00 +02:00
Zbigniew Jędrzejewski-Szmek
fe819f569a shared/format-table: fix invalid free
Coverity CID#1458108.
2021-07-09 13:17:16 +02:00
Zbigniew Jędrzejewski-Szmek
2da7d0bc92 sd-bus: allow numerical uids in -M user@.host
UIDs don't work well over ssh, but locally or with containers they are OK.
In particular, user@.service uses UIDs as identifiers, and it's nice to be
able to copy&paste that UID for interaction with the user's managers.
2021-07-09 11:18:21 +02:00
Zbigniew Jędrzejewski-Szmek
0c201ca945 sd-bus: print debugging information if bus_container_connect_socket() fails
We would return the errno, but there are many steps, and without some
debugging info it's hard to figure out what exactly failed.
2021-07-09 11:18:21 +02:00
Zbigniew Jędrzejewski-Szmek
87fa2e21dd sd-bus: print quoted commandline when in bus_socket_exec()
The arguments are where the interesting part is:
src/libsystemd/sd-bus/bus-socket.c:965: sd-bus: starting bus with systemd-run...
↓
src/libsystemd/sd-bus/bus-socket.c:972: sd-bus: starting bus with systemd-run -M.host -PGq --wait -pUser=1000 -pPAMName=login systemd-stdio-bridge "-punix:path=\${XDG_RUNTIME_DIR}/bus"
2021-07-09 11:18:21 +02:00
Zbigniew Jędrzejewski-Szmek
8a62620ebe core: use the new quoting helper 2021-07-09 11:18:21 +02:00
Zbigniew Jędrzejewski-Szmek
eeb91d29b0 basic/escape: add helper for quoting command lines 2021-07-09 11:18:21 +02:00
Zbigniew Jędrzejewski-Szmek
ae732f6e2d networkd: minor refactoring 2021-07-09 11:11:25 +02:00
Zbigniew Jędrzejewski-Szmek
7dc7ab311b networkd: replace one trivial asprintf with xsprintf 2021-07-09 11:11:25 +02:00
Zbigniew Jędrzejewski-Szmek
fbc39784b0 shared/killall: replace one trivial asprintf with xsprintf 2021-07-09 11:11:25 +02:00
Zbigniew Jędrzejewski-Szmek
12619d0a80 tree-wide: do not use (void) asprintf
asprintf(3) says that the pointer is "undefined" after a failed call.
In the current glibc implementation it is just NULL. In principle the
call could return a valid pointer with bad contents or something.

We have two styles of error handling: in a majority of cases we would
check the return value, but sometimes we used (void) and relied on the
pointer not being set. In practice both styles should be equivalent,
but gcc doesn't like the second one with -Wunused-result. (Though only
sometimes. E.g. on my F34 box I don't get the same warnings as in CI,
even though the compiler version is very similar and the compilation
options are the same…). It's also nice to be consistent in our code base.
So let's always use the first style of error checking.
2021-07-09 11:11:25 +02:00
Zbigniew Jędrzejewski-Szmek
cb3e854fed basic/time-util: indentation 2021-07-09 11:11:25 +02:00
Zbigniew Jędrzejewski-Szmek
6c6368e938 basic/{time,format}-util: warn when format result is unused
Now that anonymous buffers are used in almost all cases, code which
does not use the return value is usually broken.
2021-07-09 11:11:25 +02:00
Zbigniew Jędrzejewski-Szmek
bc2a4af25f meson: re-enable -Wunused-result with clang
We disabled it in f73fb7b742 in response to an
apparent gcc bug. It seems that depending on the combination of optimization
options, gcc still ignores (void). But this seems to work fine with clang, so
let's re-enable the warning conditionally.
2021-07-09 11:11:25 +02:00
Zbigniew Jędrzejewski-Szmek
9ca7e3d00d Replace format_bytes_cgroup_protection with FORMAT_BYTES_CGROUP_PROTECTION 2021-07-09 11:11:25 +02:00
Zbigniew Jędrzejewski-Szmek
46e23f9a8d tree-wide: add FORMAT_BYTES_FULL() 2021-07-09 11:11:25 +02:00
Zbigniew Jędrzejewski-Szmek
3c90437083 cgtop: use anonymous buffers for formatting of bytes and timespans 2021-07-09 11:11:25 +02:00
Zbigniew Jędrzejewski-Szmek
d3e4029457 basic/macro: make CONST_MAX(DECIMAL_STR_MAX(…), STRLEN(…)) possible
When those two macros were used together in CONST_MAX(), gcc would complain
about a type mismatch. So either DECIMAL_STR_MAX() should be made size_t like
STRLEN(), or STRLEN() be made unsigned.

Since those macros are only usable on arguments of (small) fixed size, any type
should be fine (even char would work…). For buffer size specifications, both
size_t and unsigned are OK. But unsigned was used for DECIMAL_STR_MAX macros
and FORMAT_foo_MAX macros, making STRLEN the only exception, so let's adjust
STRLEN() to be unsigned too.

Also: I don't think this is currently used anywhere, but if any of those macros
were used as an argument to sprintf, size_t would require a cast. ("%*s"
requires an int/unsigned argument.)
2021-07-09 11:11:25 +02:00
Zbigniew Jędrzejewski-Szmek
22fd4a8f85 import: use SYNTHETIC_ERRNO in one more place 2021-07-09 11:11:25 +02:00
Zbigniew Jędrzejewski-Szmek
2b59bf51a0 tree-wide: add FORMAT_BYTES() 2021-07-09 11:11:21 +02:00
Zbigniew Jędrzejewski-Szmek
6c1abe8807 Inline some iterator variables 2021-07-09 11:03:36 +02:00
Zbigniew Jędrzejewski-Szmek
0086ef19cb tree-wide: add FORMAT_TIMESTAMP_STYLE() 2021-07-09 11:03:36 +02:00
Zbigniew Jędrzejewski-Szmek
6dc57047ff shared/format-table: allocate buffer of sufficient size 2021-07-09 11:03:36 +02:00
Zbigniew Jędrzejewski-Szmek
32fc5c4763 tree-wide: add FORMAT_TIMESTAMP_RELATIVE() 2021-07-09 11:03:36 +02:00
Zbigniew Jędrzejewski-Szmek
5291f26d4a tree-wide: add FORMAT_TIMESPAN() 2021-07-09 11:03:36 +02:00
Zbigniew Jędrzejewski-Szmek
5e62ac8b51 sd-journal: add FORMAT_TIMESTAMP_SAFE() 2021-07-09 11:03:35 +02:00
Zbigniew Jędrzejewski-Szmek
04f5c018ce tree-wide: use FORMAT_TIMESTAMP() 2021-07-09 11:03:35 +02:00
Zbigniew Jędrzejewski-Szmek
ae7c644c22 basic/time-util: add FORMAT_TIMESTAMP
This uses the same idea of an anonyous buffer as ETHER_ADDR_TO_STR().
2021-07-09 11:03:35 +02:00
Zbigniew Jędrzejewski-Szmek
e265fa8198 test-ether-addr-util: add a simple test that HW_ADDR_TO_STR works with nesting
It seems to, but I was a bit incredulous… The comment is adjusted to match
the standard.

The trick with a temporary buffer is neat. I wasn't sure if it is valid, but
the standard says so. The test really tests that we are reading the rules right
and that the compiler doesn't do anythign strange or emit an unexpected
warning.
2021-07-09 11:03:35 +02:00
Yu Watanabe
d0e18bb4b0
Merge pull request #20166 from poettering/fsync-more
various tweaks to existing fsync() helpers, and some new apis
2021-07-09 07:32:01 +09:00
Yu Watanabe
452a07cfd6
Merge pull request #20168 from poettering/signal-util-tweak
generalize SIGINT handling in copy.c
2021-07-09 07:24:43 +09:00
Yu Watanabe
f1ee01e342
Merge pull request #20167 from poettering/format-table-tweaks
format-table: three new features
2021-07-09 07:20:49 +09:00
Lennart Poettering
6a24c995f0 dirent-util: no need to bother with fstatat() for "." and ".." to figure out if these are dirs 2021-07-09 04:18:09 +09:00
Lennart Poettering
bcf8fc267f blockdev-util: add fd-based APIs for getting backing block device for file 2021-07-08 14:49:02 +02:00
Lennart Poettering
1053967781 path-util: make path_compare() accept NULL 2021-07-08 13:56:06 +02:00
Yegor Alexeyev
a520bb6654 logind: allow binding different operation to reboot key long presses 2021-07-08 13:08:20 +02:00
Lennart Poettering
949162552d conf-files: rename return parameters ret_xyz 2021-07-08 13:06:58 +02:00
Lennart Poettering
c860665ef3
Merge pull request #20163 from poettering/repart-root-fix
repart: drop duplicate handling of /sysroot/ prefix
2021-07-08 13:06:41 +02:00
Lennart Poettering
19755bca19
Merge pull request #19995 from poettering/cred-tool
Add support for encrypted credentials
2021-07-08 12:59:59 +02:00
Lennart Poettering
14a4c4edc7 repart: when we can't fit the partitions in, report needed disk size current disk size
This improves error output in repart if we can't fit the defined
partitions into the disk image. With this change we'll now show not only
the disk size we need (as before), but also the current one, as well as
the largest free area on disk.

This should make it a bit easier to debug disk space issues that repart
runs into.
2021-07-08 11:46:35 +02:00
Hugo Osvaldo Barrera
8859b8f77a Mount encrypted swap partitions via gpt-auto
If the auto-discovered swap partition is LUKS encrypted, decrypt it
automatically.

This aligns with the Discoverable Partitions Specification, though I've
also updated it to explicitly mention that LUKS is now supported here.

Since systemd retries any key already in the kernel keyring, if the swap
partition has the same passphrase as the root partition, the user won't
be prompted a second time for a second passphrase.

See https://github.com/systemd/systemd/issues/20019
2021-07-08 11:46:20 +02:00
Lennart Poettering
215b64b2ad copy: port over to pop_pending_signal() 2021-07-08 10:38:09 +02:00
Lennart Poettering
0178ff292b signal-util: add helper pop_pending_signal() 2021-07-08 10:33:38 +02:00
Lennart Poettering
2c177b30e3 format-table: teach table_hide_column_from_display() to accept multiple arguments
In case we want to hide multiple columns in one go, make that easy.
2021-07-08 10:29:43 +02:00
Lennart Poettering
21fbf095b8 format-table: add cell type for outputting 64bit values in hex 2021-07-08 10:29:43 +02:00
Lennart Poettering
bc773fcb35 format-table: add cell type for "mode_t" values 2021-07-08 10:29:43 +02:00
Lennart Poettering
4050625e5b fs-util: teach syncfs_path() handle with empty path argument 2021-07-08 10:22:34 +02:00