Commit Graph

40682 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek f85cc54c4b udev-rules: add precise information to rule failure logs
It is pretty hard to figure out what the problem actually is, esp. when the rule
is long.

On my machine:
systemd[1]: Starting udev Kernel Device Manager...
systemd-udevd[217399]: /usr/lib/udev/rules.d/11-dm-lvm.rules:40 Invalid value for OPTIONS key, ignoring: 'event_timeout=180'
systemd-udevd[217399]: /usr/lib/udev/rules.d/11-dm-lvm.rules:40 The line takes no effect, ignoring.
systemd-udevd[217399]: /etc/udev/rules.d/60-ipath.rules:4 Invalid value "kcopy/%02n" for NAME (char 7: invalid substitution type), ignoring, but please fix it.
systemd-udevd[217399]: /usr/lib/udev/rules.d/65-md-incremental.rules:28 Invalid value "/sbin/mdadm -I $env{DEVNAME} --export $devnode --offroot ${DEVLINKS}" for IMPORT (char 58: invalid substitution type), ignoring, but please fix it.
systemd-udevd[217399]: /etc/udev/rules.d/73-special-net-names.rules:14 Invalid value "/bin/sh -ec 'D=${DEVPATH#*/vio/}; D=${D%%%%/*}; D=${D#????}; D=${D#0}; D=${D#0}; D=${D#0}; D=${D#0}; echo ${D:-0}'" for PROGRAM (char 16: invalid substitution type), ignoring, but please fix it.
systemd-udevd[217399]: /usr/lib/udev/rules.d/84-nm-drivers.rules:10 Invalid value "/bin/sh -c 'ethtool -i $1 | sed -n s/^driver:\ //p' -- $env{INTERFACE}" for PROGRAM (char 24: invalid substitution type), ignoring, but please fix it.
systemd-udevd[217399]: /usr/lib/udev/rules.d/90-libgpod.rules:19 IMPORT key takes '==' or '!=' operator, assuming '==', but please fix it.
systemd-udevd[217399]: /usr/lib/udev/rules.d/90-libgpod.rules:23 IMPORT key takes '==' or '!=' operator, assuming '==', but please fix it.
systemd-udevd[217399]: /usr/lib/udev/rules.d/99-vmware-scsi-udev.rules:5 Invalid value "/bin/sh -c 'echo 180 >/sys$DEVPATH/device/timeout'" for RUN (char 27: invalid substitution type), ignoring, but please fix it.
systemd-udevd[217399]: /usr/lib/udev/rules.d/99-vmware-scsi-udev.rules:6 Invalid value "/bin/sh -c 'echo 180 >/sys$DEVPATH/device/timeout'" for RUN (char 27: invalid substitution type), ignoring, but please fix it.
systemd[1]: Started udev Kernel Device Manager.
2019-06-28 16:20:48 +02:00
Zbigniew Jędrzejewski-Szmek 1824300add udev-event: use normal pointer ops where appropriate 2019-06-28 16:20:48 +02:00
Zbigniew Jędrzejewski-Szmek e79c228b52 udev: move rule structure definitions into the .c file
They are (and should) only be used there, no need to expose them.
2019-06-28 16:20:48 +02:00
Zbigniew Jędrzejewski-Szmek d4114f704f udev: move rules logging functions into the .c file
They are (and can) only be used there, no need to expose them.
2019-06-28 16:20:48 +02:00
Zbigniew Jędrzejewski-Szmek 4ec8514142 Rename EXTRACT_QUOTES to EXTRACT_UNQUOTE
Whenever I see EXTRACT_QUOTES, I'm always confused whether it means to
leave the quotes in or to take them out. Let's say "unquote", like we
say "cunescape".
2019-06-28 11:35:05 +02:00
Zbigniew Jędrzejewski-Szmek cae90de3d3 Reindent some things for readability 2019-06-28 11:19:24 +02:00
Lubomir Rintel 844d5a87c9 cryptsetup-generator: fix luks-* entry parsing from crypttab
This reverts a part of commit 49fe5c0996 ('tree-wide: port various places
over to STARTSWITH_SET()') that replaced a pair of startswith() calls
with STARTSWITH_SET().

They were in fact for a different strings (device vs. name), botching
the crypttap parsing.
2019-06-28 10:18:59 +02:00
Yu Watanabe cc82851c0d bash-completion: support systemd-analyze condition 2019-06-28 10:04:38 +02:00
Franck Bui 9a43538896 coredump: make use of the iovec-array helpers
Previous code was allocating an array of iovecs big enough to store all the
fields added later by various functions.

This forced us to calculate the size of the array in advance which is too error
prone if for example one wants to add new fields or simply rework the
code. Various assertions were added to make sure there's no overflow but it's
still more code for no good reasons.

Instead, this patch switches to the new iovec array handling interface so the
array is grown dynamically when needed.

The other contraint was that some iovecs were supposed to be freed whereas some
others were not. This makes the code hard to (re)organize. The new code always
allocates fields so it becomes easier to rework the code.
2019-06-28 08:24:09 +02:00
Yu Watanabe 22800b473e
Merge pull request #12889 from keszybz/analyze-condition
Add systemd-analyze condition
2019-06-28 02:37:20 +09:00
Franck Bui ae41fdb66a io-util: introduce iovw_put_string_field() helper 2019-06-27 19:14:27 +02:00
Franck Bui 11e6d9714e journal-import: extract helpers for handling arrays of iovec and make them available for others 2019-06-27 19:14:23 +02:00
Franck Bui 554c76b662 coredump: drop 2 useless assertions 2019-06-27 19:01:32 +02:00
Franck Bui 51d3783d87 coredump: slighlty simplify stack trace generation logic
The main advantage is to avoid the code duplication used to build MESSAGE=
field.

No functional changes.
2019-06-27 19:01:32 +02:00
Franck Bui 2705fcd63b coredump: fix the check on the number of passed args in backtrace mode
In backtrace mode, '--backtrace' option should also be counted.
2019-06-27 19:01:32 +02:00
Franck Bui aaeb25224d coredump: gather_pid_metadata() doesn't return 1 anymore
Since commit 92e92d71fa, gather_pid_metadata()
returns only 0 or a negative value.
2019-06-27 19:01:32 +02:00
Franck Bui 30a0554ebd coredump: rename set_iovec_field_free() into set_iovec_string_field_free()
It's more in line with its counterpart set_iovec_string_field().

Also move the definition to io-util next to set_iovec_string_field().
2019-06-27 19:01:28 +02:00
Zbigniew Jędrzejewski-Szmek dc2c231684
Merge pull request #12760 from zachsmith/systemd-sleep_resume_offset
systemd-sleep: use resume_offset value if set
2019-06-27 13:37:27 +02:00
Zbigniew Jędrzejewski-Szmek 9266f31e61 core: skip whitespace after "|" and "!" in the condition parser
We'd skip any whitespace immediately after "=", but then we'd treat whitespace
that is between "|" or "!" and the value as significant. This is rather
confusing, let's ignore it too.
2019-06-27 10:54:37 +02:00
Zbigniew Jędrzejewski-Szmek e3b52014e2 shared/condition: fix printing of ConditionNull=
ConditionNull= is the only condition where parameter==NULL is allowed,
and we'd print ConditionNull=(null) or ConditionNull=!(null).
2019-06-27 10:54:37 +02:00
Zbigniew Jędrzejewski-Szmek edfea9fe0d analyze: add 'condition' verb
We didn't have a straightforward way to parse and evaluate those strings.
Prompted by #12881.
2019-06-27 10:54:37 +02:00
Zbigniew Jędrzejewski-Szmek a93c6ed342
Merge pull request #12894 from stapelberg/patch-1
cryptsetup: comment: crypt_setup → crypt_format
2019-06-27 10:43:48 +02:00
Michael Prokop d238709c14 docs: fix typos and duplicate words
s/and and/and/
s/explicity/explicitly/
s/that that/that/
s/the the/the/
s/is is/it is/
s/overriden/overridden/
2019-06-27 10:43:21 +02:00
Michael Stapelberg 307472654c
cryptsetup: comment: crypt_setup → crypt_format 2019-06-27 09:38:30 +02:00
Zbigniew Jędrzejewski-Szmek f9d269e14d
Merge pull request #12890 from yuwata/fix-conf-parser-12883
conf-parse: fix continuation handling
2019-06-27 08:13:14 +02:00
Zach Smith 64602c843b systemd-sleep: refuse to calculate swapfile offset on Btrfs
If hibernation is requested but /sys/power/resume and
/sys/power/resume_offset are not configured correctly, systemd-sleep
attempts to calculate swapfile offset using fstat and fiemap.
Btrfs returns virtual device number for stat and a virtual offset
for fiemap which results in incorrect offset calculations. In the
case where offset would be calculated and the user is using Btrfs,
log a debug message and fail to write device and offset values.
2019-06-26 22:04:59 -07:00
Zach Smith 2002d8cdae systemd-sleep: (bug) use resume_offset value if set
Use hibernation configuration as defined in
/sys/power/resume and /sys/power/resume_offset
if present before inspecting /proc/swaps and
attempting to calculate swapfile offset
2019-06-26 22:04:59 -07:00
Evgeny Vereshchagin a7c5865098
Merge pull request #12892 from yuwata/fix-test-format-util-12891
test: fix argument type of test_format_bytes_one()
2019-06-27 07:56:59 +03:00
Yu Watanabe fd8c6b46c9 test: fix argument type of test_format_bytes_one()
Closes #12891.
2019-06-27 10:31:55 +09:00
Yu Watanabe 71d7a8218d util,test: rename variable non_iec -> si 2019-06-27 10:17:20 +09:00
Yu Watanabe 3d5d346aa5 test: add testcase for issue #12883 2019-06-27 03:03:45 +09:00
Yu Watanabe 0ef69585d8 conf-parser: fix continuation handling
Before this commit, empty lines cannot break continuation.
The bug was introduced by 9adbfeb38a.

Closes #12883.
2019-06-27 03:00:26 +09:00
Zbigniew Jędrzejewski-Szmek b1d5246d29 core: do not enumerate units in MANAGER_TEST_RUN_MINIMAL mode
In this mode we are not supposed to "interact with the environment", so loading
all units and printing warnings about syntax errors and /var/run usage seems
inappropriate.
2019-06-26 16:25:36 +02:00
Zbigniew Jędrzejewski-Szmek bbd199c438 man: move description of how conditions are combined to the beginning
Originally the description of conditions was brief, so it was acceptable
to put this part at the end. But now we have a myriad conditions, and
this crucial bit of information is easy to miss.
2019-06-26 16:24:48 +02:00
Zbigniew Jędrzejewski-Szmek 48f48b8c7c core: move assert before actual use of the variable
No point in using u->id first, and doing assert(u) later.
-std=c89 strikes again.
2019-06-26 16:24:48 +02:00
Franck Bui 47cf786c0a coredump: rely on /proc exclusively to get the name of the crashing process
I couldn't see any reason why the kernel could provide COMM to the coredump
handler via the core_pattern command line but could not make it available in
/proc. So let's assume that this info is always available in /proc.

For "backtrace" mode (when --backtrace option is passed), I assumed that the
crashing process still exists at the time systemd-coredump is called.

Also changing the core_pattern line is an API breakage for any users of the
backtrace mode but given that systemd-coredump is installed in
/usr/lib/systemd, it's a private tool which has no internal users. At least no
one complained when the hostname was added to the core_pattern line
(f45b801551)...

Indeed it's much easier to get it from /proc since the kernel substitutes '%e'
specifier with multiple strings if the process name contains spaces (!).
2019-06-26 11:17:23 +02:00
Franck Bui 57ae8f9936 coredump: fix one memleak in backtrace mode
Journal importer internal structures need to be freed.
2019-06-26 11:17:23 +02:00
Franck Bui 274fa94132 coredump: make use of STRINGIFY 2019-06-26 11:17:23 +02:00
Michal Sekletar 33fe9e3fd0 execute: drop SYNTHETIC_ERRNO because error code was received from the apply_numa_policy() 2019-06-25 21:52:28 +02:00
Yu Watanabe 7f474ed78d network: further log message update
Follow-up for 44e891bbf6.
2019-06-26 00:56:51 +09:00
Joerg Behrmann fa97f63067 core: factor root_directory application out of apply_working_directory
Fixes: #12498
2019-06-25 22:53:33 +09:00
Frantisek Sumsal a07a7324ad core: move config_parse_* functions to a shared module
Apart from making the code a little bit more clean, it should allow us
to write a fuzzer around the config-parsing functions in the future
2019-06-25 22:35:02 +09:00
INSUN PYO c13fb25734 man: change true/false to yes/no for DefaultDependencies. 2019-06-25 21:55:38 +09:00
Lennart Poettering 12a9fbe649
Merge pull request #12877 from poettering/dynamic-user-re-migrate2
DynamicUser=1 → = 0 migration follow-up
2019-06-25 12:20:26 +02:00
Lennart Poettering b5bd7a29f9 some CODING_STYLE additions 2019-06-25 10:56:15 +02:00
Lennart Poettering 33a5137cf0 man: say D-Bus, not dbus 2019-06-25 10:47:46 +02:00
Lennart Poettering cc9ba15efe man: improve --test documentation
Incorporates some suggestions from:

https://github.com/systemd/systemd/pull/12868#discussion_r296738370
cd69e88ba3 (commitcomment-34060775)
2019-06-25 10:47:46 +02:00
Lennart Poettering 528c365658 test: add test for DynamicUser=0 → =1 migration (and back) 2019-06-25 10:47:46 +02:00
Lennart Poettering 2193f17c08 core: mention why we do migration for everything but ConfigurationDirectory= 2019-06-25 10:47:46 +02:00
Lennart Poettering cf52c45d6b core: log when we convert from DynamicUser=1 to =0 or vice versa 2019-06-25 10:47:46 +02:00