Zbigniew Jędrzejewski-Szmek [Fri, 2 Mar 2018 10:32:25 +0000 (11:32 +0100)]
Merge pull request #8316 from yuwata/fix-8315
sysusers: do not create duplicated groups when create users
Zbigniew Jędrzejewski-Szmek [Fri, 2 Mar 2018 10:24:31 +0000 (11:24 +0100)]
Merge pull request #8330 from filbranden/masked1
Detect masked unit with drop-ins
Filipe Brandenburger [Fri, 2 Mar 2018 05:07:27 +0000 (21:07 -0800)]
test: masked unit with drop-ins
Filipe Brandenburger [Fri, 2 Mar 2018 01:48:15 +0000 (17:48 -0800)]
install: detect masked unit with drop-ins
Before this fix, a unit with drop-ins will not be reported as masked by
`systemctl is-enabled` or `systemctl list-unit-files`.
Yu Watanabe [Thu, 1 Mar 2018 22:38:28 +0000 (07:38 +0900)]
sysusers: do not implicitly create group by 'm' if 'u' with the same name exists
The commit
e2c2060f7b3b11fa3cca8899d80963b7a05cc4ab makes 'm' lines
disturb 'u' lines.
This fixes the disturbance.
Yu Watanabe [Thu, 1 Mar 2018 05:52:28 +0000 (14:52 +0900)]
test: add a test for sysusers
The test cases for sysusers did not cover the situation reported in
issue #8315. Let's add one more test case.
Yu Watanabe [Thu, 1 Mar 2018 18:27:34 +0000 (03:27 +0900)]
sysusers: do not create duplicated groups when create users
The commit
e2c2060f7b3b11fa3cca8899d80963b7a05cc4ab introduces
the issue #8315.
Fixes #8315.
Zbigniew Jędrzejewski-Szmek [Thu, 1 Mar 2018 20:48:36 +0000 (21:48 +0100)]
Remove /sbin from paths if split-bin is false (#8324)
Follow-up for
157baa87e4.
Lennart Poettering [Thu, 1 Mar 2018 14:06:02 +0000 (15:06 +0100)]
Merge pull request #8319 from keszybz/yet-another-symlink-installation-tweak
meson: fix symlink creation when sbin is symlink to bin
Lennart Poettering [Thu, 1 Mar 2018 14:03:19 +0000 (15:03 +0100)]
Merge pull request #8293 from dobyrch/master
tree-wide: fix inconsistencies in option parsing
Lennart Poettering [Thu, 1 Mar 2018 13:58:12 +0000 (14:58 +0100)]
Merge pull request #8322 from keszybz/doc-tweak
man: document that link-ed files must be on /
Douglas Christman [Wed, 28 Feb 2018 01:35:58 +0000 (20:35 -0500)]
udevadm: prevent segfault in blkid builtin when offset not specified
"--offset" takes an optional argument; if none is specified,
stroull() will attempt to parse a NULL pointer. For example:
$ udevadm test-builtin 'blkid --offset' /sys/dev/block/8:1
Update "--offset" to require an argument; also verify that the
offset is not negative.
Douglas Christman [Thu, 1 Mar 2018 00:31:32 +0000 (08:31 +0800)]
analyze: fix typo in error message
Douglas Christman [Wed, 28 Feb 2018 01:28:50 +0000 (20:28 -0500)]
test-libudev: make "-m" equivalent to "--monitor"
"-m" is specified as a short form of "--monitor" in the option struct,
but not included in getopt_long's optstring. Update the optstring
to be consistent with the option struct.
Douglas Christman [Wed, 28 Feb 2018 01:19:55 +0000 (20:19 -0500)]
systemctl: remove redundant option parsing code
"-f" used to be overloaded to mean both "--force" and "--follow";
aae9a96d removed "--follow", leaving behind some duplicate code.
Douglas Christman [Wed, 28 Feb 2018 01:16:26 +0000 (20:16 -0500)]
journalctl: make journalctl -g work as documented
Add "g" to optstring so both "--grep" and "-g" work with journalctl
Zbigniew Jędrzejewski-Szmek [Thu, 1 Mar 2018 12:11:00 +0000 (13:11 +0100)]
man: document that link-ed files must be on /
Fixes #8307.
Zbigniew Jędrzejewski-Szmek [Thu, 1 Mar 2018 09:28:29 +0000 (10:28 +0100)]
meson: support both separate and merged sbin-bin directories
Follow-up for
ba7f4ae6178309dc937e10cf7dce0eca9dafb8de.
By default, we detect if the real root has a separate /usr/sbin directory, but
this can be overrides with -Dsplit-bin=true|false. The check assumes that
/usr/sbin is split if it is not a symlink, so it'll return a false negative
with some more complicated setups. But that's OK, in those cases this should be
configured explicitly.
This will copy the structure of the directories in the root file system to
$DESTDIR. If a directory is a directory in $DESTDIR but a symlink in the root
file system, this script will fail. This means that it's not possible to reuse
a $DESTDIR from between
ba7f4ae61 and this patch.
Zbigniew Jędrzejewski-Szmek [Thu, 1 Mar 2018 10:49:42 +0000 (11:49 +0100)]
meson: autodetect split-usr
Also move the status from "features" to the paths section. This is more of an
anti-feature.
Lennart Poettering [Thu, 1 Mar 2018 10:27:06 +0000 (11:27 +0100)]
procfs-util: drop unnecessary zero initializations (#8321)
Follow-up for #8149.
Lennart Poettering [Thu, 1 Mar 2018 10:10:24 +0000 (11:10 +0100)]
Merge pull request #8149 from poettering/fake-root-cgroup
Properly synthesize CPU+memory accounting data for the root cgroup
Franck Bui [Thu, 1 Mar 2018 09:58:03 +0000 (10:58 +0100)]
units: delegate "memory" instead of "cpu" by default for user instances (#8320)
CPU accounting has a too bad impact on performance to be enabled by
default. Therefore we should not delegate "cpu" for now.
OTOH since commit
e0c46a736412b79b94a21f8512a769b9212b9adf, memory accounting
has been turned on for all units by default so it makes sense to delegate this
controller by default.
Lennart Poettering [Thu, 1 Mar 2018 09:44:17 +0000 (10:44 +0100)]
Merge pull request #8318 from keszybz/doc-tweak
A small man page update
Zbigniew Jędrzejewski-Szmek [Thu, 1 Mar 2018 08:30:55 +0000 (09:30 +0100)]
basic/cgroup-util: simplify cg_get_keyed_attribute(), add test
I didn't like the nested loop where we'd count what we have acquired already,
since we should always know that.
Zbigniew Jędrzejewski-Szmek [Thu, 1 Mar 2018 07:05:27 +0000 (08:05 +0100)]
gitignore .pot file
It is created by "ninja systemd-pot", and we don't want to include it
in git.
Lennart Poettering [Wed, 28 Feb 2018 17:15:40 +0000 (18:15 +0100)]
Merge pull request #8171 from poettering/sd-bus-queue-limit
try not to overload pid1's bus message write queue
Zbigniew Jędrzejewski-Szmek [Wed, 28 Feb 2018 09:53:18 +0000 (10:53 +0100)]
man: shorten/reword a bit in sd_bus_get_n_queued_read
In particular:
- drop "when it is non-zero" to avoid implying that it can be called if the
queue is not empty.
- "has been created" sounds like something happened in parallel,
but what we really mean is that *this* particular object *was* created in a
certain way.
Lennart Poettering [Wed, 28 Feb 2018 09:37:01 +0000 (10:37 +0100)]
Merge pull request #8283 from poettering/nspawn-user-fix
some trivial nspawn related fixes
Franck Bui [Wed, 28 Feb 2018 09:36:06 +0000 (10:36 +0100)]
rules: skip btrfs check if devices are not ready in 64-btrfs.rules (#8304)
If any devices are marked with 'SYSTEMD_READY=0' then we shouldn't run any
btrfs check on them.
Indeed there's no point in running "btrfs ready" on devices that already have
SYSTEMD_READY=0 set. Most probably such devices are members of a higher layer
aggregate device such as dm-multipath or software RAID. Doing IO on them wastes
time at best, and may cause delays, timeouts, or even hangs at worst (think
active-passive multipath or degraded RAID, for example).
It was initially reported at:
https://bugzilla.opensuse.org/show_bug.cgi?id=872929
Javier Martinez Canillas [Wed, 28 Feb 2018 09:25:19 +0000 (10:25 +0100)]
kernel-install: Don't install BLS kernel images if dest dir doesn't exist (#8306)
The script shouldn't rely on a previous script exiting with a status code
that prevents it to be executed. Instead, should check if the destination
directory for the BLS kernel image exists and exit otherwise.
Zbigniew Jędrzejewski-Szmek [Wed, 28 Feb 2018 09:20:48 +0000 (10:20 +0100)]
meson: install compat symlinks for systemctl and systemd (#8300)
v2:
- init is a symlink to systemd, not systemctl!
Lennart Poettering [Mon, 26 Feb 2018 19:51:04 +0000 (20:51 +0100)]
nspawn: close pipe on error
Lennart Poettering [Mon, 26 Feb 2018 19:50:57 +0000 (20:50 +0100)]
process-util: don't install atfork() handler more than once
Lennart Poettering [Mon, 26 Feb 2018 14:42:45 +0000 (15:42 +0100)]
coccinelle: slightly improve run-coccinelle.sh
Let's include the command line to use to get the requested output. This
makes it easy to copy/paste the command line out, and add "--in-place"
to actually apply the changes "run-coccinelle.sh" outputs.
Lennart Poettering [Mon, 26 Feb 2018 14:41:38 +0000 (15:41 +0100)]
util: add new safe_close_above_stdio() wrapper
At various places we only want to close fds if they are not
stdin/stdout/stderr, i.e. fds 0, 1, 2. Let's add a unified helper call
for that, and port everything over.
Lennart Poettering [Mon, 26 Feb 2018 14:30:19 +0000 (15:30 +0100)]
nspawn: propagate original error. No need to make up -EIO
Lennart Poettering [Mon, 26 Feb 2018 14:30:05 +0000 (15:30 +0100)]
nspawn: use STR_IN_SET() where we can
Lennart Poettering [Mon, 26 Feb 2018 14:29:30 +0000 (15:29 +0100)]
nspawn: port some code to use read_line()
This shortens our code a bit. Which is always nice.
Zbigniew Jędrzejewski-Szmek [Wed, 28 Feb 2018 08:10:16 +0000 (09:10 +0100)]
Merge pull request #8294 from fsateler/debian-patches
Upstreaming some debian patches
Yu Watanabe [Wed, 28 Feb 2018 01:55:59 +0000 (10:55 +0900)]
Merge pull request #8280 from poettering/seccomp-flags
seccomp flags rework + minor other build system/repo changes
Filipe Brandenburger [Wed, 28 Feb 2018 00:11:38 +0000 (16:11 -0800)]
rule-syntax-check: fix handling of runaway strings in comma splitting (#8298)
A runaway string should still be returned by the code that splits on
commas, so add a '?' to the regex so that the last '"?' in a string
still produces a valid block for the split code.
Tested:
ACTION=="remove\"GOTO=""
Which then produced:
$ test/rule-syntax-check.py src/login/70-uaccess.rules
# looking at src/login/70-uaccess.rules
Invalid line src/login/70-uaccess.rules:10: ACTION=="remove\"GOTO=""
clause: ACTION=="remove\"GOTO=""
Ansgar Burchardt [Thu, 24 Jul 2014 17:38:07 +0000 (19:38 +0200)]
Include additional directories in ProtectSystem
Michael Biebl [Thu, 18 Jul 2013 13:33:51 +0000 (15:33 +0200)]
Add note to udev.conf that changes to that file require a rebuild of the initramfs
Based on debian/patches/udev_conf_comments from the old udev package.
Zbigniew Jędrzejewski-Szmek [Tue, 27 Feb 2018 21:35:19 +0000 (22:35 +0100)]
Merge pull request #8297 from filbranden/udevrule1
Udev rule syntax checker updates
Yu Watanabe [Tue, 27 Feb 2018 21:18:06 +0000 (06:18 +0900)]
po: add Japanese translation (#8289)
Robert Antoni Buj Gelonch [Tue, 27 Feb 2018 21:16:41 +0000 (22:16 +0100)]
po: typing mistakes in Catalan translation (#8290)
Filipe Brandenburger [Tue, 27 Feb 2018 21:11:07 +0000 (13:11 -0800)]
rule-syntax-check: allow commas inside quoted strings
Using a regex to match the groups is smarter than the split(',') that
would break in those cases.
Tested:
SUBSYSTEM=="usb", ENV{ID_USB_INTERFACES}=="*:060101:*,*:070202:*", TAG+="uaccess"
Rule checker doesn't break there after this commit.
Filipe Brandenburger [Tue, 27 Feb 2018 19:12:18 +0000 (11:12 -0800)]
rule-syntax-check: add support for escaped double quotes
Add support to backslash-escaped double quote inside a string.
Tested by modifying src/login/70-uaccess.rules to include:
ACTION=="remove" it", GOTO="uaccess_end"
And had the rule checker complain about it:
$ test/rule-syntax-check.py src/login/70-uaccess.rules
# looking at src/login/70-uaccess.rules
Invalid line src/login/70-uaccess.rules:10: ACTION=="remove" it", GOTO="uaccess_end"
clause: ACTION=="remove" it"
Lennart Poettering [Mon, 26 Feb 2018 11:51:35 +0000 (12:51 +0100)]
seccomp: rework functions for parsing system call filters
This reworks system call filter parsing, and replaces a couple of "bool"
function arguments by a single flags parameter.
This shouldn't change behaviour, except for one case: when we
recursively call our parsing function on our own syscall list, then
we'll lower the log level to LOG_DEBUG from LOG_WARNING, because at that
point things are just a problem in our own code rather than in the user
configuration we are parsing, and we shouldn't hence generate confusing
warnings about syntax errors.
Fixes: #8261
Lennart Poettering [Mon, 26 Feb 2018 11:01:45 +0000 (12:01 +0100)]
systemd-sysv-install: unset ROOT rather than setting it to ""
Follow-up for #8264.
It's cleaner to pass no env var at all to forked off processes rather
than an empty one.
Lennart Poettering [Mon, 26 Feb 2018 10:50:12 +0000 (11:50 +0100)]
coccinelle: drop empty-if.cocci script
It doesn't work, spits out only rubbish and was already excluded of
run-coccinelle.sh. It's a pitty it doesn't work, but let's drop this
dead piece of code for now.
Lennart Poettering [Mon, 26 Feb 2018 10:48:46 +0000 (11:48 +0100)]
doc: add a new doc/ directory, and move two markdown docs into them
I figure sooneror later we'll have more of these docs, hence let's give
them a clean place to be.
This leaves NEWS and README/README.md as well as the LICENSE texts in
the root directory of the project since that appears to be customary for
Free Software projects.
Lennart Poettering [Tue, 13 Feb 2018 17:30:34 +0000 (18:30 +0100)]
core: don't process dbus unit and job queue when there are already too many messages pending
We maintain a queue of units and jobs that we are supposed to generate
change/new notifications for because they were either just created or
some of their property has changed. Let's throttle processing of this
queue a bit: as soon as > 1K of bus messages are queued for writing
let's skip processing the queue, and then recheck on the next
iteration again.
Moreover, never process more than 100 units in one go, return to the
event loop after that. Both limits together should put effective limits
on both space and time usage of the function, delaying further
operations until a later moment, when the queue is empty or the the
event loop is sufficiently idle again.
This should keep the number of generated messages much lower than
before on busy systems or where some client is hanging.
Note that this also means a bad client can slow down message dispatching
substantially for up to 90s if it likes to, for all clients. But that
should be acceptable as we only allow trusted bus clients, anyway.
Fixes: #8166
Lennart Poettering [Tue, 13 Feb 2018 17:27:47 +0000 (18:27 +0100)]
core: don't bother enqueuing signal messages into busses that aren't ready yet
This is an optimization: there's no point in enqueuing unit and job
change notificiation signal messages into bus connection that aren't
fully set up yet.
This doesn't fix #8166 but should lower the load of messages enqueued
but not processed yet a bit.
Lennart Poettering [Tue, 13 Feb 2018 17:27:05 +0000 (18:27 +0100)]
sd-bus: add APIs to query the current read and write queue size
Franck Bui [Fri, 23 Feb 2018 16:12:50 +0000 (17:12 +0100)]
rule-syntax-check: values can contain escaped double quotes
This is true since commit
7e760b79ad143b26a5c937afa7666a7c40508f85.
Note that the changes in the regex expressions relies on the fact that the
script assumes that the comma separator is mandatory.
Add a comment in the script to clarify this.
Franck Bui [Fri, 23 Feb 2018 15:54:40 +0000 (16:54 +0100)]
rule-syntax-check: PROGRAM is not supposed to get value assigned
In udev man page, "PROGRAM" key is part of the keys which are used for
matching purposes so it should only be used with the compare operator "==".
Actually it doesn't really make sense to assign it a value.
udev code allows both "=" and "==" for PROGRAM and both are handled the same
way but for consistencies it's better to have only the compare operator allowed
by the rule syntax checker.
No rules shipped by systemd use PROGRAM key so nothing need to be changed in
our rule files.
Franck Bui [Fri, 23 Feb 2018 15:49:17 +0000 (16:49 +0100)]
rules: add a missing comma in 70-uaccess.rules since it improves readability
rule-syntax-check.py failed with the following error:
$ ./test/rule-syntax-check.py ./src/login/70-uaccess.rules
Invalid line ./src/login/70-uaccess.rules:31: SUBSYSTEM=="sound", TAG+="uaccess" OPTIONS+="static_node=snd/timer", OPTIONS+="static_node=snd/seq"
clause: TAG+="uaccess" OPTIONS+="static_node=snd/timer"
The comma is actually optional but the script makes it mandatory which seems a
good thing since it improves readability.
Zbigniew Jędrzejewski-Szmek [Tue, 27 Feb 2018 12:33:00 +0000 (13:33 +0100)]
missing_syscall: add pkey_mprotect for ppc (#8292)
Accurate for both ppc and ppc64 according to https://fedora.juszkiewicz.com.pl/syscalls.html.
Evgeny Vereshchagin [Tue, 27 Feb 2018 09:34:41 +0000 (12:34 +0300)]
Merge pull request #8282 from poettering/khash-enokey
deal with borked ENOKEY on centos kernel's AF_ALG support
Robert Antoni Buj Gelonch [Tue, 27 Feb 2018 08:20:40 +0000 (09:20 +0100)]
po: update Catalan translation (#8267)
Yu Watanabe [Tue, 27 Feb 2018 07:59:03 +0000 (16:59 +0900)]
man: suggests TemporaryFileSystem= when people want to nest bind mounts inside InaccessiblePaths= (#8288)
Suggested by @sourcejedi in #8242.
Closes #7895, #7153, and #2780.
Zbigniew Jędrzejewski-Szmek [Tue, 27 Feb 2018 07:55:40 +0000 (08:55 +0100)]
Merge pull request #8285 from poettering/logind-close-fixes
various smaller logind fixes
Lennart Poettering [Tue, 27 Feb 2018 06:58:19 +0000 (07:58 +0100)]
fstab-generator: downgrade message when we can't canonicalize fstab entries (#8281)
Let's make this LOG_DEBUG, as this didn't used to be an issue, and
shouldn't really be still.
Replaces: #8132
Lennart Poettering [Mon, 26 Feb 2018 20:20:13 +0000 (21:20 +0100)]
Merge pull request #8284 from keszybz/gcc-warning-fixes
Gcc warning fixes
Zbigniew Jędrzejewski-Szmek [Mon, 26 Feb 2018 20:20:00 +0000 (21:20 +0100)]
tree-wide: use reallocarray instead of our home-grown realloc_multiply (#8279)
There isn't much difference, but in general we prefer to use the standard
functions. glibc provides reallocarray since version 2.26.
I moved explicit_bzero is configure test to the bottom, so that the two stdlib
functions are at the bottom.
Lennart Poettering [Mon, 26 Feb 2018 17:45:45 +0000 (18:45 +0100)]
sd-login: make use of _cleanup_close_ where possible
Lennart Poettering [Mon, 26 Feb 2018 17:45:28 +0000 (18:45 +0100)]
journal-upload: make use of safe_close() where appropriate
Lennart Poettering [Mon, 26 Feb 2018 17:34:49 +0000 (18:34 +0100)]
logind: make sure we don't trip up on half-initialized session devices
Fixes: #8035
Lennart Poettering [Mon, 26 Feb 2018 17:34:43 +0000 (18:34 +0100)]
logind: check file is device node before using .st_rdev
Lennart Poettering [Mon, 26 Feb 2018 17:34:13 +0000 (18:34 +0100)]
logind: let's pack a few struct fields we can pack
Lennart Poettering [Mon, 26 Feb 2018 17:33:51 +0000 (18:33 +0100)]
logind: fd 0 is a valid fd
Lennart Poettering [Mon, 26 Feb 2018 17:33:20 +0000 (18:33 +0100)]
logind: let's reduce one level of indentation
Lennart Poettering [Mon, 26 Feb 2018 17:33:05 +0000 (18:33 +0100)]
logind: propagate the right error, don't make up ENOMEM
Lennart Poettering [Mon, 26 Feb 2018 17:32:07 +0000 (18:32 +0100)]
logind: rework sd_eviocrevoke()
Let's initialize static variables properly and get rid of redundant
variables.
Lennart Poettering [Mon, 26 Feb 2018 17:31:06 +0000 (18:31 +0100)]
logind: trivial improvements
Just some addition whitespace, some additional assert()s, and removal of
redundant variables.
Lennart Poettering [Mon, 26 Feb 2018 12:46:58 +0000 (13:46 +0100)]
khash: try to detect broken AF_ALG support in centos kernels
Fixes: #8278
Zbigniew Jędrzejewski-Szmek [Mon, 26 Feb 2018 14:47:54 +0000 (15:47 +0100)]
core/unit: voidify one snprintf statement
One more follow-up for
f810b631cd.
Zbigniew Jędrzejewski-Szmek [Sun, 25 Feb 2018 20:59:04 +0000 (21:59 +0100)]
core/path: add one more assert
Zbigniew Jędrzejewski-Szmek [Sun, 25 Feb 2018 20:25:33 +0000 (21:25 +0100)]
basic/xattr-util: do not cast ssize_t to int
gcc warns about unitialized memory access because it notices that ssize_t which
is < 0 could be cast to positive int value. We know that this can't really
happen because only -1 can be returned, but OTOH, in principle a large
*positive* value cannot be cast properly. This is unlikely too, since xattrs
cannot be too large, but it seems cleaner to just use a size_t to return the
value and avoid the cast altoghter. This makes the code simpler and gcc is
happy too.
The following warning goes away:
[113/1502] Compiling C object 'src/basic/basic@sta/xattr-util.c.o'.
In file included from ../src/basic/alloc-util.h:28:0,
from ../src/basic/xattr-util.c:30:
../src/basic/xattr-util.c: In function ‘fd_getcrtime_at’:
../src/basic/macro.h:207:60: warning: ‘b’ may be used uninitialized in this function [-Wmaybe-uninitialized]
UNIQ_T(A,aq) < UNIQ_T(B,bq) ? UNIQ_T(A,aq) : UNIQ_T(B,bq); \
^
../src/basic/xattr-util.c:155:19: note: ‘b’ was declared here
usec_t a, b;
^
Zbigniew Jędrzejewski-Szmek [Sun, 25 Feb 2018 20:07:18 +0000 (21:07 +0100)]
basic/exec-util: use _exit() to return from child
Zbigniew Jędrzejewski-Szmek [Sun, 25 Feb 2018 16:26:22 +0000 (17:26 +0100)]
basic: shorten the code a bit in two places
gcc complains that len might be used unitialized, but afaict, this is not true.
Zbigniew Jędrzejewski-Szmek [Mon, 26 Feb 2018 14:42:27 +0000 (15:42 +0100)]
Merge pull request #8270 from dmedri/master
po: updates and basic notes for translators
Zbigniew Jędrzejewski-Szmek [Mon, 26 Feb 2018 11:31:08 +0000 (12:31 +0100)]
Merge pull request #8273 from yuwata/fix-test-execute
test: cleanups for test-execute
Yu Watanabe [Thu, 22 Feb 2018 00:02:12 +0000 (09:02 +0900)]
test: use "$$" to pass a literal dollar sign
Follow-up for
932329865741054f52dee2e7fc9bd6159b791fee.
Yu Watanabe [Thu, 22 Feb 2018 12:34:54 +0000 (21:34 +0900)]
test: use setup_fake_runtime_dir() in test-execute
Daniele Medri [Fri, 23 Feb 2018 19:33:48 +0000 (20:33 +0100)]
Some notes for translators
Zbigniew Jędrzejewski-Szmek [Fri, 23 Feb 2018 12:04:45 +0000 (13:04 +0100)]
systemd-sysv-install: avoid using ROOT variable from the environment
Fixes #8180.
Zbigniew Jędrzejewski-Szmek [Fri, 23 Feb 2018 11:49:15 +0000 (12:49 +0100)]
basic/virt: provide a nicer message is /proc/cpuinfo is not available
$ sudo systemd-run -p RootDirectory=/usr -E LD_LIBRARY_PATH=/lib/systemd/ -E SYSTEMD_LOG_LEVEL=debug /bin/systemd-detect-virt
Before
systemd-detect-virt[18498]: No virtualization found in DMI
systemd-detect-virt[18498]: No virtualization found in CPUID
systemd-detect-virt[18498]: Virtualization XEN not found, /proc/xen does not exist
systemd-detect-virt[18498]: This platform does not support /proc/device-tree
systemd-detect-virt[18498]: Failed to check for virtualization: No such file or directory
The first four lines are at debug level, so the user would only see that last
one usually, which is not very enlightening.
This now becomes:
systemd-detect-virt[21172]: No virtualization found in DMI
systemd-detect-virt[21172]: No virtualization found in CPUID
systemd-detect-virt[21172]: Virtualization XEN not found, /proc/xen does not exist
systemd-detect-virt[21172]: This platform does not support /proc/device-tree
systemd-detect-virt[21172]: /proc/cpuinfo not found, assuming no UML virtualization.
systemd-detect-virt[21172]: This platform does not support /proc/sysinfo
systemd-detect-virt[21172]: Found VM virtualization none
systemd-detect-virt[21172]: none
We do more checks, which is good too.
Giacomo Longo [Fri, 23 Feb 2018 18:57:13 +0000 (19:57 +0100)]
hwdb: Fix Chuwi Hi12 orientation sensor (#8266)
hwdb: Fix Chuwi Hi12 orientation sensor
Lennart Poettering [Fri, 23 Feb 2018 18:54:32 +0000 (19:54 +0100)]
Merge pull request #8258 from keszybz/log-issues
Fix some logging issues
Zbigniew Jędrzejewski-Szmek [Fri, 23 Feb 2018 12:29:03 +0000 (13:29 +0100)]
basic/log: add an assert that does not recurse into logging functions
Then it can be used in the asserts in logging functions without causing
infinite recursion. The error is just printed to stderr, it should be
good enough for the common case.
Lennart Poettering [Fri, 23 Feb 2018 11:20:38 +0000 (12:20 +0100)]
Merge pull request #8252 from keszybz/set-property-man
set-property man-page adjust-ments
Zbigniew Jędrzejewski-Szmek [Fri, 23 Feb 2018 10:12:19 +0000 (11:12 +0100)]
udev/net-id: check all snprintf return values
gcc-8 throws an error if it knows snprintf might truncate output and the
return value is ignored:
../src/udev/udev-builtin-net_id.c: In function 'dev_pci_slot':
../src/udev/udev-builtin-net_id.c:297:47: error: '%s' directive output may be truncated writing up to 255 bytes into a region of size between 0 and 4095 [-Werror=format-truncation=]
snprintf(str, sizeof str, "%s/%s/address", slots, dent->d_name);
^~
../src/udev/udev-builtin-net_id.c:297:17: note: 'snprintf' output between 10 and 4360 bytes into a destination of size 4096
snprintf(str, sizeof str, "%s/%s/address", slots, dent->d_name);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
Let's check all return values. This actually makes the code better, because there's
no point in trying to open a file when the name has been truncated, etc.
Zbigniew Jędrzejewski-Szmek [Fri, 23 Feb 2018 10:09:13 +0000 (11:09 +0100)]
udev/net-id: use _cleanup_
This fixes a minor memleak of 'address' if the file could not be read.
Zbigniew Jędrzejewski-Szmek [Fri, 23 Feb 2018 09:22:44 +0000 (10:22 +0100)]
systemctl: do not hint logs when a unit cannot be reloaded
The logs don't contain any additional information.
Zbigniew Jędrzejewski-Szmek [Thu, 22 Feb 2018 22:55:14 +0000 (23:55 +0100)]
basic/log: make sure header is printed correctly, add test
If log_do_header() was called with overly long parameters, it'd generate
improper output. Essentially, it'd be truncated at random point, in particular
missing a newline at the end, so it'd run with the next field, usually MESSAGE=.
log_do_header is called with parameters from compiled code (file name, lien
nubmer, etc), so in practice this was unlikely to ever be a problem, but it is
possible. In particular, if systemd was compiled from sources in some deeply
nested directory (which happens for example in mock and other build roots), the
filename could be very long.
As a safety measure, let's truncate all parameters to 256 bytes. So we have
5 fields which are 256 bytes (plus the field name prefix), and a few other
fields with fixed width. This must always fit in the 2048 byte buffer.
I don't think there's much gain in calculating the required length precisely,
since it's a lot of fields and a few bytes allocated on the stack don't matter.
Zbigniew Jędrzejewski-Szmek [Thu, 22 Feb 2018 22:45:27 +0000 (23:45 +0100)]
basic/log: fix confusion with parameters to log_dispatch_internal
log_dispatch_internal has only one caller where the extra_field/extra
params are not null: log_unit_full. When log_unit_full() was called,
when we got to log_dispatch_internal, our header would look like this:
PRIORITY=7
SYSLOG_FACILITY=3
CODE_FILE=../src/core/manager.c
CODE_LINE=2145
CODE_FUNC=manager_invoke_sigchld_event
USER_UNIT=gnome-terminal-server.service
65dffa7a3b984a6d9a46f0b8fb57710bUSER_INVOCATION_ID=
SYSLOG_IDENTIFIER=systemd
It took me a while to understand why I'm not seeing mangled messages in the
journal (after all, "" is a valid rvalue for log messages). The answer is that
journald rejects any field name which starts with a digit, and the MESSAGE_ID
that was used here starts with a digit. Hence, those lines would be silently
filtered out.
Daniele Medri [Fri, 23 Feb 2018 09:49:07 +0000 (10:49 +0100)]
po: update Italian translation
Peter Hutterer [Fri, 23 Feb 2018 08:36:45 +0000 (18:36 +1000)]
udev: don't assign INPUT_ID_MOUSE to a touchpad/joystick/touchscreen (#8259)
If a touchpad has MT axes only but not ABS_X/ABS_Y (DualShock 4 controller),
then we hit both the conditions is_touchpad and the later check for
!has_abs_axes here, assigning is_mouse and ID_INPUT_MOUSE later.
This is a bug, we historically only assigned either of of the pointing device
tags ID_INPUT_MOUSE/TOUCHPAD/JOYSTICK/TOUCHSCREEN, never multiple of them.
Note that we cannot just check for has_abs_axes and has_mt_coordinates because
the apple touch mouse has both. We really need to check if the device has
already been assigned something else.
https://bugs.freedesktop.org/show_bug.cgi?id=105050