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

52458 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
75312ada53 systemctl: show error when help for unknown unit is requested
Fixes #20189. We would only log at debug level and return failure, which looks
like a noop for the user.

('help' accepts multiple arguments and will show multiple concatenated man
pages in that case. Actually, it will also show multiple concatenated man pages
if the Documentation= setting lists multiple pages. I don't think it's very
terribly useful, but, meh, I don't think we can do much better. If a user
requests a help for a two services, one known and one unknown, there'll now be
a line in the output. It's not very user friendly, but not exactly wrong too.)
2021-07-12 15:26:40 +01:00
Yu Watanabe
1d26d4cd14 test-network: add a testcase for ManageForeignRoutes=no 2021-07-12 20:59:42 +09:00
Luca BRUNO
c68c87d023 man/dnssec-trust-anchors: fix an XML syntax typo
This fixes an XML syntax typo in the 'dnssec-trust-anchors'
documentation.
2021-07-12 12:09:20 +01:00
Yu Watanabe
11046cea14 network: also check addresses when determine a gateway address is reachable or not
Fixes #20201.
2021-07-12 16:35:48 +09:00
Carl Lei
9de0c7f4ae man: fix RFC number
#19947 didn't fix both.
2021-07-12 14:10:32 +09:00
Mike Gilbert
f2c57d4f38 libudev: add "Libs.private: -lrt -pthread" to libudev.pc
This resolves a failure when linking cryptsetup.static against libudev.a.

```
libtool: link: x86_64-pc-linux-gnu-gcc -Wall -O2 -pipe -march=amdfam10 -static -O2 -o cryptsetup.static lib/utils_crypt.o lib/utils_loop.o lib/utils_io.o lib/utils_blkid.o src/utils_tools.o src/utils_password.o src/utils_luks2.o src/utils_blockdev.o src/cryptsetup.o -pthread -pthread  -Wl,--as-needed ./.libs/libcryptsetup.a -largon2 -lrt -ljson-c -lpopt -luuid -lblkid -lssl -lcrypto -lz -ldl -ldevmapper -lm -lpthread -ludev -pthread
/usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/../../../../lib64/libudev.a(src_libsystemd_sd-daemon_sd-daemon.c.o): in function `sd_is_mq':
(.text.sd_is_mq+0x3a): undefined reference to `mq_getattr'
```
2021-07-11 11:01:54 +01:00
James Hilliard
d6d1fd995f Disable non-explicit sbatvars autodetection for cross builds.
Since autodetection is unlikely to work reliably for cross builds
disable it unless explicitly enabled.

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
2021-07-10 23:46:26 +01:00
Ben Stockett
4226dfafba Updated manpage for sd_bus_set_property
Updated manpage for sd_bus_set_property and sd_bus_set_propertyv. In the old manpage, these functions included the parameter sd_bus_message **reply when the actual function had no such argument.
2021-07-10 13:19:50 +01:00
nassir90
a814eae728
Fixed typo (#20187)
* Fixed typo

Before, the file claimed that some systemd units are created "from other
configuration". It should have read "from other configuration files".

Co-authored-by: Nozz <nozolo90@gmail.com>
2021-07-09 21:16:02 +01:00
Luca Boccassi
af55491028
Merge pull request #20186 from keszybz/coverity-fixes
Coverity fixes
2021-07-09 21:15:08 +01:00
Frantisek Sumsal
2f0927626a tree-wide: coccinelle fixes
Yet another batch of Coccinelle fixes.
2021-07-09 20:54:22 +01:00
Frantisek Sumsal
0de0ba573b
Merge pull request #20185 from mrc0mmand/ci-tweaks
test: assorted test tweaks to address flakiness
2021-07-09 20:21:59 +02:00
Luca Boccassi
5c8cf104e7
Merge pull request #20157 from keszybz/numerical-uids-in--M
Allow numerical UIDs in systemctl -M uid@ and similar
2021-07-09 16:58:45 +01:00
Zbigniew Jędrzejewski-Szmek
d1829af943 creds: fix leak of arg_tpm2_device
IIUC, "auto" is the same as NULL. There is no need to strdup() anything.

Coverity CID#1458113.
2021-07-09 15:29:47 +02:00
Frantisek Sumsal
7e8cfa4bb6 test: make the strace check a bit more clever
We still sometimes try to grep an empty strace log because strace is not
yet properly initialized. Let's make the check a bit clever and wait
until strace is attached to PID 1 by checking the `TracerPid` field in
`/proc/1/status`.
2021-07-09 15:26:07 +02:00
Zbigniew Jędrzejewski-Szmek
89fa9a6b7b networkd: add shared parser for mud urls
The same buggy code was triplicated…
2021-07-09 15:13:12 +02:00
Zbigniew Jędrzejewski-Szmek
bc1f27ff55 creds: drop unnecessary initialization
Coverity also thinks a leak happens here, CID #1458112.
This seems wrong, but let's add an assert, maybe that'll help.
2021-07-09 15:13:12 +02:00
Zbigniew Jędrzejewski-Szmek
1421705d9a core: drop unnecessary initialization
cunescape() sets output on success, so initialization is not necessary. There
was no comment, but I think they may have been added because the compiler
wasn't convinced that the return value is non-negative on success. It could
have been confused by the int return type on escape*(), which was changed by
the one of preceeding commits to ssize_t, or by the length calculation, so add
an assert to help the compiler.

For some reason coverity thinks the output can be leaked here (CID #1458111).
I don't see how.
2021-07-09 15:12:18 +02:00
Zbigniew Jędrzejewski-Szmek
2744c7bb01 xdg-autostart: minor refactoring
We can't say free_and_replace(exec_split[n++], quoted), because the the
argument is evaluated multiple times. But I think that this form is
still easier to read.
2021-07-09 15:07:40 +02:00
Zbigniew Jędrzejewski-Szmek
12d729b2ec nspawn: inline one iterator variable declaration 2021-07-09 15:07:40 +02:00
Zbigniew Jędrzejewski-Szmek
e437538f35 tree-wide: make cunescape*() functions return ssize_t
Strictly speaking, we are returning the size of a memory chunk of
arbitrary size, so ssize_t is more appropriate than int.
2021-07-09 15:07:40 +02:00
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