]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
5 years agostring-util: put together strstrip() from skip_leading_chars() and delete_trailing_ch... 9210/head
Lennart Poettering [Wed, 6 Jun 2018 09:58:38 +0000 (11:58 +0200)] 
string-util: put together strstrip() from skip_leading_chars() and delete_trailing_chars()

5 years agoprocess-util: make use of delete_trailing_chars() in get_process_cmdline()
Lennart Poettering [Wed, 6 Jun 2018 09:58:18 +0000 (11:58 +0200)] 
process-util: make use of delete_trailing_chars() in get_process_cmdline()

5 years agoupdate TODO
Lennart Poettering [Wed, 6 Jun 2018 09:44:58 +0000 (11:44 +0200)] 
update TODO

5 years agotest: turn off the kernel's passive agressive /dev/kmsg ratelimit for our tests 9201/head
Lennart Poettering [Wed, 6 Jun 2018 08:17:01 +0000 (10:17 +0200)] 
test: turn off the kernel's passive agressive /dev/kmsg ratelimit for our tests

5 years agotest: make sure output of test TEST-03 test service ends up on console
Lennart Poettering [Wed, 6 Jun 2018 08:16:42 +0000 (10:16 +0200)] 
test: make sure output of test TEST-03 test service ends up on console

5 years agotest: disable QEMU based testing for TEST-16-EXTEND-TIMEOUT
Lennart Poettering [Tue, 5 Jun 2018 19:30:19 +0000 (21:30 +0200)] 
test: disable QEMU based testing for TEST-16-EXTEND-TIMEOUT

The test is heavily dependent on timeouts, and if we are run in
potentially very slow QEMU instances there's a good chance we'll miss
some which we normally wouldn't miss. Hence, let's test this one in
nspawn only. Given that the test is purely in service management it
shouldn't matter whether it runs in nspawn or qemu, hence keep running
it in nspawn, but don't bother with qemu.

Similar, do this for TEST-03-JOBS, too, which operates with relatively
short sleep times internally.

Fixes: #9123
5 years agoupdate TODO 9121/head
Lennart Poettering [Tue, 29 May 2018 14:20:46 +0000 (16:20 +0200)] 
update TODO

5 years agosd-event: use structure initialization instead of new0() where possible
Lennart Poettering [Wed, 6 Jun 2018 08:49:27 +0000 (10:49 +0200)] 
sd-event: use structure initialization instead of new0() where possible

5 years agocore: schedule time and timezone change events a bit before .timer elapsation events
Lennart Poettering [Tue, 29 May 2018 14:26:24 +0000 (16:26 +0200)] 
core: schedule time and timezone change events a bit before .timer elapsation events

We really should make sure that .timer units are dispatched while taking
the newest time/timezone data into account.

5 years agotime-util: introduce common implementation of TFD_TIMER_CANCEL_ON_SET client code
Lennart Poettering [Tue, 29 May 2018 10:55:33 +0000 (12:55 +0200)] 
time-util: introduce common implementation of TFD_TIMER_CANCEL_ON_SET client code

We now use pretty much the same code at three places, let's unify that.

5 years agocore: subscribe to /etc/localtime timezone changes and update timer elapsation accord...
Lennart Poettering [Mon, 28 May 2018 19:33:10 +0000 (21:33 +0200)] 
core: subscribe to /etc/localtime timezone changes and update timer elapsation accordingly

Fixes: #8233
This is our first real-life usecase for the new sd_event_add_inotify()
calls we just added.

5 years agocore: move destruction of old time event sources to manager_setup_time_change()
Lennart Poettering [Mon, 28 May 2018 19:32:03 +0000 (21:32 +0200)] 
core: move destruction of old time event sources to manager_setup_time_change()

It's a bit prettier that day as the function won't silently overwrite
any possibly pre-initialized field, and destroy it right before we
allocate a new event source.

5 years agoman: document the new sd_event_add_inotify() call
Lennart Poettering [Tue, 29 May 2018 13:59:26 +0000 (15:59 +0200)] 
man: document the new sd_event_add_inotify() call

5 years agosd-event: add test for the new sd_event_add_inotify() API
Lennart Poettering [Mon, 28 May 2018 15:25:14 +0000 (17:25 +0200)] 
sd-event: add test for the new sd_event_add_inotify() API

This tests a couple of corner cases of the sd-event API including
changing priorities of existing event sources, as well as overflow
conditions of the inotify queue.

5 years agosd-event: add new API for subscribing to inotify events
Lennart Poettering [Mon, 28 May 2018 14:26:50 +0000 (16:26 +0200)] 
sd-event: add new API for subscribing to inotify events

This adds a new call sd_event_add_inotify() which allows watching for
inotify events on specified paths.

sd-event will try to minimize the number of inotify fds allocated, and
will try to add file watches to the same inotify fd objects as far as
that's possible. Doing this kind of inotify object should optimize
behaviour in programs that watch a limited set of mostly independent
files as in most cases a single inotify object will suffice for watching
all files.

Traditionally, this kind of coalescing logic (i.e. that multiple event
sources are implemented on top of a single inotify object) was very hard
to do, as the inotify API had serious limitations: it only allowed
adding watches by path, and would implicitly merge watches installed on
the same node via different path, without letting the caller know about
whether such merging took place or not.

