Commit Graph

35222 Commits

Author SHA1 Message Date
Lennart Poettering 2ac2ff3fc1 utf8: let's update utf16_to_utf8() a bit
Let's change utf16_to_utf8() prototype to refer to utf16 chars with char16_t rather than void

Let's not cast away a "const" needlessly.

Let's add a few comments.

Let's fix the calculations of the buffer size to allocate, and how long
to run the loop in case of uneven byte numbers
2018-09-25 15:57:47 +02:00
Lennart Poettering 7c42185784 utf8: change return type of utf8_encoded_expected_len() to size_t
After all it returns a lengths of a string in chars, and hence should
return size_t, exactly like strlen().
2018-09-25 15:57:47 +02:00
Lennart Poettering 07667be733 utf8: modernize utf16 inline calls a bit
Let's fix an indentation issue.

Let's avoid yoda comparisons.

Let's drop unnecessary ().

Let's make sure we convert 16bit values to 32bit before shifting them by
10bit to the left, to avoid overflows.

Let's avoid comparisons between signed literals and unsigned variables,
in particular if the literals are outside of the minimum range C
requires for "int".
2018-09-25 15:57:47 +02:00
Lennart Poettering e71fb4b302 utf8: update utf8_is_valid() a bit
Let's avoid a few casts in the function. Also, let's drop the "const"
when returning the string, for similar reasons as strchr() and friends
drop it: so that we don't add a const if the user passes in a non-const
string.
2018-09-25 15:57:47 +02:00
Lennart Poettering 2b5d05fdfe
Merge pull request #10088 from keszybz/man-systemctl-return
man: add a description of systemctl return codes
2018-09-25 12:35:36 +02:00
Lennart Poettering 7c428bb5d5
Merge pull request #10059 from yuwata/env-exec-directory
core: introduce $RUNTIME_DIRECTORY= or friends
2018-09-25 12:34:30 +02:00
Lennart Poettering 653d469519 exec-util: add missing logging call
This function logs about all errors, but one case was forgotten. Fix
that.
2018-09-25 12:04:14 +02:00
Lennart Poettering ed689f7894 exec-util: handle putenv() errors
Just paranoia, as putenv() can fail and we should catch it, like we
catch all other errors.

Follow-up for #10073
2018-09-25 12:04:14 +02:00
Zbigniew Jędrzejewski-Szmek 6f48815918 test-journal-syslog: initialize variable
The *priority argument to syslog_parse_priority() needs to be initialized
if the last argument (with_facility) is false.

CID #1394690.
2018-09-25 11:34:52 +02:00
Zbigniew Jędrzejewski-Szmek 8a76031152 udev-builtin-net_id: do not assume "type" attribute exists
It *should*, but who knows, let's be more defensive here.

