]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
6 years agoMerge pull request #6300 from keszybz/refuse-to-load-some-units
Lennart Poettering [Wed, 12 Jul 2017 07:28:20 +0000 (09:28 +0200)] 
Merge pull request #6300 from keszybz/refuse-to-load-some-units

Refuse to load some units

6 years agoNEWS: say that libidn2 is experimental (#6335)
Zbigniew Jędrzejewski-Szmek [Wed, 12 Jul 2017 07:25:59 +0000 (03:25 -0400)] 
NEWS: say that libidn2 is experimental (#6335)

Handling of "_" and some other details requires more thought:
https://gitlab.com/libidn/libidn2/issues/30

Let's switch the default back to libidn and add a note in NEWS.

6 years agoMerge pull request #6337 from poettering/more-new-v234
Lennart Poettering [Wed, 12 Jul 2017 07:25:09 +0000 (09:25 +0200)] 
Merge pull request #6337 from poettering/more-new-v234

Let's try to release v234 tomorrow

6 years agoman: add warnings that Private*= settings are not always applied 6300/head
Zbigniew Jędrzejewski-Szmek [Tue, 11 Jul 2017 17:36:15 +0000 (13:36 -0400)] 
man: add warnings that Private*= settings are not always applied

6 years agocore/load-fragment: refuse units with errors in RootDirectory/RootImage/DynamicUser
Zbigniew Jędrzejewski-Szmek [Thu, 6 Jul 2017 17:54:42 +0000 (13:54 -0400)] 
core/load-fragment: refuse units with errors in RootDirectory/RootImage/DynamicUser

Behaviour of the service is completely different with the option off, so the
service would probably mess up state on disk and do unexpected things.

6 years agocore/load-fragment: refuse units with errors in certain directives
Zbigniew Jędrzejewski-Szmek [Thu, 6 Jul 2017 17:28:19 +0000 (13:28 -0400)] 
core/load-fragment: refuse units with errors in certain directives

If an error is encountered in any of the Exec* lines, WorkingDirectory,
SELinuxContext, ApparmorProfile, SmackProcessLabel, Service (in .socket
units), User, or Group, refuse to load the unit. If the config stanza
has support, ignore the failure if '-' is present.

For those configuration directives, even if we started the unit, it's
pretty likely that it'll do something unexpected (like write files
in a wrong place, or with a wrong context, or run with wrong permissions,
etc). It seems better to refuse to start the unit and have the admin
clean up the configuration without giving the service a chance to mess
up stuff.

Note that all "security" options that restrict what the unit can do
(Capabilities, AmbientCapabilities, Restrict*, SystemCallFilter, Limit*,
PrivateDevices, Protect*, etc) are _not_ treated like this. Such options are
only supplementary, and are not always available depending on the architecture
and compilation options, so unit authors have to make sure that the service
runs correctly without them anyway.

Fixes #6237, #6277.

6 years agohwdb: update hwdb again for v234 6337/head
Lennart Poettering [Tue, 11 Jul 2017 17:26:10 +0000 (19:26 +0200)] 
hwdb: update hwdb again for v234

6 years agoupdate NEWS file, let's try to release this tomorrow
Lennart Poettering [Tue, 11 Jul 2017 17:17:58 +0000 (19:17 +0200)] 
update NEWS file, let's try to release this tomorrow

6 years agotime-util: make parse_timestamp() return -EINVAL if the input is very old date (...
Yu Watanabe [Tue, 11 Jul 2017 17:12:48 +0000 (02:12 +0900)] 
time-util: make parse_timestamp() return -EINVAL if the input is very old date (#6327)

This reverts 7635ab8e74ea4a94e81143c3077570a986df375c and makes parse_timestamp()
return -EINVAL if the input is older than 1970-01-01.

Fixes #6290.

6 years agofstab-generator: Chase symlinks where possible (#6293)
Colin Walters [Tue, 11 Jul 2017 16:48:57 +0000 (12:48 -0400)] 
fstab-generator: Chase symlinks where possible (#6293)

This has a long history; see see 5261ba901845c084de5a8fd06500ed09bfb0bd80
which originally introduced the behavior.  Unfortunately that commit
doesn't include any rationale, but IIRC the basic issue is that
systemd wants to model the real mount state as units, and symlinks
make canonicalization much more difficult.

At the same time, on a RHEL6 system (upstart), one can make e.g. `/home` a
symlink, and things work as well as they always did; but one doesn't have
access to the sophistication of mount units (dependencies, introspection, etc.)
Supporting symlinks here will hence make it easier for people to do upgrades to
RHEL7 and beyond.

The `/home` as symlink case also appears prominently for OSTree; see
https://ostree.readthedocs.io/en/latest/manual/adapting-existing/

Further work has landed in the nspawn case for this; see e.g.
d944dc9553009822deaddec76814f5642a6a8176

A basic limitation with doing this in the fstab generator (and that I hit while
doing some testing) is that we obviously can't chase symlinks into mounts,
since the generator runs early before mounts. Or at least - doing so would
require multiple passes over the fstab data (as well as looking at existing
mount units), and potentially doing multi-phase generation. I'm not sure it's
worth doing that without a real world use case. For now, this will fix at least
the OSTree + `/home` <https://bugzilla.redhat.com/show_bug.cgi?id=1382873> case
mentioned above, and in general anyone who for whatever reason has symlinks in
their `/etc/fstab`.

6 years agobootctl: allow non-root user to run `bootctl status` (#5964)
Yu Watanabe [Tue, 11 Jul 2017 15:30:29 +0000 (00:30 +0900)] 
bootctl: allow non-root user to run `bootctl status` (#5964)

6 years agoMerge pull request #6329 from poettering/random-mini-fixes
Zbigniew Jędrzejewski-Szmek [Tue, 11 Jul 2017 15:25:26 +0000 (11:25 -0400)] 
Merge pull request #6329 from poettering/random-mini-fixes

random-util.c mini fixes

6 years agosystemd: do not stop units bound to inactive units while coldplugging (#6316)
Zbigniew Jędrzejewski-Szmek [Tue, 11 Jul 2017 08:45:03 +0000 (04:45 -0400)] 
systemd: do not stop units bound to inactive units while coldplugging (#6316)

When running systemd-analyze verify I would get a random subset of warnings
(sometimes none, sometimes one or two):

dev-mapper-luks\x2d8db85dcf\x2d6230\x2d4e88\x2d940d\x2dba176d062b31.swap: Unit is bound to inactive unit dev-mapper-luks\x2d8db85dcf\x2d6230\x2d4e88\x2d940d\x2dba176d062b31.device. Stopping, too.
home.mount: Unit is bound to inactive unit dev-disk-by\x2duuid-75751556\x2d6e31\x2d438b\x2d99c9\x2dd626330d9a1b.device. Stopping, too.
boot.mount: Unit is bound to inactive unit dev-disk-by\x2duuid-56c56bfd\x2d93f0\x2d48fb\x2dbc4b\x2d90aa67144ea5.device. Stopping, too.

When running with debug on, it's pretty obvious what is happening:

home.mount: Changed dead -> mounted
home.mount: Unit is bound to inactive unit dev-disk-by\x2duuid-75751556\x2d6e31\x2d438b\x2d99c9\x2dd626330d9a1b.device. Stopping, too.
home.mount: Trying to enqueue job home.mount/stop/fail
home.mount: Installed new job home.mount/stop as 27
home.mount: Enqueued job home.mount/stop as 27
...
dev-disk-by\x2duuid-75751556\x2d6e31\x2d438b\x2d99c9\x2dd626330d9a1b.device: Installed new job dev-disk-by\x2duuid-75751556\x2d6e31\x2d438b\x2d99c9\x2dd626330d9a1b.device/start as 47
dev-disk-by\x2duuid-75751556\x2d6e31\x2d438b\x2d99c9\x2dd626330d9a1b.device: Changed dead -> plugged
dev-disk-by\x2duuid-75751556\x2d6e31\x2d438b\x2d99c9\x2dd626330d9a1b.device: Job dev-disk-by\x2duuid-75751556\x2d6e31\x2d438b\x2d99c9\x2dd626330d9a1b.device/start finished, result=done

Fixes #2206, https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=808151.

6 years agoresolved: allow resolution of names which libidn2 considers invalid (#6315)
Zbigniew Jędrzejewski-Szmek [Tue, 11 Jul 2017 08:42:21 +0000 (04:42 -0400)] 
resolved: allow resolution of names which libidn2 considers invalid (#6315)

https://tools.ietf.org/html/rfc5891#section-4.2.3.1 says that
> The Unicode string MUST NOT contain "--" (two consecutive hyphens) in the third
> and fourth character positions and MUST NOT start or end with a "-" (hyphen).
This means that libidn2 refuses to encode such names.
Let's just resolve them without trying to use IDN.

6 years agoAdd comments to log_functions which shouldn't be called from library code (#6326)
Zbigniew Jędrzejewski-Szmek [Tue, 11 Jul 2017 08:40:11 +0000 (04:40 -0400)] 
Add comments to log_functions which shouldn't be called from library code (#6326)

6 years agorandom-util: we are fine if ints are 16 bytes actually 6329/head
Lennart Poettering [Tue, 11 Jul 2017 08:36:53 +0000 (10:36 +0200)] 
random-util: we are fine if ints are 16 bytes actually

Not that it matters IRL, but let's make this less surprising to read...

6 years agorandom-util: always cast from smaller to bigger type when comparing
Lennart Poettering [Tue, 11 Jul 2017 08:35:47 +0000 (10:35 +0200)] 
random-util: always cast from smaller to bigger type when comparing

When we compare two size values, let's make sure we cast from the
smaller to the bigger type first, if both types differ, rather than the
reverse in order to not run into overflows.

6 years agoMerge pull request #6325 from keszybz/make-delta-boring-again
Lennart Poettering [Tue, 11 Jul 2017 08:00:21 +0000 (10:00 +0200)] 
Merge pull request #6325 from keszybz/make-delta-boring-again

Make delta output repeatable

6 years agoMerge pull request #6322 from poettering/mount-mini-fixes
Zbigniew Jędrzejewski-Szmek [Mon, 10 Jul 2017 23:25:27 +0000 (19:25 -0400)] 
Merge pull request #6322 from poettering/mount-mini-fixes

a bunch of mini fixes for mount-tool.c

6 years agojournal: explicitly add fds to mmap-cache (#6307)
Vito Caputo [Mon, 10 Jul 2017 23:24:56 +0000 (16:24 -0700)] 
journal: explicitly add fds to mmap-cache (#6307)

This way we have a MMapFileDescriptor reference external to the cache,
and can supply the handle directly to mmap_cache_get(), eliminating
hashmap lookups entirely from the hot path.

6 years agohwdb: add axis range corrections for Lenovo X1 Carbon 5th gen (over (#6320)
Alex Lu [Mon, 10 Jul 2017 20:34:40 +0000 (04:34 +0800)] 
hwdb: add axis range corrections for Lenovo X1 Carbon 5th gen (over (#6320)

rmi4).

6 years agomount: add missing validation error message 6322/head
Lennart Poettering [Mon, 10 Jul 2017 19:42:39 +0000 (21:42 +0200)] 
mount: add missing validation error message

We really should generate exactly one log message for each error, hence
let's do that in this one case too.

6 years agodelta: sort files and dirs before processing 6325/head
Zbigniew Jędrzejewski-Szmek [Mon, 10 Jul 2017 19:40:01 +0000 (15:40 -0400)] 
delta: sort files and dirs before processing

This should make output deterministic, and independent of the directory
layout on disk. Just using ordered hashmaps would be enough to make
the output deterministic on a specific machine, but to make it
identical on different machines with the same set of files and
directories, names are sorted after being use.

Fixes #6157.

6 years agomount: change find_loop_device() error code when no loop device is found to ENXIO
Lennart Poettering [Mon, 10 Jul 2017 19:41:14 +0000 (21:41 +0200)] 
mount: change find_loop_device() error code when no loop device is found to ENXIO

ENOENT is a bit too likely to be returned for various reasons, for
example if /sys or /proc are not mounted and hence the files we need not
around. Hence, let's use ENXIO instead, which is equally fitting for the
purpose but has the benefit that the underlying calls won't generate
this error on their own, hence any ambiguity is removed.

6 years agomount: add debug logging for the case when we knowingly ignore an error
Lennart Poettering [Mon, 10 Jul 2017 19:41:02 +0000 (21:41 +0200)] 
mount: add debug logging for the case when we knowingly ignore an error

6 years agobasic/strv: use existing qsort_safe() helper
Zbigniew Jędrzejewski-Szmek [Mon, 10 Jul 2017 18:55:14 +0000 (14:55 -0400)] 
basic/strv: use existing qsort_safe() helper

strv_sort() predates qsort_safe(), but we can convert it to it to
save a few lines.

6 years agomount: rework find_loop_device() to log about no errors
Lennart Poettering [Mon, 10 Jul 2017 19:39:23 +0000 (21:39 +0200)] 
mount: rework find_loop_device() to log about no errors

We should either log about all errors in a function, or about none (and
then leave the logging about it to the caller who we propagate the error
to). Given that the callers of find_loop_device() already log about the
returned errors let's hence suppress the log messages in
find_loop_device() itself.

6 years agomount: fix potential bad memory access when /proc/self/mountinfo is empty
Lennart Poettering [Mon, 10 Jul 2017 19:36:59 +0000 (21:36 +0200)] 
mount: fix potential bad memory access when /proc/self/mountinfo is empty

It's unlikely this can ever be triggered, but let's be safe rather than
sorry, and handle the case where the list of mount points is zero, and
the "l" array thus NULL. let's ensure we allocate at least one entry.

6 years agoman: briefly document permitted user/group name syntax for User=/Group= and syusers...
Lennart Poettering [Mon, 10 Jul 2017 17:44:06 +0000 (19:44 +0200)] 
man: briefly document permitted user/group name syntax for User=/Group= and syusers.d (#6321)

As discussed here:

https://lists.freedesktop.org/archives/systemd-devel/2017-July/039237.html

6 years agoupdate TODO
Lennart Poettering [Mon, 10 Jul 2017 16:25:58 +0000 (18:25 +0200)] 
update TODO

6 years agoexpand path of systemctl link argument (#6186)
Boucman [Sun, 9 Jul 2017 23:52:25 +0000 (01:52 +0200)] 
expand path of systemctl link argument (#6186)

systemctl link is the only systemctl verb that takes a filename (and not
a unit name) as argument

use path_strv_make_absolute_cwd to expand the provided filename in order
to make it easier to use from the command line

keep the absolute pathname requirement when --root is used

[zj: add explicit error messages for the cases of --root and plain filename
instead of skipping normalization and just relying on systemd to refuse
to link non-absolute arguments. This allows us to make the error message
more informative.]

6 years agoMerge pull request #6287 from keszybz/wsign-compare
Djalal Harouni [Sun, 9 Jul 2017 22:23:57 +0000 (00:23 +0200)] 
Merge pull request #6287 from keszybz/wsign-compare

build-sys: use -Wextra if available

6 years agoMerge pull request #6289 from keszybz/config-tweaks
Djalal Harouni [Sun, 9 Jul 2017 22:19:44 +0000 (00:19 +0200)] 
Merge pull request #6289 from keszybz/config-tweaks

Config parsing tweaks

6 years agohwdb: add axis range corrections for Lenovo X1 Carbon 5th gen. (#6312)
Alex Lu [Sun, 9 Jul 2017 22:08:25 +0000 (06:08 +0800)] 
hwdb: add axis range corrections for Lenovo X1 Carbon 5th gen. (#6312)

6 years agoMerge pull request #6311 from keszybz/memleak
Djalal Harouni [Sun, 9 Jul 2017 15:58:52 +0000 (17:58 +0200)] 
Merge pull request #6311 from keszybz/memleak

Fix trivial memleak in sd-login code

6 years agounits: Tell login to preserve environment (#6023)
Nikolai Kondrashov [Wed, 24 May 2017 11:58:01 +0000 (14:58 +0300)] 
units: Tell login to preserve environment (#6023)

Make agetty started by *getty* units pass '-p' option to "login", so it
doesn't clear the environment and passes whatever was setup by systemd
to shells. This is needed especially for programs which are specified as
user shells, but won't read locale settings from anywhere but
environment.

[zj: cherry-pick just the second patch from the series, see discussion
on the pull request.]

6 years agosd_uid_get_state: do not return -ENOENT if state is "offline" (#6302)
Yu, Li-Yu [Sat, 8 Jul 2017 22:59:29 +0000 (17:59 -0500)] 
sd_uid_get_state: do not return -ENOENT if state is "offline" (#6302)

6 years agosd-login: fix memleak when output argument is NULL 6311/head
Zbigniew Jędrzejewski-Szmek [Sat, 8 Jul 2017 22:04:44 +0000 (18:04 -0400)] 
sd-login: fix memleak when output argument is NULL

6 years agonetworkd: trivial style cleanup
Zbigniew Jędrzejewski-Szmek [Wed, 5 Jul 2017 00:04:29 +0000 (20:04 -0400)] 
networkd: trivial style cleanup

6 years agotime-util: make parse_timestamp() set 0 if the input is very old date (#6297)
Yu Watanabe [Sat, 8 Jul 2017 19:59:07 +0000 (04:59 +0900)] 
time-util: make parse_timestamp() set 0 if the input is very old date (#6297)

If the input is older than "1970-01-01 UTC", then `parse_timestamp()`
fails and returns -EINVAL. However, if the input is e.g. `-100years`,
then the function succeeds and sets `usec = 0`.
This commit makes the function also succeed for old dates and set
`usec = 0`.

Fixes #6290.

6 years agoshared: leave output_journal() output in buffer (#6304)
Vito Caputo [Fri, 7 Jul 2017 18:32:21 +0000 (11:32 -0700)] 
shared: leave output_journal() output in buffer (#6304)

e268b81e moved an fflush() from output_json() to the generic
output_journal(), when it probably should have deleted all fflush()
calls from logs-show.c altogether.

The caller supplies the FILE * to these functions, and should be in
charge of flushing as needed.  The current implementation essentially
defeats any buffering stdio was bringing to the table, resulting in
extraneous tiny write() calls in commands like `journalctl -b`.

This commit removes the fflush() call from output_journal(), and adds
them to journalctl before waiting for more entries and at completion.
This way in the hot path when journalctl loops on entries stdio can
combine multiple entries into bulkier write() calls.

6 years agotests: adapt test-functions to run tests on SUSE (#6270)
tblume [Thu, 6 Jul 2017 18:30:14 +0000 (20:30 +0200)] 
tests: adapt test-functions to run tests on SUSE (#6270)

6 years agoresolve: Try to remove the ambiguity about the mtu parameter of dns_packet_new (...
Benjamin Robin [Thu, 6 Jul 2017 02:56:17 +0000 (04:56 +0200)] 
resolve: Try to remove the ambiguity about the mtu parameter of dns_packet_new (#6285)

Actually the caller of dns_packet_new() pass 0 or the data size of the UDP message.
So try to reflect that, so rename the `mtu` parameter to `min_alloc_dsize`.

In fact `mtu` is the size of the whole UDP message, including the UDP header,
and here we just need to pass the size of data (without header). This was confusing.

Also add a check on the requested allocated size, since some caller do not check what is really allocated.
Indeed the function do not allocate more than DNS_PACKET_SIZE_MAX whatever the value of the `mtu` parameter.

6 years agofstab-generator: fix new NULL dereference. (#6296)
NeilBrown [Thu, 6 Jul 2017 02:53:41 +0000 (12:53 +1000)] 
fstab-generator: fix new NULL dereference. (#6296)

fstype can be NULL, particularly when called from add_sysroot_mount(),
so we need to use STRPTR_IN_SET().

6 years agoMerge pull request #6236 from yuwata/mount-loop
Zbigniew Jędrzejewski-Szmek [Wed, 5 Jul 2017 14:27:58 +0000 (10:27 -0400)] 
Merge pull request #6236 from yuwata/mount-loop

systemd-mount: support discovery of loop backing file

6 years agosystemd-mount: support relative paths 6236/head
Yu Watanabe [Thu, 29 Jun 2017 05:53:49 +0000 (14:53 +0900)] 
systemd-mount: support relative paths

6 years agosystemd-mount: support unmounting devices on remote host
Yu Watanabe [Wed, 5 Jul 2017 12:55:39 +0000 (21:55 +0900)] 
systemd-mount: support unmounting devices on remote host

The commit 9017f5d88d5061487de53f00a1a8c0a83e41e760 prohibits
to unmount devices on remote host. This makes reenable such feature.

6 years agosystemd-mount: support discovery of loop backing file
Yu Watanabe [Wed, 5 Jul 2017 12:54:40 +0000 (21:54 +0900)] 
systemd-mount: support discovery of loop backing file

```
$ suro systemd-mount /path/to/disk.img
Started unit run-media-system-disk.img.mount for mount point: /run/media/system/disk.img
```

Closes #6226.

6 years agobasic/log: use getenv instead of secure_getenv 6289/head
Zbigniew Jędrzejewski-Szmek [Wed, 5 Jul 2017 03:54:00 +0000 (23:54 -0400)] 
basic/log: use getenv instead of secure_getenv

secure_getenv does not work when the process has a nonempty permitted
capability set, which means that it's unduly hard to configure logging in
systemd-logind, systemd-resolved, and others.

secure_getenv is useful for code in libraries which might get called from a
setuid application. log_parse_environment() is never called from our library
code, but directly form various top-level executables. None of them are
installed suid, and none are prepared to be used this way, since many
additional changes would be required to make that safe. We may just as well
drop the check and allow SYSTEMD_LOG_* to properly parsed.

Fixes #4900.

6 years agoresolved: treat failure to parse config as non-fatal
Zbigniew Jędrzejewski-Szmek [Wed, 5 Jul 2017 03:51:35 +0000 (23:51 -0400)] 
resolved: treat failure to parse config as non-fatal

Fixes #6014.

6 years agotest-fs-util: re-order test_readlink_and_make_absolute and test_get_files_in_director...
Mike Gilbert [Wed, 5 Jul 2017 03:22:47 +0000 (23:22 -0400)] 
test-fs-util: re-order test_readlink_and_make_absolute and test_get_files_in_directory (#6288)

test_readlink_and_make_absolute switches to a temp directory, and then
removes it.

test_get_files_in_directory calls opendir(".") from a directory that has
been removed from the filesystem.

This call sequence triggers a bug in Gentoo's sandbox library. This
library attempts to resolve the "." to an absolute path, and aborts when
it ultimately fails to do so.

Re-ordering the calls works around the issue until the sandbox library
can be fixed to more gracefully deal with this.

Bug: https://bugs.gentoo.org/590084

6 years agomeson: use -Wextra if available 6287/head
Zbigniew Jędrzejewski-Szmek [Tue, 4 Jul 2017 21:59:15 +0000 (17:59 -0400)] 
meson: use -Wextra if available

-Wextra was not added to CFLAGS under meson by default, as it is
done by the autotools build.

C.f. 218f46711115669c26389a5bad79e57aa3c37f66.

6 years agosystemctl: print next timer trigger time with the status verb (#6242)
Giedrius Statkevičius [Tue, 4 Jul 2017 21:51:02 +0000 (00:51 +0300)] 
systemctl: print next timer trigger time with the status verb (#6242)

It is useful to know when a timer will trigger next when looking at a
timer status message so calculate and print that information.

Closes #5738.

Example output:
$ systemctl status dnf-makecache.timer
● dnf-makecache.timer - dnf makecache timer
   Loaded: loaded (/usr/lib/systemd/system/dnf-makecache.timer; enabled; vendor preset: enabled)
   Active: active (waiting) since Tue 2017-07-04 17:24:02 EDT; 24min ago
  Trigger: Tue 2017-07-04 18:15:56 EDT; 27min left

6 years agobasic: Fix build warning in random-util (#6284)
Benjamin Robin [Tue, 4 Jul 2017 21:42:20 +0000 (23:42 +0200)] 
basic: Fix build warning in random-util (#6284)

6 years agogpt-auto-generator: fix the handling of the value returned by fstab_has_fstype()...
Franck Bui [Tue, 4 Jul 2017 15:41:09 +0000 (17:41 +0200)] 
gpt-auto-generator: fix the handling of the value returned by fstab_has_fstype() in add_swap() (#6280)

fstab_has_fstype() returns '1' if fstab contains the passed fstype, not '0'.

6 years agofstab-generator: handle NFS "bg" mounts correctly. (#6103)
NeilBrown [Tue, 4 Jul 2017 07:47:40 +0000 (17:47 +1000)] 
fstab-generator: handle NFS "bg" mounts correctly. (#6103)

When "bg" is specified for NFS mounts, and if the server is
not accessible, two behaviors are possible depending on networking
details.
If a definitive error is received, such a EHOSTUNREACH or ECONNREFUSED,
mount.nfs will fork and continue in the background, while /bin/mount
will report success.
If no definitive error is reported but the connection times out
instead, then the mount.nfs timeout will normally be longer than the
systemd.mount timeout, so mount.nfs will be killed by systemd.

In the first case the mount has appeared to succeed even though
it hasn't.  This can be confusing.  Also the background mount.nfs
will never get cleaned up, even if the mount unit is stopped.

In the second case, mount.nfs is killed early and so the mount will
not complete when the server comes back.

Neither of these are ideal.

This patch modifies the options when an NFS bg mount is detected to
force an "fg" mount, but retain the default "retry" time of 10000
minutes that applies to "bg" mounts.
It also imposes "nofail" behaviour and sets the TimeoutSec for the
mount to "infinity" so the retry= time is allowed to complete.
This provides near-identical behaviour to an NFS bg mount started directly
by "mount -a".  The only difference is that systemd will not wait for
the first mount attempt, while "mount -a" will.

Fixes #6046

6 years agoMerge pull request #6274 from keszybz/etags-ctags
Lennart Poettering [Tue, 4 Jul 2017 07:43:07 +0000 (09:43 +0200)] 
Merge pull request #6274 from keszybz/etags-ctags

meson: ctags support

6 years agoudev: move the KEY_* defines to missing.h (#6278)
Peter Hutterer [Tue, 4 Jul 2017 07:41:46 +0000 (17:41 +1000)] 
udev: move the KEY_* defines to missing.h (#6278)

6 years agofix add_esp() in the gpt-auto-generator.c (#6251)
Дамјан Георгиевски [Tue, 4 Jul 2017 07:40:59 +0000 (09:40 +0200)] 
fix add_esp() in the gpt-auto-generator.c (#6251)

b9088048b15cd21242b2308498fa865f864bfe45 seems to have broke it

fstab_is_mount_point() returns `true` (1) if the mount point exists and `false` (0) if it doesn't exist.

the change in b9088048 considered that if fstab_is_mount_point() returns 0
the mount point exists.

6 years agoMerge pull request #6255 from keszybz/property-escaping
Lennart Poettering [Tue, 4 Jul 2017 07:39:56 +0000 (09:39 +0200)] 
Merge pull request #6255 from keszybz/property-escaping

Proper property escaping

6 years agocore: link user keyring to session keyring (#6275)
Christian Hesse [Tue, 4 Jul 2017 07:38:31 +0000 (09:38 +0200)] 
core: link user keyring to session keyring (#6275)

Commit  74dd6b515fa968c5710b396a7664cac335e25ca8 (core: run each system
service with a fresh session keyring) broke adding keys to user keyring.
Added keys could not be accessed with error message:

keyctl_read_alloc: Permission denied

So link the user keyring to our session keyring.

6 years agoMerge pull request #6258 from vcaputo/overflow
Zbigniew Jędrzejewski-Szmek [Tue, 4 Jul 2017 01:29:14 +0000 (21:29 -0400)] 
Merge pull request #6258 from vcaputo/overflow

fix strxcpyx null termination overflows

6 years agotest-strxcpyx: add test for strpcpyf overflow 6258/head
Zbigniew Jędrzejewski-Szmek [Sun, 2 Jul 2017 16:37:42 +0000 (12:37 -0400)] 
test-strxcpyx: add test for strpcpyf overflow

This fails before 'strxcpyx: don't overflow dest on strpcpyf truncate'.

6 years agoNEWS: typo fixes (#6276)
Thomas H. P. Andersen [Mon, 3 Jul 2017 21:35:05 +0000 (23:35 +0200)] 
NEWS: typo fixes (#6276)

6 years agobuild-sys: fix automake build
Lennart Poettering [Mon, 3 Jul 2017 18:13:18 +0000 (20:13 +0200)] 
build-sys: fix automake build

Lennart broke the automake build in
d4cbada2a95667c4d5d4310298bfcb446b1357b5. Let's fix that again, to
unfuck the CIs.

6 years agoMerge pull request #6271 from poettering/resolved-switching
Zbigniew Jędrzejewski-Szmek [Mon, 3 Jul 2017 16:52:25 +0000 (12:52 -0400)] 
Merge pull request #6271 from poettering/resolved-switching

downgrade DNS server switching log messages + NEWS fixes

6 years agomeson: add support for ctags 6274/head
Zbigniew Jędrzejewski-Szmek [Mon, 3 Jul 2017 16:42:29 +0000 (12:42 -0400)] 
meson: add support for ctags

This is a squash of casync commits
https://github.com/systemd/casync/commit/02fbbdb2b9a926a695a3ede7f3e3c17b9779db1a
(by Silvio Fricke)
and https://github.com/systemd/casync/commit/b687a94b1e24df73d32f8cdcee29f3c00eae69c9.

Instead of checking during every meson config whether etags are
available, just try to call them and error out if not. This has
the advantage that the target is always available (if git is installed),
and the error message gives a hint what needs to be installed.

The naming is confusing, but etags(1) is pretty clear:
- emacs expects TAGS file in etags format
- vi expects tags file in ctags format
and automake docs are pretty clear too:
- tags target generates TAGS file
- ctags target generates tags file

6 years agovconsole: search for usable source console (#6180)
Michal Soltys [Mon, 3 Jul 2017 16:38:13 +0000 (18:38 +0200)] 
vconsole: search for usable source console (#6180)

When vconsole-setup is called without arguments, search for a usable
console instead of using /dev/tty0.

/dev/tty0 — pointing to the current active console — it not necessarily
usable and in such case vconsole-setup would exit with failure. In particular
when systemd-vconsole-setup.service was restarted from within an X
session, it always failed.

If the function searching for a usable source terminal fails, the first
encountered error is returned to the caller.

Closes #5367.

Additional changes:

- true/false functions with 'is_ prefix are renamed to functions with
  'verify_vc_' prefix and return 0 on success and negative error on
  failure
- O_NOCTTY flag is used when opening terminals

6 years agosd-boot: stub: Obtain PE section offsets from RAM, not disk (#6250)
Matthew Garrett [Fri, 30 Jun 2017 18:27:47 +0000 (11:27 -0700)] 
sd-boot: stub: Obtain PE section offsets from RAM, not disk (#6250)

In a Secure Boot scenario the stub loader will have been validated
before execution. A malicious drive could then change the data returned
in future reads, resulting in the loader obtaining incorrect section
offsets and (for instance) allowing the command line to be modified.
Pull that information out of the in-RAM representation of the loader
instead in order to avoid this.

Fixes: #6230
(Lennart did some minor coding style fixes, and renamed pefile.c → pe.c,
as suggested by Kay, given that the file now contains a function whose
name doesn't match the filename as prefix anymore.)

6 years agounits: use Requires in systemd-networkd-wait-online.service (#6065)
Zbigniew Jędrzejewski-Szmek [Mon, 3 Jul 2017 15:05:20 +0000 (11:05 -0400)] 
units: use Requires in systemd-networkd-wait-online.service (#6065)

In the initial design, foobar-wait-online.service would have
Requisite=foobar.service, so that foobar-wait-online.service could be enabled
unconditionally, irrespective of whether foobar.service itself is enabled.
Unfortunately this doesn't work too well:

1. the message about foobar-wait-online.service being skipped because of a
   "missing dependency" *looks* like an is problem. This is mostly cosmetic,
   but it also quite confusing. We generally don't want any messages of this
   type during default boot.

2. it is impossible to start and wait for the network in an
   implementation-agnostic way: systemctl start network-online.target, or
   Wants/After=network-online.target in a unit don't work because pulling in
   network-online.target pulls in foobar-wait-online.service, but it in turn
   does not pull in foobar.service. During startup, foobar.service is pulled in
   by multi-user.target, but not in a smaller transaction which does not
   include multi-user.target.

This change means that *-wait-online.service should be installed through
presets, so that it can be enabled/disabled at will by the administrator.
Our own systemd-networkd-wait-online.service does this already, and
similar change has been requested for NetworkManager-wait-online.service
(https://bugzilla.redhat.com/show_bug.cgi?id=1455704).

This change should by mostly backwards-compatible, unless somebody has some
wait-online.service enabled, without having the corresponding network
implementation enabled, and they are relying on it not being started.  I think
that's relatively unlikely because of issue 1. above, and I'm not aware of this
being the default in any distro. And being able to start the network in an
implementation-agnostic way is pretty important, see
https://bugzilla.redhat.com/show_bug.cgi?id=1452866.

6 years agoman: remove unnecessary "the"
Zbigniew Jędrzejewski-Szmek [Mon, 3 Jul 2017 14:33:42 +0000 (10:33 -0400)] 
man: remove unnecessary "the"

6 years agoMerge pull request #6231 from keszybz/man-nss-resolved
Lennart Poettering [Mon, 3 Jul 2017 14:11:16 +0000 (16:11 +0200)] 
Merge pull request #6231 from keszybz/man-nss-resolved

man: describe the relationship between nss-myhostname and nss-resolved

6 years agostrxcpyx: assert throughout on non-NULL src/dest
Vito Caputo [Sun, 2 Jul 2017 09:09:06 +0000 (02:09 -0700)] 
strxcpyx: assert throughout on non-NULL src/dest

6 years agostrxcpyx: don't overflow dest on strpcpyf truncate
Vito Caputo [Sun, 2 Jul 2017 09:01:59 +0000 (02:01 -0700)] 
strxcpyx: don't overflow dest on strpcpyf truncate

When vsnprintf() truncated output, dest was advanced by the entire
size of dest leaving it just past the end.  Then the fall-through \0
termination scribbled one past the end.  The explicit null termination
is not necessary since vsnprintf() always includes the terminator even
when truncated.

Additionally these functions encourage calling with zero-length sizes,
while assuming non-zero sizes with potential buffer overflows.

Simply short-circuit the relevant functions when size == 0.

Fixes https://github.com/systemd/systemd/issues/6252

6 years agobus-util: replace non-printable values with [unprintable] 6255/head
Zbigniew Jędrzejewski-Szmek [Sat, 1 Jul 2017 20:49:15 +0000 (16:49 -0400)] 
bus-util: replace non-printable values with [unprintable]

Like I said in the previous commit, such values do not seem to appear in normal
use, but it's pretty hard to prove that all paths to assign values properly
check that they contain no spaces. So just in case some slip through, replace
values with spaces (in case of single-valued properties) or spaces and newlines
(in case of array proprties) with "[unprintable]". We were already doing it
in case of properties which we didn't know how to print, so this fits in well.
The advantage is the previous code which used escaping that a) this is easier
to spot, b) does not mess up printing of properties which were properly escaped
already.

v2:
- add comments

6 years agoautomount: don't lstat(2) upon umount request (#6086)
Franck Bui [Mon, 3 Jul 2017 12:48:21 +0000 (14:48 +0200)] 
automount: don't lstat(2) upon umount request (#6086)

When umounting an NFS filesystem, it is not safe to lstat(2) the mountpoint at
all as that can block indefinitely if the NFS server is down.

umount() will not block, but lstat() will.

This patch therefore removes the call to lstat(2) and defers the handling of
any error to the child process which will issue the umount call.

6 years agoParse "timeout=0" as infinity in various generators (#6264)
Zbigniew Jędrzejewski-Szmek [Mon, 3 Jul 2017 12:29:32 +0000 (08:29 -0400)] 
Parse "timeout=0" as infinity in various generators (#6264)

This extends 2d79a0bbb9f651656384a0a86ed814e6306fb5dd to the kernel
command line parsing.

The parsing is changed a bit to only understand "0" as infinity. If units are
specified, parse normally, e.g. "0s" is just 0. This makes it possible to
provide a zero timeout if necessary.

Simple test is added.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1462378.

6 years agoMerge pull request #6235 from mbiebl/var-log-lastlog
Lennart Poettering [Mon, 3 Jul 2017 09:47:30 +0000 (11:47 +0200)] 
Merge pull request #6235 from mbiebl/var-log-lastlog

tmpfiles: create /var/log/lastlog if it does not exist

6 years agoMerge pull request #6233 from keszybz/man-locale-vconsole
Lennart Poettering [Mon, 3 Jul 2017 09:40:42 +0000 (11:40 +0200)] 
Merge pull request #6233 from keszybz/man-locale-vconsole

Small doc updates for 00-keyboard.conf, vconsole.conf, locale.conf

6 years agogit-contrib: drop weird non-breaking spaces 6271/head
Lennart Poettering [Mon, 3 Jul 2017 09:22:38 +0000 (11:22 +0200)] 
git-contrib: drop weird non-breaking spaces

For some reason git shortlog spits out non-breaking spaces, let's remove
that, as for our purposes (inclusion in NEWS) we really want breaking
(i.e. normal) spaces.

6 years agoresolved: downgrade log messages about switching DNS servers
Lennart Poettering [Mon, 3 Jul 2017 09:20:04 +0000 (11:20 +0200)] 
resolved: downgrade log messages about switching DNS servers

As suggested in:

https://github.com/systemd/systemd/commit/496ae8c84b2d3622bc767a727e3582e2b6bcffcd#commitcomment-22819483

Let's drop some noise from the logs, as switching between DNS servers is
definitely useful for debugging, but shouldn't get more attention that
that.

6 years agoNEWS: tweak contributors list a bit
Lennart Poettering [Mon, 3 Jul 2017 09:19:20 +0000 (11:19 +0200)] 
NEWS: tweak contributors list a bit

Let's add more .mailmap entries to clean up GitHub's mess.

6 years agoMerge pull request #6257 from keszybz/unnecessary-job-log
Lennart Poettering [Mon, 3 Jul 2017 08:48:28 +0000 (10:48 +0200)] 
Merge pull request #6257 from keszybz/unnecessary-job-log

core: do not print color console message about gc-ed jobs

6 years agoMerge pull request #6218 from poettering/v234-pre
Lennart Poettering [Mon, 3 Jul 2017 08:43:00 +0000 (10:43 +0200)] 
Merge pull request #6218 from poettering/v234-pre

preparation for v234

6 years agoudev: define BTN_DPAD_RIGHT if not present (#6267)
Peter Hutterer [Mon, 3 Jul 2017 08:03:22 +0000 (18:03 +1000)] 
udev: define BTN_DPAD_RIGHT if not present (#6267)

Regression introduced in commit b876bc0 when building on systemds with a pre
3.11 headers (RHEL7 and derivatives).

All the DPAD defines were introduced in the same kernel commit
d09bbfd2a8408a9954, we don't need a separate ifdef check for right.

Fixes #6240

6 years agonspawn: wait for the scope to be created (#6261)
Zbigniew Jędrzejewski-Szmek [Mon, 3 Jul 2017 05:59:49 +0000 (01:59 -0400)] 
nspawn: wait for the scope to be created (#6261)

Fixes #6253.

6 years agoman: add zypper instructions for systemd-nspawn 6231/head
Zbigniew Jędrzejewski-Szmek [Sun, 2 Jul 2017 17:37:27 +0000 (13:37 -0400)] 
man: add zypper instructions for systemd-nspawn

v2:
- add -c and update the list of packages
v3:
- link to a man page on mankier.com

6 years agohwdb: Add SNES Mouse plugged through Retrode 2 (#6263)
hadess [Sun, 2 Jul 2017 20:59:44 +0000 (22:59 +0200)] 
hwdb: Add SNES Mouse plugged through Retrode 2 (#6263)

Note that this will only work with the new "hid-retrode" driver in the
upcoming 4.12 kernel as otherwise the mouse events and the 4 joypad
ports are bundled into a single event node.

6 years agoBe slightly more verbose in error message 6257/head
Zbigniew Jędrzejewski-Szmek [Sun, 2 Jul 2017 16:03:25 +0000 (12:03 -0400)] 
Be slightly more verbose in error message

Including the full path is always useful.

Also use PID_FMT in one more place.

6 years agocore/loopback-setup: make log messages nicer
Zbigniew Jędrzejewski-Szmek [Sun, 2 Jul 2017 14:23:07 +0000 (10:23 -0400)] 
core/loopback-setup: make log messages nicer

Under nspawn, systemd would print:

Got address error code: Operation not permitted
Got address error code: Operation not permitted
Got start error code: Operation not permitted

which is quite unclear out of context. Change that to:

Failed to add address 127.0.0.1 to loopback interface: Operation not permitted
Failed to add address ::1 to loopback interface: Operation not permitted
Failed to bring loopback interface up: Operation not permitted

6 years agocore: do not print color console message about gc-ed jobs
Zbigniew Jędrzejewski-Szmek [Sat, 1 Jul 2017 23:05:36 +0000 (19:05 -0400)] 
core: do not print color console message about gc-ed jobs

This is just a cosmetic issue.

Garbage collection of jobs (especially the ones that we create automatically)
is something of an internal implementation detail and should not be made
visible to the users. But it's probably still useful to log this in the
journal, so the code is rearranged to skip one of the messages if we log to the
console and the journal separately, and to keep the message if we log
everything to the console.

Fixes #6254.

6 years agoRevert "bus: when dumping string property values escape the chars we use as end-of...
Zbigniew Jędrzejewski-Szmek [Sat, 1 Jul 2017 20:17:12 +0000 (16:17 -0400)] 
Revert "bus: when dumping string property values escape the chars we use as end-of-line and end-of-item marks"

This reverts commit 27e9c5af817147ea1c678769e45e83f2e4b4ae96.

Property values already use escaping, so escaping them a second time is
confusing. It also should be mostly unnecessary: we take care to make property
values only contains strings which (after the initial escaping) are printable
and parseable without any futher escaping.

Before revert:
$ systemctl list-dependencies 'dev-mapper-luks\x2d8db85dcf\x2d6230\x2d4e88\x2d940d\x2dba176d062b31.device'
dev-mapper-luks\x2d8db85dcf\x2d6230\x2d4e88\x2d940d\x2dba176d062b31.device
● ├─dev-mapper-luks\x2d8db85dcf\x2d6230\x2d4e88\x2d940d\x2dba176d062b31.swap
● └─systemd-cryptsetup@luks\x2d8db85dcf\x2d6230\x2d4e88\x2d940d\x2dba176d062b31.service
$ systemctl show -p Wants,Requires 'dev-mapper-luks\x2d8db85dcf\x2d6230\x2d4e88\x2d940d\x2dba176d062b31.device'
Requires=systemd-cryptsetup@luks\x5cx2d8db85dcf\x5cx2d6230\x5cx2d4e88\x5cx2d940d\x5cx2dba176d062b31.service
Wants=dev-mapper-luks\x5cx2d8db85dcf\x5cx2d6230\x5cx2d4e88\x5cx2d940d\x5cx2dba176d062b31.swap

Difference between systemctl show before revert and now:
-Slice=system-systemd\x5cx2dcryptsetup.slice
+Slice=system-systemd\x2dcryptsetup.slice

-Id=systemd-cryptsetup@luks\x5cx2d8db85dcf\x5cx2d6230\x5cx2d4e88\x5cx2d940d\x5cx2dba176d062b31.service
+Id=systemd-cryptsetup@luks\x2d8db85dcf\x2d6230\x2d4e88\x2d940d\x2dba176d062b31.service

-Names=systemd-cryptsetup@luks\x5cx2d8db85dcf\x5cx2d6230\x5cx2d4e88\x5cx2d940d\x5cx2dba176d062b31.service
+Names=systemd-cryptsetup@luks\x2d8db85dcf\x2d6230\x2d4e88\x2d940d\x2dba176d062b31.service

-Requires=system-systemd\x5cx2dcryptsetup.slice
+Requires=system-systemd\x2dcryptsetup.slice

-BindsTo=dev-mapper-luks\x5cx2d8db85dcf\x5cx2d6230\x5cx2d4e88\x5cx2d940d\x5cx2dba176d062b31.device dev-disk-by\x5cx2duuid-8db85dcf\x5cx2d6230\x5cx2d4e88\x5cx2d940d\x5cx2dba176d062b31.device
+BindsTo=dev-mapper-luks\x2d8db85dcf\x2d6230\x2d4e88\x2d940d\x2dba176d062b31.device dev-disk-by\x2duuid-8db85dcf\x2d6230\x2d4e88\x2d940d\x2dba176d062b31.device

-RequiredBy=dev-mapper-luks\x5cx2d8db85dcf\x5cx2d6230\x5cx2d4e88\x5cx2d940d\x5cx2dba176d062b31.device cryptsetup.target
+RequiredBy=dev-mapper-luks\x2d8db85dcf\x2d6230\x2d4e88\x2d940d\x2dba176d062b31.device cryptsetup.target

-WantedBy=dev-disk-by\x5cx2duuid-8db85dcf\x5cx2d6230\x5cx2d4e88\x5cx2d940d\x5cx2dba176d062b31.device
+WantedBy=dev-disk-by\x2duuid-8db85dcf\x2d6230\x2d4e88\x2d940d\x2dba176d062b31.device

6 years agoNEWS: mention that logind is restartable 6218/head
Zbigniew Jędrzejewski-Szmek [Fri, 30 Jun 2017 17:36:42 +0000 (13:36 -0400)] 
NEWS: mention that logind is restartable

6 years agomailmap: some additions for recent commits
Zbigniew Jędrzejewski-Szmek [Fri, 30 Jun 2017 17:20:23 +0000 (13:20 -0400)] 
mailmap: some additions for recent commits

6 years agoMerge pull request #6194 from keszybz/urandom-magic
Zbigniew Jędrzejewski-Szmek [Fri, 30 Jun 2017 17:05:56 +0000 (13:05 -0400)] 
Merge pull request #6194 from keszybz/urandom-magic

Fall back to /dev/urandom less and other random number improvements.

6 years agoethtool: fix half-duplex / full-duplex confusion (#6209)
Susant Sahani [Fri, 30 Jun 2017 16:55:21 +0000 (16:55 +0000)] 
ethtool: fix half-duplex / full-duplex confusion (#6209)

The values that we used for half-duplex and full-duplex in ethtool_set_glinksettings were
reversed wrt. what the kernel uses.

6 years agocore/automount: revise the "fun fact" comments. (#6245)
NeilBrown [Fri, 30 Jun 2017 16:51:33 +0000 (02:51 +1000)] 
core/automount: revise the "fun fact" comments. (#6245)

Fun fact 1 suggests that a "close()" is needed, but that close() has long since been
removed.  So the comment in now meaningless and possibly confusing.

Fun fact 2 refers to a bug that has been fixed in Linux prior to v4.12

Commit: 9fa4eb8e490a ("autofs: sanity check status reported with AUTOFS_DEV_IOCTL_FAIL")

so revise the comment so that no-one goes pointlessly looking for the bug.

6 years agoman: add more detail about quoting in ExecStart lines
Zbigniew Jędrzejewski-Szmek [Thu, 29 Jun 2017 02:29:41 +0000 (22:29 -0400)] 
man: add more detail about quoting in ExecStart lines

Fixes #624.

6 years agoman: fix spelling error of sd_bus_error_set_const (#6246)
Lars Karlitski [Fri, 30 Jun 2017 09:57:13 +0000 (11:57 +0200)] 
man: fix spelling error of sd_bus_error_set_const (#6246)

6 years agoInclude dpad buttons in joystick detection (#6240)
hramrach [Fri, 30 Jun 2017 00:23:58 +0000 (02:23 +0200)] 
Include dpad buttons in joystick detection (#6240)

Since f472d466ec26 ("Remove BTN_DPAD_* keys from ID_INPUT_KEY test
    (#5701)") dpad buttons are excluded from keyboard keys for keyboard
detection.

Include them in joystick buttons for joystick detection.