With the advent of O_PATH this issue can be dealt with to some point:
instead of adding a path to watch to an inotify object with
inotify_add_watch() right away, we can open the path with O_PATH first,
call fstat() on the fd, and check the .st_dev/.st_ino fields of that
against a list of watches we already have in place. If we find one we
know that the inotify_add_watch() will update the watch mask of the
existing watch, otherwise it will create a new watch. To make this
race-free we use inotify_add_watch() on the /proc/self/fd/ path of the
O_PATH fd, instead of the original path, so that we do the checking and
watch updating with guaranteed the same inode.

This approach let's us deal safely with inodes that may appear under
various different paths (due to symlinks, hardlinks, bind mounts, fs
namespaces). However it's not a perfect solution: currently the kernel
has no API for changing the watch mask of an existing watch -- unless
you have a path or fd to the original inode. This means we can "merge"
the watches of the same inode of multiple event sources correctly, but
we cannot "unmerge" it again correctly in many cases, as access to the
original inode might have been lost, due to renames, mount/unmount, or
deletions. We could in theory always keep open an O_PATH fd of the inode
to watch so that we can change the mask anytime we want, but this is
highly problematics, as it would consume too many fds (and in fact the
scarcity of fds is the reason why watch descriptors are a separate
concepts from fds) and would keep the backing mounts busy (wds do not
keep mounts busy, fds do). The current implemented approach to all this:
filter in userspace and accept that the watch mask on some inode might
be higher than necessary due to earlier installed event sources that
might have ceased to exist. This approach while ugly shouldn't be too
bad for most cases as the same inodes are probably wacthed for the same
masks in most implementations.

In order to implement priorities correctly a seperate inotify object is
allocated for each priority that is used. This way we get separate
per-priority event queues, of which we never dequeue more than a few
events at a time.

Fixes: #3982
5 years agosd-event: voidify more things
Lennart Poettering [Fri, 25 May 2018 15:09:26 +0000 (17:09 +0200)] 
sd-event: voidify more things

5 years agosd-event: propagate errors from source_set_pending() in all cases
Lennart Poettering [Fri, 25 May 2018 15:08:40 +0000 (17:08 +0200)] 
sd-event: propagate errors from source_set_pending() in all cases

5 years agosd-event: drop pending events when we turn off/on an event source
Lennart Poettering [Fri, 25 May 2018 15:06:39 +0000 (17:06 +0200)] 
sd-event: drop pending events when we turn off/on an event source

5 years agosd-event: use symbolic name for normal priority
Lennart Poettering [Fri, 25 May 2018 15:05:30 +0000 (17:05 +0200)] 
sd-event: use symbolic name for normal priority

5 years agosd-event: use structure initialization for epoll_event
Lennart Poettering [Fri, 25 May 2018 15:05:07 +0000 (17:05 +0200)] 
sd-event: use structure initialization for epoll_event

5 years agotests: tighten check for TEST-06-SELINUX dependencies a bit
Lennart Poettering [Tue, 5 Jun 2018 19:27:01 +0000 (21:27 +0200)] 
tests: tighten check for TEST-06-SELINUX dependencies a bit

As it turns out /usr/share/selinux/devel/ is now included in more RPMs
than just selinux-policy-devel (specifically container-selinux, which is
pulled in by various container related RPMs). Let's hence tighten the
dependency check a bit and look for systemd's .if file, which is what we
actually care about.

5 years agoman: fix typo
Michael Prokop [Tue, 5 Jun 2018 22:14:00 +0000 (00:14 +0200)] 
man: fix typo

