]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
5 years agoMerge pull request #9165 from ssahani/networkd-netdevsim
Lennart Poettering [Thu, 7 Jun 2018 14:56:32 +0000 (16:56 +0200)] 
Merge pull request #9165 from ssahani/networkd-netdevsim

networkd: introduce netdev "Netdevsim" Driver

5 years agoCODING_STYLE: allow c99-style mixed code and declarations
Zbigniew Jędrzejewski-Szmek [Thu, 7 Jun 2018 13:08:02 +0000 (15:08 +0200)] 
CODING_STYLE: allow c99-style mixed code and declarations

We already allowed variables to be declared in the middle of a function
(whenever a new scope was opened), so this isn't such a big change. Sometimes
we would open a scope just to work around this prohibition.

But sometimes the code can be much clearer if the variable is declared
somewhere in the middle of a scope, in particular if the declaration is
combined with initialization or acquisition of some resources. So let's allow
this, but keep things in the old style, unless there's a good reason to move
the variable declaration to a different place.

5 years agoMerge pull request #9222 from poettering/code-quality-docs
Zbigniew Jędrzejewski-Szmek [Thu, 7 Jun 2018 14:30:56 +0000 (16:30 +0200)] 
Merge pull request #9222 from poettering/code-quality-docs

let's document the code quality tools we have set up

5 years agoHACKING: link up CODE_QUALITY.md 9222/head
Lennart Poettering [Thu, 7 Jun 2018 14:26:00 +0000 (16:26 +0200)] 
HACKING: link up CODE_QUALITY.md

5 years agodoc: add a list of code quality tools we have set up
Lennart Poettering [Thu, 7 Jun 2018 13:07:23 +0000 (15:07 +0200)] 
doc: add a list of code quality tools we have set up

Also, as a reminder all of these exist to myself.

5 years agotools: make various scripts find the top-levle git dir automatically
Lennart Poettering [Thu, 7 Jun 2018 13:07:14 +0000 (15:07 +0200)] 
tools: make various scripts find the top-levle git dir automatically

5 years agohwdb: HP ZBook Studio G4 wireless switch
Alessandro Casale [Thu, 7 Jun 2018 09:43:59 +0000 (11:43 +0200)] 
hwdb: HP ZBook Studio G4 wireless switch

5 years agoman: update url to latest 802.1AB (2016) standard
Stefan Schweter [Wed, 6 Jun 2018 21:24:33 +0000 (23:24 +0200)] 
man: update url to latest 802.1AB (2016) standard

5 years agoMerge pull request #9208 from keszybz/async-callback-memleak
Lennart Poettering [Thu, 7 Jun 2018 08:29:05 +0000 (10:29 +0200)] 
Merge pull request #9208 from keszybz/async-callback-memleak

Async callback memleak fix and documentation cleanups

5 years agoMerge pull request #9214 from poettering/systemctl-get-processes-fix
Lennart Poettering [Thu, 7 Jun 2018 07:17:01 +0000 (09:17 +0200)] 
Merge pull request #9214 from poettering/systemctl-get-processes-fix

two small fixes for systemctl's process tree display