CID #1395805.
2018-09-25 11:29:54 +02:00
Zbigniew Jędrzejewski-Szmek ccc0ec6f71 journal-upload: fix off-by-one in assert()
CID #1394386.
2018-09-25 11:22:13 +02:00
Zbigniew Jędrzejewski-Szmek ec766a5168 sd-event: use new cleanup function more 2018-09-25 11:15:27 +02:00
Zbigniew Jędrzejewski-Szmek 8c75fe1765 sd-event: remove dead code and use _cleanup_
CID #1393250.
2018-09-25 11:10:12 +02:00
Lennart Poettering 9afd574039 docs: clarify controller mount logic in hybrid cgroups mode
Fixes: #10107
2018-09-25 11:00:57 +02:00
Thiago Macieira 044c2c7a2b Make bzip2 an optional dependency for systemd-importd
Yes, there are still a lot of users of bzip2, but it's fallen out of
favour after LZMA/xz, which can compress a lot more and often
decompresses faster than bzip2 too.
2018-09-25 10:58:09 +02:00
Lennart Poettering 4295fd9e82
Merge pull request #10163 from poettering/inhibit-format-table
systemd-inhibit --list: port to format-table.c
2018-09-25 10:24:30 +02:00
Zbigniew Jędrzejewski-Szmek 3318fd9c24
Merge pull request #10073 from xnox/execve
Execute generators with manager's environment exported
2018-09-25 10:07:23 +02:00
Zbigniew Jędrzejewski-Szmek 1346489f8c DHCPv6: use unsigned for flags 2018-09-25 09:29:36 +02:00
Zbigniew Jędrzejewski-Szmek d00de84373
Merge pull request #10164 from poettering/btrfs-resize-fix
btrfs resize fix
2018-09-25 09:24:14 +02:00
Lennart Poettering 614a8274f2 udev: fix some type sloppiness
We use strtoul() which returns an "unsigned long", but then assign this
to int or unsigned in, i.e. drop 32bit silently on 64bit systems. Let's
clean this up a bit, and retain the right types.
2018-09-25 09:20:16 +02:00
Lennart Poettering 6ac386855c logind: fix blacklist/whitelist confusion in comment (#10165)
Triggered by this:

602a41c22a (r30575293)
2018-09-25 07:02:41 +09:00
Lennart Poettering 7fe96758d1 docs: fix CONTRIBUTING path (#10160) 2018-09-25 06:25:48 +09:00
Lennart Poettering 7e69127871 btrfs: log at debug log when we ignore errors
This stuff is likely to fail in many setups (for example when quota is
not supported by the btrfs version), hence only log at debug
level. Previously we'd silently ignore things altogether which makes
things pretty hard to debug.
2018-09-24 19:47:42 +02:00
Lennart Poettering de89949a71 btrfs: fix loopback resizing code
This corrects the block device to use, to the right path, as it was
before 553e15f21b.

Replaces: #10153
2018-09-24 19:44:06 +02:00
Lennart Poettering bd1b3f75e8 update TODO 2018-09-24 19:25:49 +02:00
Lennart Poettering a942661787 inhibit: use format-table to format systemd-inhibit --list
This changes the output a bit, as the previous multi-line output of each
inhibitor is changed to a single line, but it does unify the output look
with the one of our other tools. Moreover this adds proper sorting.
2018-09-24 19:21:00 +02:00
Lennart Poettering 2f47ef04ea inhibit: normalize variable types
When we parse an "u" from an sd_bus_message then we need to do that into
a uint32_t, not a pid_t or uid_t, even if this is likely the same.

Also, let's count objects we keep in memory as size_t as usual.
2018-09-24 19:21:00 +02:00
Lennart Poettering 0e6872cdfc inhibit: normalize when we log about failures to list inhibitors
let's print log messages about all types of errors inside of the
function, since otherwise we might sometimes log twice about some
specific cases.
2018-09-24 19:21:00 +02:00
Yu Watanabe 6c9c51e5e2 fs-util: make symlink_idempotent() optionally create relative link 2018-09-24 18:52:53 +03:00
Zbigniew Jędrzejewski-Szmek bee13f2e49
Merge pull request #9989 from yuwata/sd-device-enoent
sd-device: make sd_device_get_*() return -ENOENT if the values are not set
2018-09-24 17:27:49 +02:00
Zbigniew Jędrzejewski-Szmek 7e86bd73a4 seccomp: tighten checking of seccomp filter creation
In seccomp code, the code is changed to propagate errors which are about
anything other than unknown/unimplemented syscalls. I *think* such errors
should not happen in normal usage, but so far we would summarilly ignore all
errors, so that part is uncertain. If it turns out that other errors occur and
should be ignored, this should be added later.

In nspawn, we would count the number of added filters, but didn't use this for
anything. Drop that part.

The comments suggested that seccomp_add_syscall_filter_item() returned negative
if the syscall is unknown, but this wasn't true: it returns 0.

The error at this point can only be if the syscall was known but couldn't be
added. If the error comes from our internal whitelist in nspawn, treat this as
error, because it means that our internal table is wrong. If the error comes
from user arguments, warn and ignore. (If some syscall is not known at current
architecture, it is still silently ignored.)
2018-09-24 17:21:09 +02:00
Zbigniew Jędrzejewski-Szmek b54f36c604 seccomp: reduce logging about failure to add syscall to seccomp
Our logs are full of:
Sep 19 09:22:10 autopkgtest systemd[690]: Failed to add rule for system call oldstat() / -10037, ignoring: Numerical argument out of domain
Sep 19 09:22:10 autopkgtest systemd[690]: Failed to add rule for system call get_thread_area() / -10076, ignoring: Numerical argument out of domain
Sep 19 09:22:10 autopkgtest systemd[690]: Failed to add rule for system call set_thread_area() / -10079, ignoring: Numerical argument out of domain
Sep 19 09:22:10 autopkgtest systemd[690]: Failed to add rule for system call oldfstat() / -10034, ignoring: Numerical argument out of domain
Sep 19 09:22:10 autopkgtest systemd[690]: Failed to add rule for system call oldolduname() / -10036, ignoring: Numerical argument out of domain
Sep 19 09:22:10 autopkgtest systemd[690]: Failed to add rule for system call oldlstat() / -10035, ignoring: Numerical argument out of domain
Sep 19 09:22:10 autopkgtest systemd[690]: Failed to add rule for system call waitpid() / -10073, ignoring: Numerical argument out of domain
...
This is pointless and makes debug logs hard to read. Let's keep the logs
in test code, but disable it in nspawn and pid1. This is done through a function
parameter because those functions operate recursively and it's not possible to
make the caller to log meaningfully.


There should be no functional change, except the skipped debug logs.
2018-09-24 17:21:09 +02:00
Zbigniew Jędrzejewski-Szmek f09da7ccbc test-seccomp: log function names
Various tests produce similar output, and the function names make it
easier to see where the output is generated.
2018-09-24 17:21:09 +02:00
Zbigniew Jędrzejewski-Szmek 23e12f8e6c test-seccomp: move two similar tests closer 2018-09-24 17:19:11 +02:00
Zbigniew Jędrzejewski-Szmek 0532f2bb5d
Merge pull request #10087 from keszybz/xnox/fix-test-functions
test/test-functions: drop all prefixes
2018-09-24 15:15:23 +02:00
Dimitri John Ledkov a3156a8ee4 core: execute generators with manager's environmnet 2018-09-24 13:40:50 +01:00
Dimitri John Ledkov ea368f0bd2 core: execute environment_generators with manager's environment 2018-09-24 13:40:10 +01:00
Dimitri John Ledkov 78ec1bb436 exec-util: in execute_directories, support initial exec environment 2018-09-24 13:40:10 +01:00
Zbigniew Jędrzejewski-Szmek f11aae7151
Merge pull request #10082 from porrided/udev-ipoib
Introduce predictable naming for IP-over-InfiniBand NICs
2018-09-24 13:14:06 +02:00
Zbigniew Jędrzejewski-Szmek 54e6f0a38f
Merge pull request #9981 from pfl/dhcp6_pd_other_information_quirk
DHCPv6 PD other information quirk
2018-09-24 13:02:24 +02:00
Yu Watanabe c679e12af1 tree-wide: drop unnecessary initializations 2018-09-23 17:18:50 +09:00
Yu Watanabe 2c740afd16 tree-wide: do not assign unused return values 2018-09-23 17:18:50 +09:00
Yu Watanabe 8a80712bcd logind-acl: replace strdup()+set_consume() by set_put_strdup() 2018-09-23 17:18:50 +09:00
Yu Watanabe 8090b41ed5 gpt-auto-generator: do not assign '*ret' on error 2018-09-23 17:18:50 +09:00
Yu Watanabe 403660c508 tree-wide: use streq() instead of streq_ptr() 2018-09-23 17:18:50 +09:00
Yu Watanabe dcfbde3a43 sd-device: make sd_device_get_*() return -ENOENT if the values are not set 2018-09-23 17:18:19 +09:00
Yu Watanabe feae122f3e test-udev: use LOG_REALM_UDEV
Otherwise, even if SYSTEMD_LOG_LEVEL=debug is specified, the test does
not show most debug messages.
2018-09-22 09:56:40 +02:00
Yu Watanabe 51b006e18d udevadm: show only version number for '--version' option
This effectively reverts 2bc54be485
and relevant changes in #9920, as it is used to determine the version
of udev, e.g., dracut.

Fixes dracutdevs/dracut#468.
2018-09-21 10:58:54 +02:00
Zbigniew Jędrzejewski-Szmek 298950d055
Merge pull request #10135 from yuwata/log-skipped-tests
test: add log messages when some tests are skipped
2018-09-20 23:07:48 +02:00
Yu Watanabe 642d1a6d6e test-execute: skip several tests when running in container 2018-09-21 00:45:00 +09:00