5 years agoFix DPI for Logitech M185, M510, and M705. (#9182)
Peter Jones [Tue, 5 Jun 2018 22:15:58 +0000 (18:15 -0400)] 
Fix DPI for Logitech M185, M510, and M705. (#9182)

The DPI for three logitech models, the M185, M510, and M705, appear to
have always been different here than what logitech's given specs say.
With my M510, this results in jumpy behavior when transitioning from
fast motion to slow motion, making clicking specific buttons or
highlighting specific text *very* frustrating.

This patch changes those 3 mice to the published resolution, which
resolves the problem with my M510.  I have chosen to fix those 3 simply
because they were already grouped together, and all incorrect as
compared to logitech's web site, and as such I have not tried other mice
or investigated if there are other non-matching values in the database
as well.

Signed-off-by: Peter Jones <pjones@redhat.com>
5 years agoutil: tighten on_tty() check a bit, also check stderr
Lennart Poettering [Tue, 5 Jun 2018 19:53:54 +0000 (21:53 +0200)] 
util: tighten on_tty() check a bit, also check stderr

Let's detect output redirection a bit better, cover both stdout and
stderr.

Fixes: #9192
5 years agoMerge pull request #9148 from poettering/tidy-late
Lennart Poettering [Tue, 5 Jun 2018 22:00:58 +0000 (00:00 +0200)] 
Merge pull request #9148 from poettering/tidy-late

make PID watching a bit less expensive

5 years agocore: watch PIDs of scope units right after starting them 9148/head
Lennart Poettering [Thu, 31 May 2018 13:50:46 +0000 (15:50 +0200)] 
core: watch PIDs of scope units right after starting them

Scope units don't have a main or control process we can watch, hence
let's explicitly watch the PIDs contained in them early on, just to make
things more robust and have at least something to watch.

5 years agocore: rework how we track service and scope PIDs
Lennart Poettering [Thu, 31 May 2018 13:41:59 +0000 (15:41 +0200)] 
core: rework how we track service and scope PIDs

This reworks how systemd tracks processes on cgroupv1 systems where
cgroup notification is not reliable. Previously, whenever we had reason
to believe that new processes showed up or got removed we'd scan the
cgroup of the scope or service unit for new processes, and would tidy up
the list of PIDs previously watched. This scanning is relatively slow,
and does not scale well. With this change behaviour is changed: instead
of scanning for new/removed processes right away we do this work in a
per-unit deferred event loop job. This event source is scheduled at a
very low priority, so that it is executed when we have time but does not
starve other event sources. This has two benefits: this expensive work is
coalesced, if events happen in quick succession, and we won't delay
SIGCHLD handling for too long.

This patch basically replaces all direct invocation of
unit_watch_all_pids() in scope.c and service.c with invocations of the
new unit_enqueue_rewatch_pids() call which just enqueues a request of
watching/tidying up the PID sets (with one exception: in
scope_enter_signal() and service_enter_signal() we'll still do
unit_watch_all_pids() synchronously first, since we really want to know
all processes we are about to kill so that we can track them properly.

Moreover, all direct invocations of unit_tidy_watch_pids() and
unit_synthesize_cgroup_empty_event() are removed too, when the
unit_enqueue_rewatch_pids() call is invoked, as the queued job will run
those operations too.

All of this is done on cgroupsv1 systems only, and is disabled on
cgroupsv2 systems as cgroup-empty notifications are reliable there, and
we do not need SIGCHLD events to track processes there.

Fixes: #9138
5 years agocgroup: tiny log message tweak, say that we ignore one kind of failure
Lennart Poettering [Thu, 31 May 2018 13:40:54 +0000 (15:40 +0200)] 
cgroup: tiny log message tweak, say that we ignore one kind of failure

5 years agoMerge pull request #9158 from poettering/notify-auto-reload
Zbigniew Jędrzejewski-Szmek [Tue, 5 Jun 2018 11:51:07 +0000 (13:51 +0200)] 
Merge pull request #9158 from poettering/notify-auto-reload

trigger OnFailure= only if Restart= is not in effect

5 years agoman: use entities for fedora number and update URL
Zbigniew Jędrzejewski-Szmek [Tue, 5 Jun 2018 07:15:19 +0000 (09:15 +0200)] 
man: use entities for fedora number and update URL

Fedora 28 is out already, let's advertise it. While at it, drop "container"
from "f28container" — it's a subdirectory under /var/lib/machines, it's pretty
obvious that's it a container.

To make the switch easier in the future, define the number as an entity.

5 years agotravis: use Fedora 27 as a base image
Evegeny Vereshchagin [Mon, 4 Jun 2018 06:40:43 +0000 (06:40 +0000)] 
travis: use Fedora 27 as a base image

It was confirmed experimentally that Fedora 27 is more suitable
for running cov-build than Fedora 28:
https://github.com/systemd/systemd/issues/9186#issuecomment-394577877.

5 years agotravis: get python installed while building a docker image
Evegeny Vereshchagin [Sun, 3 Jun 2018 23:41:09 +0000 (23:41 +0000)] 
travis: get python installed while building a docker image

coverity.sh tries to run python, so it should be installed
to make everything work.

According to https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3#Current_status,
python seems to be the right name of the package.

Closes https://github.com/systemd/systemd/issues/9186.

5 years agoMerge pull request #9184 from msekletar/travis-followups
Evgeny Vereshchagin [Mon, 4 Jun 2018 17:53:20 +0000 (20:53 +0300)] 
Merge pull request #9184 from msekletar/travis-followups

Travis CI follow ups

5 years agotravis: drop ccache requirement 9184/head
Michal Sekletar [Mon, 4 Jun 2018 17:44:07 +0000 (19:44 +0200)] 
travis: drop ccache requirement

5 years agotravis: DOCKER_REPOSITORY is no longer set. Don't require it.
Michal Sekletar [Mon, 4 Jun 2018 17:37:19 +0000 (19:37 +0200)] 
travis: DOCKER_REPOSITORY is no longer set. Don't require it.

5 years agotravis: use Travis CI only for running scheduled Coverity scans
Michal Sekletar [Fri, 1 Jun 2018 07:56:13 +0000 (09:56 +0200)] 
travis: use Travis CI only for running scheduled Coverity scans

Building and testing of systemd on Fedora Rawhide is now handled by
dedicated Fedora CI. We don't need to duplicate this in Travis CI.

5 years agoconf-parser: fix memleak (#9177)
Yu Watanabe [Mon, 4 Jun 2018 12:18:28 +0000 (21:18 +0900)] 
conf-parser: fix memleak (#9177)

Fixes CID#1391437.

Closes #9180.

5 years agoUpdate 60-sensor.hwdb
Marcel Hoppe [Thu, 17 May 2018 18:17:47 +0000 (20:17 +0200)] 
Update 60-sensor.hwdb

add chuwi hibook with newer bios version

[zj: remove duplicate matrix]

5 years agobasic/log: add the log_struct terminator to macro
Zbigniew Jędrzejewski-Szmek [Mon, 4 Jun 2018 10:59:22 +0000 (12:59 +0200)] 
basic/log: add the log_struct terminator to macro

This way all callers do not need to specify it.
Exhaustively tested by running test-log under valgrind ;)

5 years agoMerge pull request #9176 from keszybz/flags-set
Lennart Poettering [Mon, 4 Jun 2018 11:45:29 +0000 (13:45 +0200)] 
Merge pull request #9176 from keszybz/flags-set

Macro to check if flags are set

5 years agoMerge pull request #9167 from keszybz/ellipsization
Lennart Poettering [Mon, 4 Jun 2018 11:45:03 +0000 (13:45 +0200)] 
Merge pull request #9167 from keszybz/ellipsization

Ellipsization fixes based on unit-testing and fuzzing

5 years agoMerge pull request #9147 from keszybz/runtime-enablement
Lennart Poettering [Mon, 4 Jun 2018 09:58:21 +0000 (11:58 +0200)] 
Merge pull request #9147 from keszybz/runtime-enablement

Runtime enablement

5 years agobasic/path-util: use FLAGS_SET in one more place 9176/head
Zbigniew Jędrzejewski-Szmek [Mon, 4 Jun 2018 08:29:23 +0000 (10:29 +0200)] 
basic/path-util: use FLAGS_SET in one more place

5 years agoAdd macro for checking if some flags are set
Zbigniew Jędrzejewski-Szmek [Fri, 20 Apr 2018 13:36:20 +0000 (15:36 +0200)] 
Add macro for checking if some flags are set

This way we don't need to repeat the argument twice.
I didn't replace all instances. I think it's better to leave out:
- asserts
- comparisons like x & y == x, which are mathematically equivalent, but
  here we aren't checking if flags are set, but if the argument fits in the
  flags.

5 years agococcinelle: add option to make changes in place
Zbigniew Jędrzejewski-Szmek [Fri, 20 Apr 2018 13:21:06 +0000 (15:21 +0200)] 
coccinelle: add option to make changes in place

5 years agococcinelle: run spatch just on version-controlled files
Zbigniew Jędrzejewski-Szmek [Fri, 20 Apr 2018 13:07:42 +0000 (15:07 +0200)] 
coccinelle: run spatch just on version-controlled files

Also, allow run-cocinnelle.sh to be started from any directory.

Unfortunately set -x does not work nicely anymore, because the list is
too verbose. Replace it by an echo line.

5 years agocore: go to failure state if the main service process fails and RemainAfterExit=yes...
Lennart Poettering [Mon, 4 Jun 2018 09:35:25 +0000 (11:35 +0200)] 
core: go to failure state if the main service process fails and RemainAfterExit=yes (#9159)

Previously, we'd not care about failures that were seen earlier and
remain in "exited" state. This could be triggered if the main process of
a service failed while ExecStartPost= was still running, as in that case
we'd not immediately act on the main process failure because we needed
to wait for ExecStartPost= to finish, before acting on it.

Fixes: #8929
5 years agologin: log session state "closing" (as well as New/Removed)
Alan Jenkins [Fri, 1 Jun 2018 18:03:21 +0000 (19:03 +0100)] 
login: log session state "closing" (as well as New/Removed)

Let's show a message at the time of logout i.e. entering the "closing"
state, not just e.g. once the user closes `tmux` and the session can be
removed completely.  (At least when KillUserProcesses=no applies.  My
thinking was we can spare the log noise if we're killing the processes
anyway).

These are two independent events.  I think the logout event is quite
significant in the session lifecycle.  It will be easier for a user who
does not know logind details to understand why "Removed session" doesn't
appear at logout time, if we have a specific message we can show at this
time :).

Tested using tmux and KillUserProcesses=no.  I can also confirm the extra
message doesn't show when using KillUserProcesses=yes.  Maybe it looks a
bit mysterious when you use KillOnlyUsers= / KillExcludeUsers=, but
hopefully not alarmingly so.

I was looking at systemd-logind messages on my system, because I can
reproduce two separate problems with Gnome on Fedora 28 where
sessions are unexpectedly in state "closing".  (One where a GUI session
limps along in a degraded state[1], and another where spice-vdagent is left
alive after logout, keeping the session around[2]).  It logged when
sessions were created and removed, but it didn't log when the session
entered the "closing" state.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1583240#c1
[2] https://bugzilla.redhat.com/show_bug.cgi?id=1583261

Closes #9096

5 years agoMerge pull request #9173 from jwrdegoede/hwdb-sensors3
Zbigniew Jędrzejewski-Szmek [Mon, 4 Jun 2018 09:02:25 +0000 (11:02 +0200)] 
Merge pull request #9173 from jwrdegoede/hwdb-sensors3

Hwdb sensors3

5 years agoMerge pull request #9149 from yuwata/fix-9107
Zbigniew Jędrzejewski-Szmek [Mon, 4 Jun 2018 08:13:40 +0000 (10:13 +0200)] 
Merge pull request #9149 from yuwata/fix-9107

path-util: introduce path_simplify()

5 years agotest: fix function name
Yu Watanabe [Sun, 3 Jun 2018 16:57:21 +0000 (01:57 +0900)] 
test: fix function name

5 years agoman: RuntimeDirectory= or friends accept dot contained paths 9149/head
Yu Watanabe [Sun, 3 Jun 2018 15:49:41 +0000 (00:49 +0900)] 
man: RuntimeDirectory= or friends accept dot contained paths

5 years agoconf-parser: remove redundant utf8-validity check
Yu Watanabe [Sun, 3 Jun 2018 15:36:46 +0000 (00:36 +0900)] 
conf-parser: remove redundant utf8-validity check

5 years agoconf-parse: use free_and_replace()
Yu Watanabe [Sun, 3 Jun 2018 15:30:36 +0000 (00:30 +0900)] 
conf-parse: use free_and_replace()

Also removes unnecessary empty lines.

5 years agoconf-parser: reject utf8-invalid lines
Yu Watanabe [Sun, 3 Jun 2018 15:30:18 +0000 (00:30 +0900)] 
conf-parser: reject utf8-invalid lines

5 years agotest: add test for trailing dot in WorkingDirectory= and RuntimeDirectory=
Yu Watanabe [Thu, 31 May 2018 14:59:30 +0000 (23:59 +0900)] 
test: add test for trailing dot in WorkingDirectory= and RuntimeDirectory=

5 years agoload-fragment: use path_simplify_and_warn() where applicable
Yu Watanabe [Sun, 3 Jun 2018 14:59:02 +0000 (23:59 +0900)] 
load-fragment: use path_simplify_and_warn() where applicable

5 years agoconf-parse: use path_simplify_and_warn() in config_parse_path()
Yu Watanabe [Sun, 3 Jun 2018 14:57:30 +0000 (23:57 +0900)] 
conf-parse: use path_simplify_and_warn() in config_parse_path()

5 years agopath-util: introduce path_simplify_and_warn()
Yu Watanabe [Fri, 1 Jun 2018 05:11:37 +0000 (14:11 +0900)] 
path-util: introduce path_simplify_and_warn()

5 years agopath-util: make path_make_relative() support path including dots
Yu Watanabe [Sun, 3 Jun 2018 14:54:32 +0000 (23:54 +0900)] 
path-util: make path_make_relative() support path including dots

5 years agopath-util: introduce path_simplify()
Yu Watanabe [Thu, 31 May 2018 14:39:31 +0000 (23:39 +0900)] 
path-util: introduce path_simplify()

The function is similar to path_kill_slashes() but also removes
initial './', trailing '/.', and '/./' in the path.
When the second argument of path_simplify() is false, then it
behaves as the same as path_kill_slashes(). Hence, this also
replaces path_kill_slashes() with path_simplify().

5 years agoAdd SPDX license identifier. 9165/head
Susant Sahani [Sun, 3 Jun 2018 02:50:49 +0000 (08:20 +0530)] 
Add SPDX license identifier.

5 years agonetworkd: introduce netdev "Netdevsim" Driver
Susant Sahani [Sat, 2 Jun 2018 13:06:33 +0000 (18:36 +0530)] 
networkd: introduce netdev "Netdevsim" Driver

This "netdevsim" as implied by the name is a tool for network developers and is a simulator.
This simulated networking device is used for testing various networking APIs and at this time
is particularly focused on testing hardware offloading related interfaces.

5 years agonetwork: avoid temporary variables for parsing, use TAKE_PTR (#9166)
Zbigniew Jędrzejewski-Szmek [Sun, 3 Jun 2018 02:18:23 +0000 (04:18 +0200)] 
network: avoid temporary variables for parsing, use TAKE_PTR (#9166)

We don't need a temporary variable when parsing just one number, because
our parsing functions do not touch the output variable on error.

TAKE_PTR is more expressive than 'n = NULL'.

6 years agotest-ellipsize: add tests for ellipsize_mem, fix bugs 9167/head
Zbigniew Jędrzejewski-Szmek [Sat, 2 Jun 2018 15:08:46 +0000 (17:08 +0200)] 
test-ellipsize: add tests for ellipsize_mem, fix bugs

First, ellipsize() and ellipsize_mem() should not read past the input
buffer. Those functions take an explicit length for the input data, so they
should not assume that the buffer is terminated by a nul.

Second, ellipsization was off in various cases where wide on multi-byte
characters were used.

We had some basic test for ellipsize(), but apparently it wasn't enough to
catch more serious cases.

Should fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=8686.

6 years agobasic/string-util: make ellipsize() inline
Zbigniew Jędrzejewski-Szmek [Sat, 2 Jun 2018 15:52:07 +0000 (17:52 +0200)] 
basic/string-util: make ellipsize() inline

Once the redundant check is removed, it's a very simple wrapper around
ellipsize_mem().

6 years agoMerge pull request #9156 from shr-project/jansa/gcc8
Zbigniew Jędrzejewski-Szmek [Sat, 2 Jun 2018 14:18:59 +0000 (16:18 +0200)] 
Merge pull request #9156 from shr-project/jansa/gcc8

time-util: fix build with gcc8 -Werror=format-truncation=

6 years agohwdb: Add accelerometer orientation quirk for the Onda V891w tablet 9173/head
Hans de Goede [Sat, 2 Jun 2018 13:47:27 +0000 (15:47 +0200)] 
hwdb: Add accelerometer orientation quirk for the Onda V891w tablet

Add accelerometer orientation quirk for the Onda V891w tablet, this
does a partial match on the BIOS version because the other strings are
somewhat generic.

The BIOS match is done for both the W89* and D89* BIOS versions which are
for the Windows only and Dual boot versions respectively.

6 years agohwdb: Add accelerometer orientation quirk for the Nuvision/TMAX TM800W560L
Hans de Goede [Sat, 2 Jun 2018 10:09:43 +0000 (12:09 +0200)] 
hwdb: Add accelerometer orientation quirk for the Nuvision/TMAX TM800W560L

Add accelerometer orientation quirk for the Nuvision/TMAX TM800W560L
8" Windows signature edition tablet.

6 years agonetdev: fix parser for VRF.Table=
Yu Watanabe [Fri, 1 Jun 2018 09:38:04 +0000 (18:38 +0900)] 
netdev: fix parser for VRF.Table=

This effectively reverts f98dd1e70750f09a85d9236ad3621b249ad59629 (#6704).

Fixes #9150.

6 years agohwdb: Add accelerometer orientation quirk for the Archos 80 Cesium tablet.
Hans de Goede [Mon, 28 May 2018 14:39:16 +0000 (16:39 +0200)] 
hwdb: Add accelerometer orientation quirk for the Archos 80 Cesium tablet.

Add accelerometer orientation quirk for the Archos 80 Cesium 8" windows
tablet.

6 years agohwdb: Extend Point of View TAB-P800W accelerometer quirk for another version
Hans de Goede [Sun, 20 May 2018 15:36:13 +0000 (17:36 +0200)] 
hwdb: Extend Point of View TAB-P800W accelerometer quirk for another version

Extend the accelerometer quirk for the Point of View TAB-P800W to also
match the BIOS info on the Point of View TAB-P800W (v2.0).

6 years agotest-time-util: print names of test functions 9156/head
Zbigniew Jędrzejewski-Szmek [Sat, 2 Jun 2018 08:22:10 +0000 (10:22 +0200)] 
test-time-util: print names of test functions

This makes it easier to find the right spot in the long output.

6 years agotime-util: fix build with gcc8 -Werror=format-truncation=
Martin Jansa [Fri, 1 Jun 2018 15:22:28 +0000 (15:22 +0000)] 
time-util: fix build with gcc8 -Werror=format-truncation=

* it fails with gcc8 when -O1 or -Os is used (and -ftree-vrp which is added by -O2 and higher isn't used)

../git/src/basic/time-util.c: In function 'format_timespan':
../git/src/basic/time-util.c:508:46: error: '%0*llu' directive output between 1 and 2147483647 bytes may cause result to exceed 'INT_MAX' [-Werror=format-truncation=]
                                              "%s"USEC_FMT".%0*"PRI_USEC"%s",
                                              ^~~~
../git/src/basic/time-util.c:508:60: note: format string is defined here
                                              "%s"USEC_FMT".%0*"PRI_USEC"%s",
../git/src/basic/time-util.c:508:46: note: directive argument in the range [0, 18446744073709551614]
                                              "%s"USEC_FMT".%0*"PRI_USEC"%s",
                                              ^~~~
../git/src/basic/time-util.c:507:37: note: 'snprintf' output 4 or more bytes (assuming 2147483651) into a destination of size 4294967295
                                 k = snprintf(p, l,
                                     ^~~~~~~~~~~~~~
                                              "%s"USEC_FMT".%0*"PRI_USEC"%s",
                                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                              p > buf ? " " : "",
                                              ~~~~~~~~~~~~~~~~~~~
                                              a,
                                              ~~
                                              j,
                                              ~~
                                              b,
                                              ~~
                                              table[i].suffix);
                                              ~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors

[zj: change 'char' to 'signed char']

6 years agobasic: set errno in raw_clone() on sparc
Mike Gilbert [Thu, 31 May 2018 03:06:33 +0000 (23:06 -0400)] 
basic: set errno in raw_clone() on sparc

sparc sets the carry bit when a syscall fails. Use this information to
set errno and return -1 as appropriate.

The added test case calls raw_clone() with flags known to be invalid
according to the clone(2) manpage.

6 years agoMerge pull request #9018 from poettering/get-process-comm-is-print
Zbigniew Jędrzejewski-Szmek [Fri, 1 Jun 2018 21:34:53 +0000 (23:34 +0200)] 
Merge pull request #9018 from poettering/get-process-comm-is-print

some extra safety checks for get_process_comm()

6 years agoprocess-util: also filter non-printable characters in get_process_com() 9018/head
Lennart Poettering [Thu, 17 May 2018 01:50:35 +0000 (21:50 -0400)] 
process-util: also filter non-printable characters in get_process_com()

We already do that in get_process_cmdline(), which is very similar in
behaviour otherwise. Hence, let's be safe and also filter them in
get_process_comm(). Let's try to retain as much information as we can
though and escape rather than suppress unprintable characters. Let's not
increase comm names beyond the kernel limit on such names however.

Also see discussion about this here:

https://marc.info/?l=linux-api&m=152649570404881&w=2

6 years agostring-util: tweak cellescape() a bit
Lennart Poettering [Fri, 1 Jun 2018 19:45:23 +0000 (21:45 +0200)] 
string-util: tweak cellescape() a bit

For short buffer sizes cellescape() was a bit wasteful, as it might
suffice to to drop a single character to find enough place for the full
four byte ellipsis, if that one character was a four character escape.
With this rework we'll guarantee to drop the minimum number of
characters from the end to fit in the ellipsis.

If the buffers we write to are large this doesn't matter much. However,
if they are short (as they are when talking about the process comm
field) then it starts to matter that we put as much information as we
can in the space we get.

6 years agoescape: add an explanatory comment about buffer sizes
Lennart Poettering [Fri, 1 Jun 2018 19:45:06 +0000 (21:45 +0200)] 
escape: add an explanatory comment about buffer sizes

6 years agomissing: define kernel internal limit TASK_COMM_LEN in userspace too
Lennart Poettering [Fri, 1 Jun 2018 19:43:43 +0000 (21:43 +0200)] 
missing: define kernel internal limit TASK_COMM_LEN in userspace too

We already use it at two places, and we are about to add one too.
Arbitrary literally hardcoded limits suck.

6 years agoprocess-util: mention that wait_for_terminate_with_timeout() should be called with...
Lennart Poettering [Thu, 17 May 2018 02:14:59 +0000 (22:14 -0400)] 
process-util: mention that wait_for_terminate_with_timeout() should be called with SIGCHLD blocked

6 years agoupdate NEWS to explain new OnFailure= behaviour 9158/head
Lennart Poettering [Fri, 1 Jun 2018 17:13:38 +0000 (19:13 +0200)] 
update NEWS to explain new OnFailure= behaviour

6 years agocore: don't trigger OnFailure= deps when a unit is going to restart
Lennart Poettering [Fri, 1 Jun 2018 17:06:19 +0000 (19:06 +0200)] 
core: don't trigger OnFailure= deps when a unit is going to restart

This adds a flags parameter to unit_notify() which can be used to pass
additional notification information to the function. We the make the old
reload_failure boolean parameter one of these flags, and then add a new
flag that let's unit_notify() if we are configured to restart the
service.

Note that this adjusts behaviour of systemd to match what the docs say.

Fixes: #8398
6 years agocore: when we can't enqueue OnFailure= job show full error message
Lennart Poettering [Fri, 1 Jun 2018 17:04:37 +0000 (19:04 +0200)] 
core: when we can't enqueue OnFailure= job show full error message

Let's ask for the full error message and show it, there's really no
reason to just show the crappy errno error.

6 years agonetworkd: enable to set IFF_ALLMULTI to network device (#9146)
Susant Sahani [Fri, 1 Jun 2018 14:22:12 +0000 (19:52 +0530)] 
networkd: enable to set IFF_ALLMULTI to network device (#9146)

networkd: allow setting set IFF_ALLMULTI flag on network devices

6 years agoMinor spelling error - "Our of"->"Out of"
Ian Miell [Fri, 1 Jun 2018 12:41:05 +0000 (13:41 +0100)] 
Minor spelling error - "Our of"->"Out of"

6 years agosystemctl: when removing enablement or mask symlinks, cover both /run and /etc 9147/head
Zbigniew Jędrzejewski-Szmek [Thu, 31 May 2018 13:28:07 +0000 (15:28 +0200)] 
systemctl: when removing enablement or mask symlinks, cover both /run and /etc

'systemctl disable --runtime' would disable a unit, but only if it was enabled
with '--runtime', and silently do nothing if the unit was enabled persistently.
And similarly 'systemctl disable' would do nothing if the unit was enabled in
/run. This just doesn't seem useful.

This pathch changes enable/disable and mask/unmask to be asymmetrical. enable
and mask create symlinks in /etc or /run, depending on whether --runtime was
specified. disable and unmask remove symlinks from both locations. --runtime
cannot be specified for the disable and unmask verbs.

The advantage is that 'disable' now means that the unit is disabled, period.
And similarly for 'unmask', all masks are removed.

Similarly for preset and preset-all, they now cannot be called with --runtime,
and are asymmetrical: when they enable a unit, symlinks are created in /etc.
When they disable a unit, all symlinks are nuked.

$ systemctl --root=/ enable bluetooth
Created symlink /etc/systemd/system/dbus-org.bluez.service → /usr/lib/systemd/system/bluetooth.service.
Created symlink /etc/systemd/system/bluetooth.target.wants/bluetooth.service → /usr/lib/systemd/system/bluetooth.service.
$ systemctl --root=/ --runtime enable bluetooth
Created symlink /run/systemd/system/dbus-org.bluez.service → /usr/lib/systemd/system/bluetooth.service.
Created symlink /run/systemd/system/bluetooth.target.wants/bluetooth.service → /usr/lib/systemd/system/bluetooth.service.
$ systemctl --root=/ disable bluetooth
Removed /run/systemd/system/bluetooth.target.wants/bluetooth.service.
Removed /run/systemd/system/dbus-org.bluez.service.
Removed /etc/systemd/system/bluetooth.target.wants/bluetooth.service.
Removed /etc/systemd/system/dbus-org.bluez.service.
$ systemctl --root=/ disable --runtime bluetooth
--runtime cannot be used with disable

$ systemctl --root=/ mask --runtime bluetooth
Created symlink /run/systemd/system/bluetooth.service → /dev/null.
$ systemctl --root=/ mask bluetooth
Created symlink /etc/systemd/system/bluetooth.service → /dev/null.
$ systemctl --root=/ unmask bluetooth
Removed /run/systemd/system/bluetooth.service.
Removed /etc/systemd/system/bluetooth.service.
$ systemctl --root=/ unmask --runtime bluetooth
--runtime cannot be used with unmask

$ systemctl --root=/ --runtime enable bluetooth
Created symlink /run/systemd/system/dbus-org.bluez.service → /usr/lib/systemd/system/bluetooth.service.
Created symlink /run/systemd/system/bluetooth.target.wants/bluetooth.service → /usr/lib/systemd/system/bluetooth.service.
$ systemctl --root=/ enable bluetooth
Created symlink /etc/systemd/system/dbus-org.bluez.service → /usr/lib/systemd/system/bluetooth.service.
Created symlink /etc/systemd/system/bluetooth.target.wants/bluetooth.service → /usr/lib/systemd/system/bluetooth.service.
$ systemctl --root=/ preset bluetooth
Removed /run/systemd/system/bluetooth.target.wants/bluetooth.service.
Removed /run/systemd/system/dbus-org.bluez.service.
Removed /etc/systemd/system/bluetooth.target.wants/bluetooth.service.
Removed /etc/systemd/system/dbus-org.bluez.service.
$ systemctl --root=/ preset --runtime bluetooth
--runtime cannot be used with preset

$ systemctl preset-all --runtime
--runtime cannot be used with preset-all

6 years agosystemctl: remove newlines
Zbigniew Jędrzejewski-Szmek [Thu, 31 May 2018 13:32:49 +0000 (15:32 +0200)] 
systemctl: remove newlines

This file is long enough already, we don't need extra vertical whitespace.

6 years agoFix reporting of enabled-runtime units
Zbigniew Jędrzejewski-Szmek [Thu, 31 May 2018 13:16:06 +0000 (15:16 +0200)] 
Fix reporting of enabled-runtime units

We would always report them as "enabled", because path_is_config() includes
/run, despite the name.

Fixes #9122.

6 years agocore/dbus: simplify bus_done_{api,system} functions
Zbigniew Jędrzejewski-Szmek [Wed, 30 May 2018 11:22:18 +0000 (11:22 +0000)] 
core/dbus: simplify bus_done_{api,system} functions

destroy_bus already has a check for NULL, so we don't need to repeat it here.

6 years agojournal: small simplification
Zbigniew Jędrzejewski-Szmek [Tue, 29 May 2018 15:01:53 +0000 (17:01 +0200)] 
journal: small simplification

6 years agoefi: explicitly cast physical address to UINTN when converting to/from pointers 5593/head
Lennart Poettering [Tue, 29 May 2018 15:12:39 +0000 (17:12 +0200)] 
efi: explicitly cast physical address to UINTN when converting to/from pointers

UINTN is the integer type equalling the native ptr size. Let's fix the
casting warnings described in #7788 by casting the the pointers and
values to this type first. That way we cast integers to the right size
first before turning them into pointers, and pointers are first
covnerted to integers of the right size before converting them into
integers.

Not tested, since I lack i386 EFI systems, but I think this is simple
enough to be correct event without testing.

Fixes: #7788
6 years agobuild-sys: Add option to link systemctl statically
Felipe Sateler [Tue, 22 May 2018 19:08:57 +0000 (15:08 -0400)] 
build-sys: Add option to link systemctl statically

Systemctl is special because it is required for many tasks that may need to
be performed when the system is not fully configured and/or partially
broken:

1. Installing/Uninstalling services during OS installs and upgrades
2. Shutting down the system

Therefore reduce the number of dependencies that systemctl pulls in, by
not linking to systemd-shared. This brings a bit of resilience to
systemctl (and its aliases shutdown, reboot, etc), by linking against
less external libraries.

Because this extra resilience comes at a cost of approximately 580 KB
extra space, this is done behind a meson build option.

6 years agoMerge pull request #9014 from keszybz/fuzz-journal-remote
Lennart Poettering [Thu, 31 May 2018 13:33:44 +0000 (15:33 +0200)] 
Merge pull request #9014 from keszybz/fuzz-journal-remote

A fuzzer for journal-remote

6 years agojournal-remote: do not send _BOOT_ID twice 9014/head
Zbigniew Jędrzejewski-Szmek [Sun, 27 May 2018 17:03:03 +0000 (19:03 +0200)] 
journal-remote: do not send _BOOT_ID twice

Also remove the comma from the comment everywhere, I think the comma
unnecessarilly put emphasis on the clause after the comma.

Fixes #9090.

Reproducer:
systemd-journal-remote --split-mode=none -o /tmp/msg6.journal --trust=all --listen-http=8080
systemd-journal-upload -u http://localhost:8080
journalctl --file /tmp/msg6.journal -o verbose -n1

6 years agojournal-remote: parse the _BOOT_ID field and use the value when writing entries
Zbigniew Jędrzejewski-Szmek [Sun, 27 May 2018 09:35:07 +0000 (11:35 +0200)] 
journal-remote: parse the _BOOT_ID field and use the value when writing entries

The boot id is stored twice, and different code paths use either one or the
other. So we need to store it both in the header and as a field for full
compatibility.

6 years agojournal: allow boot_id to be passed to journal_append_entry()
Zbigniew Jędrzejewski-Szmek [Sun, 27 May 2018 09:27:58 +0000 (11:27 +0200)] 
journal: allow boot_id to be passed to journal_append_entry()

In this commit, this is done only in testing code, i.e. there is
no functional change apart from tests.

6 years agojournal: remove unused args from journal_file_copy_entry()
Zbigniew Jędrzejewski-Szmek [Sun, 27 May 2018 09:08:44 +0000 (11:08 +0200)] 
journal: remove unused args from journal_file_copy_entry()

6 years agoshared/logs-show: be more careful before using a _SOURCE_REALTIME_TIMESTAMP entry
Zbigniew Jędrzejewski-Szmek [Thu, 24 May 2018 06:37:47 +0000 (08:37 +0200)] 
shared/logs-show: be more careful before using a _SOURCE_REALTIME_TIMESTAMP entry

journalctl -o short would display those entries, but journalctl -o short-full
would refuse. If the entry is bad, just fall back to the receive-side realtime
timestamp like we would if it was completely missing.

6 years agojournal: refuse an entry with invalid timestamp fields
Zbigniew Jędrzejewski-Szmek [Thu, 24 May 2018 11:11:12 +0000 (13:11 +0200)] 
journal: refuse an entry with invalid timestamp fields

The journal verification functions would reject such an entry. It would probably
still display fine (because we prefer _SOURCE_REALTIME_TIMESTAMP= if present), but
it seems wrong to create an entry that would not pass verification.