]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
6 years agoMerge pull request #7301 from poettering/loginctl-ellipsize
Zbigniew Jędrzejewski-Szmek [Sun, 12 Nov 2017 15:25:54 +0000 (16:25 +0100)] 
Merge pull request #7301 from poettering/loginctl-ellipsize

Fix loginctl seat sysfs tree ellipsation logic.

Simple reproducer:
loginctl --full seat-status seat0|cat
→ after this PR, all lines are shown in full. Before, lines were ellipsized to terminal width.

6 years agoMerge pull request #7186 from poettering/track-deps
Zbigniew Jędrzejewski-Szmek [Sun, 12 Nov 2017 15:14:41 +0000 (16:14 +0100)] 
Merge pull request #7186 from poettering/track-deps

rework unit dependency data structure to track why deps get created

6 years agotest-execute: change path to python3 (#7306)
Yu Watanabe [Sun, 12 Nov 2017 15:09:00 +0000 (00:09 +0900)] 
test-execute: change path to python3 (#7306)

Change python3 path from /bin/python3 to /usr/bin/python3 to make
the test work on Ubuntu Xenial.

Follow-up for #7178.

6 years agocore/mount: fstype may be NULL 7186/head
Yu Watanabe [Sun, 12 Nov 2017 13:25:58 +0000 (14:25 +0100)] 
core/mount: fstype may be NULL

6 years agoupdate TODO
Lennart Poettering [Tue, 24 Oct 2017 10:18:17 +0000 (12:18 +0200)] 
update TODO

6 years agocore: sd-bus can handle NULL strings nicely, let's use it
Lennart Poettering [Thu, 26 Oct 2017 15:26:27 +0000 (17:26 +0200)] 
core: sd-bus can handle NULL strings nicely, let's use it

No need to set an empty string here, sd-bus serializes NULL as empty
string anway.

6 years agoMerge pull request #7178 from yuwata/rfe-7169-v2
Zbigniew Jędrzejewski-Szmek [Sun, 12 Nov 2017 11:45:23 +0000 (12:45 +0100)] 
Merge pull request #7178 from yuwata/rfe-7169-v2

core: add support to specify errno in SystemCallFilter=

6 years agotest-execute: update test for SystemCallErrorNumber= 7178/head
Yu Watanabe [Sat, 11 Nov 2017 12:41:05 +0000 (21:41 +0900)] 
test-execute: update test for SystemCallErrorNumber=

6 years agocore: allow to specify errno number in SystemCallErrorNumber=
Yu Watanabe [Sat, 11 Nov 2017 12:40:20 +0000 (21:40 +0900)] 
core: allow to specify errno number in SystemCallErrorNumber=

6 years agotest: add tests for syscall:errno style in SystemCallFilter=
Yu Watanabe [Sat, 11 Nov 2017 12:39:02 +0000 (21:39 +0900)] 
test: add tests for syscall:errno style in SystemCallFilter=

6 years agocore: add support to specify errno in SystemCallFilter=
Yu Watanabe [Sat, 11 Nov 2017 12:35:49 +0000 (21:35 +0900)] 
core: add support to specify errno in SystemCallFilter=

This makes each system call in SystemCallFilter= blacklist optionally
takes errno name or number after a colon. The errno takes precedence
over the one given by SystemCallErrorNumber=.

C.f. #7173.
Closes #7169.

6 years agotest: add test for parse_errno() and parse_syscall_and_errno()
Yu Watanabe [Sat, 11 Nov 2017 12:53:56 +0000 (21:53 +0900)] 
test: add test for parse_errno() and parse_syscall_and_errno()

6 years agoparse-util: add parse_errno() and parse_syscall_and_errno()
Yu Watanabe [Sat, 11 Nov 2017 12:29:17 +0000 (21:29 +0900)] 
parse-util: add parse_errno() and parse_syscall_and_errno()

6 years agobasic/errno-list: remove errno_max() and define ERRNO_MAX as 4095
Yu Watanabe [Sat, 11 Nov 2017 12:26:10 +0000 (21:26 +0900)] 
basic/errno-list: remove errno_max() and define ERRNO_MAX as 4095

In Linux kernel code, MAX_ERRNO is defined as 4095.
Here, we use that value for ERRNO_MAX.

6 years agologinctl: rework sysfs tree dump, to honour --full and friends 7301/head
Lennart Poettering [Fri, 10 Nov 2017 20:44:29 +0000 (21:44 +0100)] 
loginctl: rework sysfs tree dump, to honour --full and friends

Let's hook up the sysfs tree output with the output flags logic,
already used when dumping log lines or process trees. This way we get
very similar output handling for line breaking/ellipsation in all three
outputs of structured data.

Fixes: #7095
6 years agostring-util: when ellipsizing to a length if (size_t) -1, become a NOP
Lennart Poettering [Fri, 10 Nov 2017 20:41:53 +0000 (21:41 +0100)] 
string-util: when ellipsizing to a length if (size_t) -1, become a NOP

Let's say that (size_t) -1 (i.e. SIZE_T_MAX) is equivalent to
"unbounded" ellipsation, i.e. ellipsation as NOP. In which case the
relevant functions become little more than strdup()/strndup().

This is useful to simplify caller code in case we want to turn off
ellipsation in certain code paths with minimal caller-side handling for
this.

6 years agomerge two lines in our get_output_flags() functions
Lennart Poettering [Fri, 10 Nov 2017 20:40:47 +0000 (21:40 +0100)] 
merge two lines in our get_output_flags() functions

loginctl, machinectl, systemctl all have very similar implementations of
a get_output_flags() functions. Simplify it by merging two lines that
set the same flag.

6 years agotree-wide: use _cleanup_(sd_bus_flush_close_unrefp) at various appropriate places
Lennart Poettering [Fri, 10 Nov 2017 20:15:44 +0000 (21:15 +0100)] 
tree-wide: use  _cleanup_(sd_bus_flush_close_unrefp) at various appropriate places

Let's shorten the code a bit.

6 years agopager: cache not only number of columns but also of lines before we open pager
Lennart Poettering [Fri, 10 Nov 2017 20:10:17 +0000 (21:10 +0100)] 
pager: cache not only number of columns but also of lines before we open pager

Not that we need it, but let's do this as matter of completeness.

6 years agologinctl: invoke sigbus_install()
Lennart Poettering [Fri, 10 Nov 2017 20:04:08 +0000 (21:04 +0100)] 
loginctl: invoke sigbus_install()

We show journal data, hence we should install the SIGBUS handler.

Similar for machinectl, where the same applies.

6 years agocore: make "tmpfs" dependencies on swapfs a "default" dep, not an "implicit"
Lennart Poettering [Thu, 26 Oct 2017 15:24:55 +0000 (17:24 +0200)] 
core: make "tmpfs" dependencies on swapfs a "default" dep, not an "implicit"

There should be a way to turn this logic of, and DefaultDependencies=
appears to be the right option for that, hence let's downgrade this
dependency type from "implicit" to "default, and thus honour
DefaultDependencies=.

This also drops mount_get_fstype() as we only have a single user needing
this now.

A follow-up for #7076.

6 years agocore: when a unit template is specified in SYSTEMD_WANTS=, instantiate it with sysfs...
Lennart Poettering [Thu, 26 Oct 2017 15:12:44 +0000 (17:12 +0200)] 
core: when a unit template is specified in SYSTEMD_WANTS=, instantiate it with sysfs path

This should make cases like the user's setup in #7109 a lot easier to
handle, as in that case we'll do the right escaping automatically.

6 years agotest: add test case for adding/removing dependencies via udev rules
Lennart Poettering [Thu, 26 Oct 2017 14:43:31 +0000 (16:43 +0200)] 
test: add test case for adding/removing dependencies via udev rules

6 years agocore: remove SYSTEMD_WANTS udev property configured dependencies at the right moment
Lennart Poettering [Thu, 26 Oct 2017 14:41:06 +0000 (16:41 +0200)] 
core: remove SYSTEMD_WANTS udev property configured dependencies at the right moment

Previously dependencies configured with SYSTEMD_WANTS would be collected
on a device unit as long as it was loaded. let's fix that, and remove
dependencies again when SYTEMD_WANTS changes.

6 years agodevice: Let's simplify device_add_udev_wants() a bit
Lennart Poettering [Thu, 26 Oct 2017 14:40:35 +0000 (16:40 +0200)] 
device: Let's simplify device_add_udev_wants() a bit

Let's drop use of one variable and make the rest more explicit.

6 years agocore: add internal API to remove dependencies again, based on dependency mask
Lennart Poettering [Thu, 26 Oct 2017 14:39:35 +0000 (16:39 +0200)] 
core: add internal API to remove dependencies again, based on dependency mask

let's make use of the dependency mask, and add internal API to remove
dependencies ago, based on bits in the dependency mask.

6 years agoman: extend documentation on the unit name escaping logic
Lennart Poettering [Thu, 26 Oct 2017 10:22:38 +0000 (12:22 +0200)] 
man: extend documentation on the unit name escaping logic

6 years agodevice: rework device_is_bound_by_mounts() a bit
Lennart Poettering [Wed, 25 Oct 2017 19:29:24 +0000 (21:29 +0200)] 
device: rework device_is_bound_by_mounts() a bit

Let's log when we can't parse the udev property, and always use the most
precise, correct types.

6 years agocore: track why unit dependencies came to be
Lennart Poettering [Wed, 25 Oct 2017 18:46:01 +0000 (20:46 +0200)] 
core: track why unit dependencies came to be

This replaces the dependencies Set* objects by Hashmap* objects, where
the key is the depending Unit, and the value is a bitmask encoding why
the specific dependency was created.

The bitmask contains a number of different, defined bits, that indicate
why dependencies exist, for example whether they are created due to
explicitly configured deps in files, by udev rules or implicitly.

Note that memory usage is not increased by this change, even though we
store more information, as we manage to encode the bit mask inside the
value pointer each Hashmap entry contains.

Why this all? When we know how a dependency came to be, we can update
dependencies correctly when a configuration source changes but others
are left unaltered. Specifically:

1. We can fix UDEV_WANTS dependency generation: so far we kept adding
   dependencies configured that way, but if a device lost such a
   dependency we couldn't them again as there was no scheme for removing
   of dependencies in place.

2. We can implement "pin-pointed" reload of unit files. If we know what
   dependencies were created as result of configuration in a unit file,
   then we know what to flush out when we want to reload it.

3. It's useful for debugging: "systemd-analyze dump" now shows
   this information, helping substantially with understanding how
   systemd's dependency tree came to be the way it came to be.

6 years agogpt-auto-generator: make sure "r" is always set
Lennart Poettering [Wed, 25 Oct 2017 18:44:25 +0000 (20:44 +0200)] 
gpt-auto-generator: make sure "r" is always set

6 years agomkosi: fix build script to use right sysvinit path
Lennart Poettering [Wed, 25 Oct 2017 18:42:38 +0000 (20:42 +0200)] 
mkosi: fix build script to use right sysvinit path

On Fedora /etc/init.d is a symlink to /etc/rc.d/init.d. Our build
scripts default to /etc/init.d since that is the LSB default. Let's make
sure the build script thus follows the symlink correctly and configures
to path explicitly, since otherwise our build artifacts in $DESTDIR are
incompatible with the setup we actually need for Fedora.

6 years agomkosi: configure mkosi.cache/ and mkosi.builddir/ explicitly
Lennart Poettering [Wed, 25 Oct 2017 18:40:04 +0000 (20:40 +0200)] 
mkosi: configure mkosi.cache/ and mkosi.builddir/ explicitly

This way these dirs will be created automatically if they are missing,
thus always guaranteeing optimal speedy behaviour.

(Well at least, after https://github.com/systemd/mkosi/pull/181 is
merged)

6 years agocore: include a bad /var/run symlink in the "tainted" string
Lennart Poettering [Tue, 24 Oct 2017 10:26:36 +0000 (12:26 +0200)] 
core: include a bad /var/run symlink in the "tainted" string

6 years agovirt: trivial whitespace fixes
Lennart Poettering [Tue, 24 Oct 2017 10:18:27 +0000 (12:18 +0200)] 
virt: trivial whitespace fixes

6 years agodevice : reload when udev generates a "changed" event (#6850)
Boucman [Fri, 10 Nov 2017 16:00:32 +0000 (17:00 +0100)] 
device : reload when udev generates a "changed" event (#6850)

6 years agoMerge pull request #7089 from oniko/luks2-support
Lennart Poettering [Fri, 10 Nov 2017 15:16:36 +0000 (16:16 +0100)] 
Merge pull request #7089 from oniko/luks2-support

LUKS2 support for systemd-cryptsetup and dissect-image

6 years agonetworkd: set dhcp_use_routes to true when dhcp_anonymize is true (#7209)
juga0 [Fri, 10 Nov 2017 15:03:43 +0000 (15:03 +0000)] 
networkd: set dhcp_use_routes to true when dhcp_anonymize is true (#7209)

It does not send duplicated options in the PRL.
Fix #7048.

6 years agocore: add missing error_message cases (#6911)
Alan Jenkins [Fri, 10 Nov 2017 14:57:52 +0000 (14:57 +0000)] 
core: add missing error_message cases (#6911)

We neglected to set error_message for errors which occur _after_ the
`finish` label.  These fatal errors only happen in paths where `finish`
was reached successfully, i.e. error_message has not already been set
(and this analysis is simple enough that this need not cause too much
headaches.  Also our new assignments to error_message come immediately
after execve() calls, which would have lost the error_message if it had
been set).

Also print a status message when we fail to exec init, otherwise the only
sign the user will see is `# ` :).

This addresses the lack of error messages pointed out in issue #6827.

6 years agoMerge pull request #7096 from keszybz/logind-session-killing
Lennart Poettering [Fri, 10 Nov 2017 14:51:39 +0000 (15:51 +0100)] 
Merge pull request #7096 from keszybz/logind-session-killing

Logind session killing fix

6 years agobasic/hashmap: add cleanup of memory pools (#7164)
Zbigniew Jędrzejewski-Szmek [Fri, 10 Nov 2017 14:44:58 +0000 (15:44 +0100)] 
basic/hashmap: add cleanup of memory pools (#7164)

It was dropped in 89439d4fc0d29f04ac68432fd06ab84bc4e36e20. As a result, every
process that uses a hashmap allocates and then leaks the hashmap mempools.
The mempools are only allocated in the main thread, but we don't know where
the memory is used.

So let's check if we are the last thread and free the mempools then. This is
fairly heavy, because /proc/self/status has to be opened and parsed, but we do
it only when compiled for valgrind, i.e. not by default, and compared to running
under valgrind or asan, the extra cost is acceptable. The big advantage is that
we don't have to think or filter out this false positive.

As a micro-opt, cleanup is attempted only in the main thread. We could allow
any thread to check if it is the last one and perform cleanup, but that'd mean
that we'd have to _do_ the check in every thread. We don't use threads like
that, our non-main threads are always short-lived, so let's just accept the
possibility that we'll leak memory if a thread survives. The check is also
non-atomic, but it's called in a destructor of the main thread _and_ we do
cleanup only when there are no other threads, so the risk of some library
suddenly spawning another thread is very low. All in all, this is not perfect,
but should work in 999‰ of cases.

Fixes the following valgrind warning:

==22564== HEAP SUMMARY:
==22564==     in use at exit: 8,192 bytes in 2 blocks
==22564==   total heap usage: 243 allocs, 241 frees, 151,905 bytes allocated
==22564==
==22564== 4,096 bytes in 1 blocks are still reachable in loss record 1 of 2
==22564==    at 0x4C2FB6B: malloc (vg_replace_malloc.c:299)
==22564==    by 0x4F08A8C: mempool_alloc_tile (mempool.c:62)
==22564==    by 0x4F08B16: mempool_alloc0_tile (mempool.c:81)
==22564==    by 0x4EF8DE0: hashmap_base_new (hashmap.c:748)
==22564==    by 0x4EF8ED9: internal_hashmap_new (hashmap.c:782)
==22564==    by 0x11045D: test_hashmap_copy (test-hashmap-plain.c:87)
==22564==    by 0x115722: test_hashmap_funcs (test-hashmap-plain.c:914)
==22564==    by 0x10FC9D: main (test-hashmap.c:60)
==22564==
==22564== 4,096 bytes in 1 blocks are still reachable in loss record 2 of 2
==22564==    at 0x4C2FB6B: malloc (vg_replace_malloc.c:299)
==22564==    by 0x4F08A8C: mempool_alloc_tile (mempool.c:62)
==22564==    by 0x4F08B16: mempool_alloc0_tile (mempool.c:81)
==22564==    by 0x4EF8DE0: hashmap_base_new (hashmap.c:748)
==22564==    by 0x4EF8EF8: internal_ordered_hashmap_new (hashmap.c:786)
==22564==    by 0x10A2A0: test_ordered_hashmap_copy (test-hashmap-ordered.c:89)
==22564==    by 0x10F70F: test_ordered_hashmap_funcs (test-hashmap-ordered.c:916)
==22564==    by 0x10FCA2: main (test-hashmap.c:61)
==22564==
==22564== LEAK SUMMARY:
==22564==    definitely lost: 0 bytes in 0 blocks
==22564==    indirectly lost: 0 bytes in 0 blocks
==22564==      possibly lost: 0 bytes in 0 blocks
==22564==    still reachable: 8,192 bytes in 2 blocks
==22564==         suppressed: 0 bytes in 0 blocks

v2:
- check if we are the main thread

v3:
- check if there are no other threads

6 years agoFix typo in statx macro (#7180)
Antonio Rojas [Fri, 10 Nov 2017 10:07:36 +0000 (11:07 +0100)] 
Fix typo in statx macro (#7180)

This makes statx properly whitelisted in supported systems.

6 years agorules: run all persistent-input rules for rmi and i8042 (#7287)
Simon Arlott [Fri, 10 Nov 2017 09:32:51 +0000 (09:32 +0000)] 
rules: run all persistent-input rules for rmi and i8042 (#7287)

Commit 83b48159 set ID_BUS for these subsystems but copied the intent
of commit c49df207 by not creating symlinks for those devices.

Remove the GOTO so that the rest of the rules are still processed and
symlinks are created for rmi and i8042 devices.

6 years agosystemctl: fix memory leak (#7289)
John Lin [Fri, 10 Nov 2017 09:32:25 +0000 (17:32 +0800)] 
systemctl: fix memory leak (#7289)

Fixes: #7283
6 years agosystemd-firstboot: add vconsole keymap support (#7035)
tblume [Fri, 10 Nov 2017 09:31:44 +0000 (10:31 +0100)] 
systemd-firstboot: add vconsole keymap support (#7035)

Enable systemd-firstboot to set the keymap.

RFE:

https://github.com/systemd/systemd/issues/6346

6 years agocore/load-fragment: add RemoveIPC= (#7288)
Yu Watanabe [Fri, 10 Nov 2017 09:15:55 +0000 (18:15 +0900)] 
core/load-fragment: add RemoveIPC= (#7288)

PR #3865 introduced RemoveIPC= but the option is not listed in
load-fragment-gperf.gperf. So, the option could be used only via d-bus.
This adds RemoveIPC= in load-fragment-gperf.gperf. Then, now we can
set the option in unit files.

Fixes #7281.

6 years agoman: remove restrictions in [Install] section (#7278)
John Lin [Thu, 9 Nov 2017 15:12:01 +0000 (23:12 +0800)] 
man: remove restrictions in [Install] section (#7278)

Now [Install] section also supports drop-in files.

Follow-up for 142468d89508c63262dd59335ea6d4fe82267564.

6 years agohwdb: Add ACCEL_MOUNT_MATRIX for HP Stream 8 (#7279)
Collin Eggert [Thu, 9 Nov 2017 14:38:34 +0000 (08:38 -0600)] 
hwdb: Add ACCEL_MOUNT_MATRIX for HP Stream 8 (#7279)

6 years agoMerge pull request #7280 from yuwata/fix-7270-2
Lennart Poettering [Thu, 9 Nov 2017 13:26:42 +0000 (14:26 +0100)] 
Merge pull request #7280 from yuwata/fix-7270-2

test-event: do not work in assert()

6 years agocryptsetup: ignore _netdev, since it is used in generator (#7282)
Lukáš Nykrýn [Thu, 9 Nov 2017 13:24:57 +0000 (14:24 +0100)] 
cryptsetup: ignore _netdev, since it is used in generator (#7282)

6 years agotest-parse-util: add more tests, mainly for empty string 7280/head
Yu Watanabe [Thu, 9 Nov 2017 08:36:07 +0000 (17:36 +0900)] 
test-parse-util: add more tests, mainly for empty string

6 years agolibsystemd-network: coding style fix
Yu Watanabe [Thu, 9 Nov 2017 09:39:41 +0000 (18:39 +0900)] 
libsystemd-network: coding style fix

6 years agotree-wide: do not work in assert()
Yu Watanabe [Thu, 9 Nov 2017 09:38:02 +0000 (18:38 +0900)] 
tree-wide: do not work in assert()

Follow-up for 85e55d14dea66f5fe412ca8128487d5ea828b7b1.

6 years agoMerge pull request #7112 from tstellar/udev-for-kfd
Lennart Poettering [Thu, 9 Nov 2017 08:22:55 +0000 (09:22 +0100)] 
Merge pull request #7112 from tstellar/udev-for-kfd

udev-rules: Add rules for /dev/kfd

6 years agotest-bpf: use /bin/ping path (#7276)
Dimitri John Ledkov [Wed, 8 Nov 2017 19:04:55 +0000 (14:04 -0500)] 
test-bpf: use /bin/ping path (#7276)

This path to ping is compatible with both debian-like and usr-merged
distros. This keeps the test simple, and should thus pass everywhere.

Fixes: #7267
6 years agosystemctl: respect [Install] section in drop-ins (#7158)
John Lin [Wed, 8 Nov 2017 17:04:31 +0000 (01:04 +0800)] 
systemctl: respect [Install] section in drop-ins (#7158)

Fixes: #7114
6 years agoNEWS: Add note about udev changes for /dev/kvm, /dev/dri/renderD*, and /dev/kfd 7112/head
Tom Stellard [Wed, 8 Nov 2017 16:35:23 +0000 (08:35 -0800)] 
NEWS: Add note about udev changes for /dev/kvm, /dev/dri/renderD*, and /dev/kfd

6 years agoMerge pull request #7268 from yuwata/rfe-7262
Lennart Poettering [Wed, 8 Nov 2017 16:35:56 +0000 (17:35 +0100)] 
Merge pull request #7268 from yuwata/rfe-7262

timesync: make poll interval configurable

6 years agoMerge pull request #7275 from yuwata/fix-7070-7260
Lennart Poettering [Wed, 8 Nov 2017 16:34:39 +0000 (17:34 +0100)] 
Merge pull request #7275 from yuwata/fix-7070-7260

core: fixes related to RuntimeDirectory=, ReadWritePaths= and DynamicUser=

6 years agoudev-rules: Add rule for /dev/kfd
Tom Stellard [Tue, 31 Oct 2017 15:56:19 +0000 (08:56 -0700)] 
udev-rules: Add rule for /dev/kfd

6 years agoudev-rules: Permission changes for /dev/dri/renderD*
Tom Stellard [Tue, 31 Oct 2017 15:46:24 +0000 (08:46 -0700)] 
udev-rules: Permission changes for /dev/dri/renderD*

- Remove the uaccess tag from /dev/dri/renderD*.
- Change the owning group from video to render.
- Change default mode to 0666.
- Add an option to allow users to set the access mode for these devices at
compile time.

6 years agoudev-rules: Permission changes for /dev/kvm
Tom Stellard [Tue, 31 Oct 2017 15:41:53 +0000 (08:41 -0700)] 
udev-rules: Permission changes for /dev/kvm

- Remove uaccess tag from /dev/kvm.
- Change the default mode for /dev/kvm to 0666.

6 years agoumount: always use MNT_FORCE in umount_all() (#7213)
NeilBrown [Wed, 8 Nov 2017 08:29:32 +0000 (19:29 +1100)] 
umount: always use MNT_FORCE in umount_all() (#7213)

The linux umount2() systemcall accepts a MNT_FORCE flags
which some filesystems honor, particularly FUSE and various
network filesystems such as NFS.
These filesystems can sometimes wait for an indefinite period
for a response from an external service, and the wait if
sometimes "uninterruptible" meaning that the process cannot be
killed.
Using MNT_FORCE causes any such request that are outstanding to
be aborted.  This normally allows the waiting process to
be killed.  It will then realease and reference it has to the
filesytem, this allowing the filesystem to be unmounted.

If there remain active references to the filesystem, MNT_FORCE
is *not* forcefull enough to unmount the filesystem anyway.

By the time that umount_all() is run by systemd-shutdown, all
filesystems *should* be unmounted, and sync() will have been
called.  Anything that remains cannot be unmounted in a
completely clean manner and just nees to be dealt with as firmly
as possible.  So use MNT_FORCE and try to explain why in the
comment.

Also enhance an earlier comment to explain why umount2() is
safe even though mount(MNT_REMOUNT) isn't.

6 years agoman: update documents for RuntimeDirectory= and friends 7275/head
Yu Watanabe [Wed, 8 Nov 2017 06:52:08 +0000 (15:52 +0900)] 
man: update documents for RuntimeDirectory= and friends

6 years agocore/execute: do not create RuntimeDirectory= under private/ sub-directory
Yu Watanabe [Wed, 8 Nov 2017 06:50:58 +0000 (15:50 +0900)] 
core/execute: do not create RuntimeDirectory= under private/ sub-directory

RuntimeDirectory= often used for sharing files or sockets with other
services. So, if creating them under private/ sub-directory, we cannot
set DynamicUser= to service units which want to share something through
RuntimeDirectory=.
This makes the directories given by RuntimeDirectory= are created under
/run/ even if DynamicUser= is set.

Fixes #7260.

6 years agocore/load-fragment: fix alignment
Yu Watanabe [Wed, 8 Nov 2017 05:29:47 +0000 (14:29 +0900)] 
core/load-fragment: fix alignment

6 years agocore/execute: RuntimeDirectory= or friends requires mount namespace
Yu Watanabe [Wed, 8 Nov 2017 06:26:40 +0000 (15:26 +0900)] 
core/execute: RuntimeDirectory= or friends requires mount namespace

Since #6940, RuntimeDirectory= or their friends imply BindPaths=.
So, if at least one of them are set, mount namespace is required.

6 years agotest: add test for ReadOnlyPaths= with RuntimeDirectory=
Yu Watanabe [Sat, 28 Oct 2017 06:35:19 +0000 (15:35 +0900)] 
test: add test for ReadOnlyPaths= with RuntimeDirectory=

6 years agocore: ReadWritePaths= and friends assume '+' prefix when BindPaths= or freinds are set
Yu Watanabe [Fri, 13 Oct 2017 12:22:25 +0000 (21:22 +0900)] 
core: ReadWritePaths= and friends assume '+' prefix when BindPaths= or freinds are set

When at least one of BindPaths=, BindReadOnlyPaths=, RootImage=,
RuntimeDirectory= or their friends are set, systemd prepares
a namespace under /run/systemd/unit-root. Thus, ReadWritePaths=
or their friends without '+' prefix is completely meaningless.
So, let's assume '+' prefix when one of them are set.

Fixes #7070 and #7080.

6 years agocore: remove compile_read_write_paths()
Yu Watanabe [Fri, 13 Oct 2017 12:13:25 +0000 (21:13 +0900)] 
core: remove compile_read_write_paths()

From 6c47cd7d3bf35c8158a0737f34fe2c5dc95e72d6, RuntimeDirectory= and
their friends also imply BindPaths=. Thus, implying ReadWritePaths=
is meaningless.

6 years agotimesync: make poll interval configurable 7268/head
Yu Watanabe [Tue, 7 Nov 2017 16:47:38 +0000 (01:47 +0900)] 
timesync: make poll interval configurable

This adds PollIntervalMinSec= and PollIntervalMaxSec= to timesyncd.conf

Closes #7262.

6 years agosystemctl: remove extra space character in output (#7250)
Alan Jenkins [Tue, 7 Nov 2017 16:18:10 +0000 (16:18 +0000)] 
systemctl: remove extra space character in output (#7250)

> See "systemctl  status fail-stop.service" and "journalctl  -xe" for
> details.

6 years agomkosi: set locale to be en_US.UTF-8 (#7244)
John Lin [Tue, 7 Nov 2017 16:17:40 +0000 (00:17 +0800)] 
mkosi: set locale to be en_US.UTF-8 (#7244)

Fixes: #7238
6 years agocore: simplify - don't add jobs to dbus queue if we immediately remove them (#7251)
Alan Jenkins [Tue, 7 Nov 2017 16:14:15 +0000 (16:14 +0000)] 
core: simplify - don't add jobs to dbus queue if we immediately remove them (#7251)

job_finish_and_invalidate() calls job_free() to destroy jobs (and remove
them from the dbus queue).  So we don't need to add them to the dbus queue
first.

We only want to add jobs to the dbus queue if they're a restart job, which
we're transmogrifying into a start job and putting back into the system.

6 years agoman: fix reference to gateway hostname (#7258)
Alessandro Ghedini [Tue, 7 Nov 2017 16:13:15 +0000 (08:13 -0800)] 
man: fix reference to gateway hostname (#7258)

Follow-up to commit 1dc92a06e210a978e54c72168aaaa7487bf2fd2a which didn't
catch all cases.

6 years agocondition: detect TOMOYO MAC (#7249)
Shawn Landden [Tue, 7 Nov 2017 16:12:36 +0000 (08:12 -0800)] 
condition: detect TOMOYO MAC (#7249)

TOMOYO is a Mandatory Access Control security module for Linux.
Rather than ship rules, TOMOYO features a learning mode.

http://tomoyo.osdn.jp/
http://tomoyo.osdn.jp/2.5/index.html.en

6 years agotest: switch to using ext4 instead of ext3 as default fallback fs (#7265)
Dimitri John Ledkov [Tue, 7 Nov 2017 14:51:30 +0000 (09:51 -0500)] 
test: switch to using ext4 instead of ext3 as default fallback fs (#7265)

Using ext3 is not representative anymore, and Ubuntu has stopped shipping
fsck.ext3 in the initramfs.

6 years agoMerge pull request #7256 from keszybz/add-cii-badge
Lennart Poettering [Tue, 7 Nov 2017 14:47:57 +0000 (17:47 +0300)] 
Merge pull request #7256 from keszybz/add-cii-badge

Add CII badge

6 years agotree-wide: do not work in assert() (#7271)
Yu Watanabe [Tue, 7 Nov 2017 13:04:20 +0000 (22:04 +0900)] 
tree-wide: do not work in assert() (#7271)

Fixes #7270.

6 years agoFix Dell E7570 hwdb dimensions #7252 (#7263)
macrothian [Mon, 6 Nov 2017 22:28:06 +0000 (22:28 +0000)] 
Fix Dell E7570 hwdb dimensions #7252 (#7263)

6 years agotimesync: add RootDistanceMaxSec= to timesyncd.conf (#7215)
Yu Watanabe [Sun, 5 Nov 2017 06:39:34 +0000 (15:39 +0900)] 
timesync: add RootDistanceMaxSec= to timesyncd.conf (#7215)

Closes #7211.

6 years agoHACKING: add a short description of new unit tests 7256/head
Zbigniew Jędrzejewski-Szmek [Sat, 4 Nov 2017 20:02:35 +0000 (21:02 +0100)] 
HACKING: add a short description of new unit tests

This is all "should" and "encouraged", since we are not strict with
this, for better or worse.

6 years agoREADME.md: add CII Best Practices badge
Zbigniew Jędrzejewski-Szmek [Sat, 4 Nov 2017 19:53:25 +0000 (20:53 +0100)] 
README.md: add CII Best Practices badge

6 years agoMerge pull request #7241 from keszybz/clang-warnings
Lennart Poettering [Thu, 2 Nov 2017 18:21:10 +0000 (19:21 +0100)] 
Merge pull request #7241 from keszybz/clang-warnings

Fixes for various clang warnings

6 years agonetworkd: remove route - drop route type from netlink message. (#7240)
Susant Sahani [Thu, 2 Nov 2017 12:36:03 +0000 (18:06 +0530)] 
networkd: remove route - drop route type from netlink message. (#7240)

During startup of networkd we try to drop the configs. While droping
routes we filling ip route type and because of which message like
```
host: Could not drop route: Invalid argument
host: Could not drop route: Invalid argument
```
are shown.

Closed #6929

6 years agoMerge pull request #7217 from sourcejedi/stopfail-stop
Zbigniew Jędrzejewski-Szmek [Thu, 2 Nov 2017 07:25:02 +0000 (08:25 +0100)] 
Merge pull request #7217 from sourcejedi/stopfail-stop

2 small fixes, stopping mount and service units

6 years agotest-util: silence clang warning about unaligned access 7241/head
Zbigniew Jędrzejewski-Szmek [Wed, 1 Nov 2017 22:06:27 +0000 (23:06 +0100)] 
test-util: silence clang warning about unaligned access

6 years agoutil-lib: mark variable with _unused_ to silence clang warning
Zbigniew Jędrzejewski-Szmek [Wed, 1 Nov 2017 22:01:24 +0000 (23:01 +0100)] 
util-lib: mark variable with _unused_ to silence clang warning

_unused_ means "the variable is meant to be possible unused and gcc
will not generate a warning about it", which is exactly what we need here,
since we're only declaring it for the side effect of _cleanup_.

6 years agojournal: disable -Waddress-of-packed-member under clang
Zbigniew Jędrzejewski-Szmek [Wed, 1 Nov 2017 21:54:39 +0000 (22:54 +0100)] 
journal: disable -Waddress-of-packed-member under clang

clang warns about a few sites like this:
../src/journal/journal-file.c:1780:48: warning: taking address of packed member 'entry_offset' of class or structure 'DataObject' may result in an unaligned pointer value [-Waddress-of-packed-member]
                                              &o->data.entry_offset,
                                               ^~~~~~~~~~~~~~~~~~~~
but DataObject.entry_offset will always be 8-byte aligned as long as
the DataObject structure is aligned. Similarly in other cases, the
field is always aligned. Let's just silence the warning to avoid noise.

gcc does not know -Waddress-of-packed-member, and would warn about an unknown
warning, so we need to conditionalize on __clang__.

6 years agonetworkd: fix two format string mismatches
Zbigniew Jędrzejewski-Szmek [Wed, 1 Nov 2017 21:43:32 +0000 (22:43 +0100)] 
networkd: fix two format string mismatches

../src/network/networkd-link.c:3577:84: warning: format specifies type 'unsigned char' but the argument has type 'uint32_t' (aka 'unsigned int') [-Wformat]
                                route->dst_prefixlen, route->tos, route->priority, route->table, route->lifetime);
                                                                                   ^~~~~~~~~~~~
../src/network/networkd-manager.c:1146:132: warning: format specifies type 'unsigned char' but the argument has type 'uint32_t' (aka 'unsigned int') [-Wformat]
                        rule->from_prefixlen, space ? " " : "", to_str, rule->to_prefixlen, rule->tos, rule->fwmark, rule->fwmask, rule->table);
                                                                                                                                   ^~~~~~~~~~~

Also add some line breaks to make it easier to see which argument is for which
part of the format string.

6 years agoimportd: remove IN_SET to avoid ambiguity
Zbigniew Jędrzejewski-Szmek [Wed, 1 Nov 2017 21:36:02 +0000 (22:36 +0100)] 
importd: remove IN_SET to avoid ambiguity

clang warns:
../src/import/importd.c:254:70: warning: 'break' is bound to current loop, GCC binds it to the enclosing loop [-Wgcc-compat]
                while ((e < t->log_message + t->log_message_size) && IN_SET(*e, 0, '\n'))
                                                                     ^
Let's just play it safe and not use IN_SET here.

6 years agojournald: unitialized variable access
Zbigniew Jędrzejewski-Szmek [Wed, 1 Nov 2017 21:33:26 +0000 (22:33 +0100)] 
journald: unitialized variable access

../src/journal/journald-native.c:341:13: warning: variable 'context' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
        if (ucred && pid_is_valid(ucred->pid)) {
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/journal/journald-native.c:350:42: note: uninitialized use occurs here
                                         context, ucred, tv, label, label_len);
                                         ^~~~~~~
../src/journal/journald-native.c:335:31: note: initialize the variable 'context' to silence this warning
        ClientContext *context;
                              ^
                               = NULL

Very nice reporting!

Functions that we call can handle context == NULL, so it's enough to simply
initialize the variable.

6 years agoRemove a bunch of unused variables
Zbigniew Jędrzejewski-Szmek [Wed, 1 Nov 2017 21:32:22 +0000 (22:32 +0100)] 
Remove a bunch of unused variables

gcc does not warn about those, because of the _cleanup_ usage.
clang is smarter here.

6 years agocore: failure to spawn ExecStartPost should not run ExecStop 7217/head
Alan Jenkins [Mon, 14 Aug 2017 10:15:38 +0000 (11:15 +0100)] 
core: failure to spawn ExecStartPost should not run ExecStop

Failure to spawn ExecStartPost was being handled differently to e.g.
EXIT_FAILURE returned by ExecStartPost.  It looks like this was an
oversight.  Fix to match documented behaviour.

`man systemd.service`:

> Note that if any of the commands specified in ExecStartPre=, ExecStart=,
> or ExecStartPost= fail (and are not prefixed with "-", see above) or time
> out before the service is fully up, execution continues with commands
> specified in ExecStopPost=, the commands in ExecStop= are skipped.

6 years agocore: distinguish "Killing"/"Terminating"/"Stopping" for mount unit timeout
Alan Jenkins [Mon, 2 Oct 2017 13:40:15 +0000 (14:40 +0100)] 
core: distinguish "Killing"/"Terminating"/"Stopping" for mount unit timeout

Update the timeout warnings for remount and unmount.  For consistency with
mount, for accuracy, and for consistency with their equivalents in
service.c.

6 years agomanager: fix connecting to bus when dbus is actually around (#7205)
Michal Sekletar [Wed, 1 Nov 2017 09:25:48 +0000 (02:25 -0700)] 
manager: fix connecting to bus when dbus is actually around (#7205)

manager_connect_bus() is called *before* manager_coldplug(). As a last
thing in service_coldplug() we set service state to
s->deserialized_state, and thus before we do that all services are
inactive and try_connect always evaluates to false. To fix that we must
look at deserialized state instead of current unit state.

Fixes #7146

6 years agoReverting erroneous changes made of the course of adding a timeout to journal-remote...
martingh [Wed, 1 Nov 2017 09:15:38 +0000 (10:15 +0100)] 
Reverting erroneous changes made of the course of adding a timeout to journal-remote event handling (#7219)

6 years agoMerge pull request #7233 from yuwata/meson-fixes
Zbigniew Jędrzejewski-Szmek [Wed, 1 Nov 2017 09:14:01 +0000 (10:14 +0100)] 
Merge pull request #7233 from yuwata/meson-fixes

Meson fixes

6 years agojournal-remote: set description to timer_event (#7234)
Yu Watanabe [Wed, 1 Nov 2017 09:13:00 +0000 (18:13 +0900)] 
journal-remote: set description to timer_event (#7234)

Follow-up for 5e38eb931f9207f577e7e8b752be5a522e5f9b87.

6 years agoMerge pull request #7226 from sourcejedi/shutdown-misuse-commment
Alan Jenkins [Tue, 31 Oct 2017 10:05:02 +0000 (10:05 +0000)] 
Merge pull request #7226 from sourcejedi/shutdown-misuse-commment

core: remove "misuse" of getpgid() in systemd-shutdown

6 years agomeson: do not create systemd-user-sessions.service if PAM is disabled 7233/head
Yu Watanabe [Tue, 31 Oct 2017 07:20:53 +0000 (16:20 +0900)] 
meson: do not create systemd-user-sessions.service if PAM is disabled

Fixes #7227.