5 years agohwdb: Logitech Anywhere MX wheel data (#9203)
Ivan Shapovalov [Wed, 6 Jun 2018 22:51:42 +0000 (01:51 +0300)] 
hwdb: Logitech Anywhere MX wheel data (#9203)

5 years agotest-bus-util: add a test for destroy callbacks 9208/head
Zbigniew Jędrzejewski-Szmek [Wed, 6 Jun 2018 20:58:03 +0000 (22:58 +0200)] 
test-bus-util: add a test for destroy callbacks

5 years agoshared/bus-util: use the new cleanup functionality to avoid a memleak
Zbigniew Jędrzejewski-Szmek [Wed, 6 Jun 2018 09:12:25 +0000 (11:12 +0200)] 
shared/bus-util: use the new cleanup functionality to avoid a memleak

If the async callbacks didn't get a chance to finish properly, we'd leak
memory.

The output from test-bus-util with additional log line in the callbacks to show
what is happening:

$ build/test-bus-util

/* test_name_async (0) */
Bus test-bus: changing state UNSET → OPENING
Bus test-bus: changing state OPENING → AUTHENTICATING
Bus test-bus: changing state AUTHENTICATING → HELLO
Sent message type=method_call sender=n/a destination=org.freedesktop.DBus path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=Hello cookie=1 reply_cookie=0 signature=n/a error-name=n/a error-message=n/a
Sent message type=method_call sender=n/a destination=org.freedesktop.DBus path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=RequestName cookie=2 reply_cookie=0 signature=su error-name=n/a error-message=n/a
Got message type=method_return sender=org.freedesktop.DBus destination=:1.732 path=n/a interface=n/a member=n/a cookie=4294967295 reply_cookie=1 signature=s error-name=n/a error-message=n/a
Bus test-bus: changing state HELLO → RUNNING
Bus test-bus: changing state RUNNING → CLOSED
request_name_destroy_callback n_ref=1

/* test_name_async (20) */
Bus test-bus: changing state UNSET → OPENING
Bus test-bus: changing state OPENING → AUTHENTICATING
Bus test-bus: changing state AUTHENTICATING → HELLO
stage 0: sd_bus_process returned 1
Sent message type=method_call sender=n/a destination=org.freedesktop.DBus path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=Hello cookie=1 reply_cookie=0 signature=n/a error-name=n/a error-message=n/a
Sent message type=method_call sender=n/a destination=org.freedesktop.DBus path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=RequestName cookie=2 reply_cookie=0 signature=su error-name=n/a error-message=n/a
stage 1: sd_bus_process returned 1
Got message type=method_return sender=org.freedesktop.DBus destination=:1.733 path=n/a interface=n/a member=n/a cookie=4294967295 reply_cookie=1 signature=s error-name=n/a error-message=n/a
Bus test-bus: changing state HELLO → RUNNING
stage 2: sd_bus_process returned 1
Got message type=signal sender=org.freedesktop.DBus.Local destination=n/a path=/org/freedesktop/DBus/Local interface=org.freedesktop.DBus.Local member=Connected cookie=4294967295 reply_cookie=0 signature=n/a error-name=n/a error-message=n/a
stage 3: sd_bus_process returned 1
Got message type=signal sender=org.freedesktop.DBus destination=:1.733 path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=NameAcquired cookie=4294967295 reply_cookie=0 signature=s error-name=n/a error-message=n/a
stage 4: sd_bus_process returned 1
Got message type=error sender=org.freedesktop.DBus destination=:1.733 path=n/a interface=n/a member=n/a cookie=4294967295 reply_cookie=2 signature=s error-name=org.freedesktop.DBus.Error.AccessDenied error-message=Request to own name refused by policy
Unable to request name, will retry after reloading DBus configuration: Request to own name refused by policy
Sent message type=method_call sender=n/a destination=org.freedesktop.DBus path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=ReloadConfig cookie=3 reply_cookie=0 signature=n/a error-name=n/a error-message=n/a
request_name_destroy_callback n_ref=2
stage 5: sd_bus_process returned 1
Got message type=method_return sender=org.freedesktop.DBus destination=:1.733 path=n/a interface=n/a member=n/a cookie=4294967295 reply_cookie=3 signature= error-name=n/a error-message=n/a
Sent message type=method_call sender=n/a destination=org.freedesktop.DBus path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=RequestName cookie=4 reply_cookie=0 signature=su error-name=n/a error-message=n/a
request_name_destroy_callback n_ref=1
stage 6: sd_bus_process returned 1
Got message type=error sender=org.freedesktop.DBus destination=:1.733 path=n/a interface=n/a member=n/a cookie=4294967295 reply_cookie=4 signature=s error-name=org.freedesktop.DBus.Error.AccessDenied error-message=Request to own name refused by policy
Unable to request name, failing connection: Request to own name refused by policy
Bus test-bus: changing state RUNNING → CLOSING
stage 7: sd_bus_process returned 1
Bus test-bus: changing state CLOSING → CLOSED
stage 8: sd_bus_process returned 1
stage 9: sd_bus_process returned -104
Processing failed: Connection reset by peer

5 years agobus: optionally call a callbacks for cleanup
Zbigniew Jędrzejewski-Szmek [Wed, 6 Jun 2018 09:07:02 +0000 (11:07 +0200)] 
bus: optionally call a callbacks for cleanup

This adds a function sd_bus_slot_set_destroy_callback() to set a function
which can free userdata or perform other cleanups.

sd_bus_slot_get_destory_callback() queries the callback, and is included
for completeness.

Without something like this, for floating asynchronous callbacks, which might
be called or not, depending on the sequence of events, it's hard to perform
resource cleanup. The alternative would be to always perform the cleanup from
the caller too, but that requires more coordination and keeping of some shared
state. It's nicer to keep the cleanup contained between the callback and the
function that requests the callback.

5 years agoman: also mention EINVAL in sd_bus_slot_set_floating(3)
Zbigniew Jędrzejewski-Szmek [Wed, 6 Jun 2018 08:57:30 +0000 (10:57 +0200)] 
man: also mention EINVAL in sd_bus_slot_set_floating(3)

5 years agotest-bus-util: add a simple test for bus_request_name_async_may_reload_dbus()
Zbigniew Jędrzejewski-Szmek [Mon, 4 Jun 2018 13:15:17 +0000 (15:15 +0200)] 
test-bus-util: add a simple test for bus_request_name_async_may_reload_dbus()

This shows a minor memleak:
==1883== 24 bytes in 1 blocks are definitely lost in loss record 1 of 1
==1883==    at 0x4C2DBAB: malloc (vg_replace_malloc.c:299)
==1883==    by 0x4E9D385: malloc_multiply (alloc-util.h:69)
==1883==    by 0x4EA2959: bus_request_name_async_may_reload_dbus (bus-util.c:1841)
==1883==    by ...

The exchange of messages is truncated at two different points: once right
after the first callback is requested, and the second time after the full
sequence has run (usually resulting in an error because of policy).

5 years agobus-util: avoid unneeded initalization to zero
Zbigniew Jędrzejewski-Szmek [Mon, 4 Jun 2018 11:04:40 +0000 (13:04 +0200)] 
bus-util: avoid unneeded initalization to zero

5 years agoman: xinclude the generic text to talk about libsystemd pkgconfig
Zbigniew Jędrzejewski-Szmek [Wed, 6 Jun 2018 09:59:04 +0000 (11:59 +0200)] 
man: xinclude the generic text to talk about libsystemd pkgconfig

The only difference is that functions are not individually listed by name,
but that seems completely pointless, since all functions that are documented
are always exported, so the generic text tells the user all she or he needs
to know.

5 years agoMerge pull request #9201 from poettering/integration-test-unfuck
Zbigniew Jędrzejewski-Szmek [Wed, 6 Jun 2018 19:02:13 +0000 (21:02 +0200)] 
Merge pull request #9201 from poettering/integration-test-unfuck

make the integration tests great again

5 years agopid: fix ENOENT error check 9214/head
Lennart Poettering [Wed, 6 Jun 2018 18:22:41 +0000 (20:22 +0200)] 
pid: fix ENOENT error check

5 years agosystemctl: when GetProcesses() doesn't work, say for which unit
Lennart Poettering [Wed, 6 Jun 2018 17:46:23 +0000 (19:46 +0200)] 
systemctl: when GetProcesses() doesn't work, say for which unit

5 years agoMerge pull request #9212 from keszybz/null-removal-part-two
Lennart Poettering [Wed, 6 Jun 2018 15:18:19 +0000 (17:18 +0200)] 
Merge pull request #9212 from keszybz/null-removal-part-two

Small follow-up to log_struct NULL removal

5 years agoMerge pull request #9197 from poettering/make-main-shorter
Zbigniew Jędrzejewski-Szmek [Wed, 6 Jun 2018 14:05:41 +0000 (16:05 +0200)] 
Merge pull request #9197 from poettering/make-main-shorter

some smaller changes to make PID1's main() a bit shorter

5 years agoresolved: reformat message about a revoked trust anchor 9212/head
Zbigniew Jędrzejewski-Szmek [Wed, 6 Jun 2018 12:55:31 +0000 (14:55 +0200)] 
resolved: reformat message about a revoked trust anchor

LOG_MESSAGE is just a wrapper, but it keeps the arguments indented together
with the format string, so put the argument inside of the macro invocation.
(No functional change.)

Also use lowercase for "trust anchor" — it should either be all capitaled or not
at all, and it's not a proper name, so let's make it all lowercase.
Also, add a newline, to make the string more readable. "%s" can expand to
something that is quite long.

5 years agoRemove NULL terminator from two log_struct calls
Zbigniew Jędrzejewski-Szmek [Wed, 6 Jun 2018 12:44:34 +0000 (14:44 +0200)] 
Remove NULL terminator from two log_struct calls

Fixup for a1230ff972. I forgot to press "save" ;(

5 years agomain: combine a some if checks 9197/head
Lennart Poettering [Tue, 5 Jun 2018 14:07:49 +0000 (16:07 +0200)] 
main: combine a some if checks

Let's merge a few if blocks that are conditioned out the same way.

No change in behaviour.

5 years agomain: use rlimit_free_all() at one more place
Lennart Poettering [Tue, 5 Jun 2018 14:06:57 +0000 (16:06 +0200)] 
main: use rlimit_free_all() at one more place

5 years agocore: comment verbosely what the difference betweem set_manager_settings() and set_ma...
Lennart Poettering [Tue, 5 Jun 2018 14:06:19 +0000 (16:06 +0200)] 
core: comment verbosely what the difference betweem set_manager_settings() and set_manager_defaults() is

5 years agoutil: add new write_string_filef() helper
Lennart Poettering [Tue, 5 Jun 2018 14:02:32 +0000 (16:02 +0200)] 
util: add new write_string_filef() helper

This new helper combines asprintf() and write_string_file() in one,
which is useful at various places to shorten the code a bit.

5 years agomain: split out reading of /proc/sys/fs/nr_open into its own function
Lennart Poettering [Tue, 5 Jun 2018 13:21:47 +0000 (15:21 +0200)] 
main: split out reading of /proc/sys/fs/nr_open into its own function

This doesn't really reduce the code size over all, but it does make main.c
shorter and more readable, and that's always a good thing.

5 years agoman: add example for sd_event_add_inotify
Zbigniew Jędrzejewski-Szmek [Tue, 5 Jun 2018 10:52:21 +0000 (12:52 +0200)] 
man: add example for sd_event_add_inotify

5 years agoMerge pull request #9210 from poettering/use-delete-trailing-chars
Zbigniew Jędrzejewski-Szmek [Wed, 6 Jun 2018 10:43:47 +0000 (12:43 +0200)] 
Merge pull request #9210 from poettering/use-delete-trailing-chars

make use of delete_trailing_chars() more

5 years agoMerge pull request #9121 from poettering/sd-event-inotify
Zbigniew Jędrzejewski-Szmek [Wed, 6 Jun 2018 10:38:55 +0000 (12:38 +0200)] 
Merge pull request #9121 from poettering/sd-event-inotify

add "sd_event_add_inotify()" and use it for making PID 1 rescheduler .timer units properly on timezone change

5 years agoNEWS: add note about --runtime
Zbigniew Jędrzejewski-Szmek [Tue, 5 Jun 2018 12:25:43 +0000 (14:25 +0200)] 
NEWS: add note about --runtime

5 years agolocale: add _unused_ attribute for dummy variable
Yu Watanabe [Wed, 6 Jun 2018 08:13:12 +0000 (17:13 +0900)] 
locale: add _unused_ attribute for dummy variable

This suppresses the following warning by clang:
```
[588/1179] Compiling C object 'systemd-localed@exe/src_locale_localed.c.o'.
../src/locale/localed.c:271:39: warning: unused variable 'dummy' [-Wunused-variable]
        _cleanup_(locale_free) char **dummy = new_locale;
                                      ^
```

5 years agohwdb: add accel mount settings for Cube i7 Stylus I8L Model (#9207)
rubensa [Wed, 6 Jun 2018 10:02:35 +0000 (12:02 +0200)] 
hwdb: add accel mount settings for Cube i7 Stylus I8L Model (#9207)

There are different Cube i7 Stylus generations.

Those are identified with the printed serial code sticker on motherboard (Printed serial code on casing is not always true)

Order of Model (Old - New):

    W
    WA
    WWA
    WN(I8WN)
    I8L(With W on casing)

I own a I8L generation so the hw identification for my model does not work.

# cat /sys/class/dmi/id/sys_vendor
Cube
# сat /sys/class/dmi/id/product_name
i8-L

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'.