platform/upstream/systemd.git
7 years agoMerge pull request #6199 from poettering/systemctl-quiet
Zbigniew Jędrzejewski-Szmek [Tue, 27 Jun 2017 00:16:39 +0000 (20:16 -0400)]
Merge pull request #6199 from poettering/systemctl-quiet

systemctl: be truly quiet in systemctl when -q is used

7 years agoMerge pull request #6203 from poettering/import-assert
Zbigniew Jędrzejewski-Szmek [Tue, 27 Jun 2017 00:03:14 +0000 (20:03 -0400)]
Merge pull request #6203 from poettering/import-assert

remove misplaced importd assert

7 years agoMerge pull request #6160 from poettering/non-pollable-fdstore
Evgeny Vereshchagin [Mon, 26 Jun 2017 21:22:58 +0000 (00:22 +0300)]
Merge pull request #6160 from poettering/non-pollable-fdstore

support for non-pollable fds in the service fdstore

7 years agosystemd-mount: support device names and multiple arguments for umount (#6096)
Yu Watanabe [Mon, 26 Jun 2017 20:07:07 +0000 (05:07 +0900)]
systemd-mount: support device names and multiple arguments for umount (#6096)

This makes systemd-umount (or systemd-mount -u) supports multiple arguments
which can be path, device, or fstab style node name, like
`systemd-umount /path/to/umount /dev/sda1 UUID=xxxxxx-xxxx LABEL=xxxxx`.

C.f. https://github.com/systemd/systemd/pull/5235#issuecomment-277731314.

7 years agosmack: handling smack onlycap list (#5542)
WaLyong Cho [Mon, 26 Jun 2017 19:00:03 +0000 (04:00 +0900)]
smack: handling smack onlycap list (#5542)

To support smack onlycap, read onlycap list from /etc/smack/onlycap and write
to /sys/fs/smackfs/onlycap.

https://lwn.net/Articles/292128/
http://lkml.iu.edu/hypermail/linux/kernel/1505.2/04718.html
http://schaufler-ca.com/description_from_the_linux_source_tree

7 years agoMerge pull request #6116 from richardmaw-codethink/networkd-carrier-fixes
Lennart Poettering [Mon, 26 Jun 2017 18:55:36 +0000 (20:55 +0200)]
Merge pull request #6116 from richardmaw-codethink/networkd-carrier-fixes

Networkd fixes related to carrier status

7 years agosystemctl: quieten a few more messages if -q is specified
Lennart Poettering [Mon, 26 Jun 2017 18:42:08 +0000 (20:42 +0200)]
systemctl: quieten a few more messages if -q is specified

As suggested by @mbiebl in https://github.com/systemd/systemd/pull/6199

7 years agoimportd: log more information when renaming files
Lennart Poettering [Mon, 26 Jun 2017 18:32:40 +0000 (20:32 +0200)]
importd: log more information when renaming files

7 years agoimport: remove misplaced assert()
Lennart Poettering [Mon, 26 Jun 2017 18:25:07 +0000 (20:25 +0200)]
import: remove misplaced assert()

We shouldn't assume the final path for the settings file is already
known, it unlikely is unless we already downloaded the image once. Also
add some commenting to explain the code surrounding the assert a bit.

Fixes: #6188

7 years agosystemctl: be truly quiet in systemctl -q is-enabled
Lennart Poettering [Mon, 26 Jun 2017 14:11:20 +0000 (16:11 +0200)]
systemctl: be truly quiet in systemctl -q is-enabled

Fixes: #6196

7 years agocore: make NotifyAccess= and FileDescriptorStoreMax= available to transient services
Lennart Poettering [Wed, 21 Jun 2017 17:17:38 +0000 (19:17 +0200)]
core: make NotifyAccess= and FileDescriptorStoreMax= available to transient services

This is helpful for debugging/testing #5606.

7 years agocore: permit FDSTORE=1 messages with non-pollable fds
Lennart Poettering [Tue, 20 Jun 2017 21:30:30 +0000 (23:30 +0200)]
core: permit FDSTORE=1 messages with non-pollable fds

This also alters the documentation to recommend memfds rather than /run
for serializing state across reboots. That's because /run doesn't
actually have the same lifecycle as the fd store, as it is cleared out
on restarts.

Fixes: #5606

7 years agomeson: stop setting the linker (#6182)
Zbigniew Jędrzejewski-Szmek [Mon, 26 Jun 2017 13:00:46 +0000 (09:00 -0400)]
meson: stop setting the linker (#6182)

If wanted, the linker can be set with LDFLAGS (LDFLAGS=-Wl,-fuse-ld=gold meson ...),
and setting it internally was interfering with that. It seems that both gold and
bfd work very well and quick, and the reasons we had to prefer gold are not relevant
anymore.

Fixes #6169.

7 years agohwdb: Add ID_INPUT_JOYSTICK_INTEGRATION property (#5413)
hadess [Mon, 26 Jun 2017 10:17:36 +0000 (12:17 +0200)]
hwdb: Add ID_INPUT_JOYSTICK_INTEGRATION property (#5413)

When the joystick is integrated directly into the machine, knowing
that the device is internal allows us to disable attached functionality
when the device is not used or inaccessible.

For example, this allows disabling rumble and accelerometer on
flip-console-like devices like the GPD-XD.

7 years agohwdb: Cytrix Complex 11t accelerometer support (#5807)
James Hemsing [Mon, 26 Jun 2017 09:27:45 +0000 (03:27 -0600)]
hwdb: Cytrix Complex 11t accelerometer support (#5807)

Add quirk to fix portrait orientations resulting in an upside-down
screen on the Cytrix/Mytrix/Cube Complex 11t tablet.

7 years agocore: allow specifiers to be resolved in Environment= passed over dbus (#6144)
Zbigniew Jędrzejewski-Szmek [Mon, 26 Jun 2017 09:26:59 +0000 (05:26 -0400)]
core: allow specifiers to be resolved in Environment= passed over dbus (#6144)

When specifiers are included in the Environment block in StartTransientUnit,
we resolve specifiers on the PID1 side. Nevertheless we store the unresolved
version in the transient unit file, so that it'll be resolved when loading
the unit. I think this looks nicer.

I also removed the writing of the merged Environment block to the transient
file. Afaict, this resulted in variables being written multiple times, but
this needs to be tested properly.

Fixes #5699.

7 years agoCopy defines for renameat2 from casync (#6181)
Zbigniew Jędrzejewski-Szmek [Mon, 26 Jun 2017 07:34:03 +0000 (03:34 -0400)]
Copy defines for renameat2 from casync (#6181)

7 years agocore/loopback-setup: set a timeout for the kernel reply (#6187)
Zbigniew Jędrzejewski-Szmek [Mon, 26 Jun 2017 07:33:37 +0000 (03:33 -0400)]
core/loopback-setup: set a timeout for the kernel reply (#6187)

This shouldn't happen, but just in case for any reason the kernel
doesn't answer, it's probably much better to continue.

Follow-up for fb8939274a93d713575a409e9baab55a5638863a.

7 years agosystemd-link: add support to configure the device port (#6153)
Susant Sahani [Sun, 25 Jun 2017 22:42:57 +0000 (22:42 +0000)]
systemd-link: add support to configure the device port (#6153)

This work allows to configure device port:

tp — An Ethernet interface using Twisted-Pair cable as the medium.
aui — Attachment Unit Interface (AUI). Normally used with hubs.
bnc — An Ethernet interface using BNC connectors and co-axial cable.
mii — An Ethernet interface using a Media Independent Interface (MII).
fibre — An Ethernet interface using Optical Fibre as the medium.

7 years agoAdded slovak translation (#6191)
Dušan Kazik [Sun, 25 Jun 2017 17:19:10 +0000 (19:19 +0200)]
Added slovak translation (#6191)

Create sk.po and update LINGUAS.

7 years agoMerge pull request #6189 from keszybz/parse-hwdb-timeout
Michael Biebl [Sun, 25 Jun 2017 02:01:25 +0000 (04:01 +0200)]
Merge pull request #6189 from keszybz/parse-hwdb-timeout

meson: increase timeout for parse_hwdb.py test to 90 s

7 years agomeson: increase timeout for parse_hwdb.py test to 90 s
Michael Biebl [Sat, 24 Jun 2017 23:24:20 +0000 (19:24 -0400)]
meson: increase timeout for parse_hwdb.py test to 90 s

Fixes #5846.

7 years agoMerge pull request #5600 from fbuihuu/make-logind-restartable
Zbigniew Jędrzejewski-Szmek [Sat, 24 Jun 2017 22:58:36 +0000 (18:58 -0400)]
Merge pull request #5600 from fbuihuu/make-logind-restartable

Make logind restartable.

7 years agomake nss-systemd support conditional (#6155)
Waldemar Brodkorb [Sat, 24 Jun 2017 17:30:26 +0000 (19:30 +0200)]
make nss-systemd support conditional (#6155)

This allows the nss-systemd module to be disabled on minimal installations.

7 years agoMerge pull request #6185 from keszybz/env-serialization
Evgeny Vereshchagin [Sat, 24 Jun 2017 16:37:45 +0000 (19:37 +0300)]
Merge pull request #6185 from keszybz/env-serialization

Environment serialization fixes

7 years agotests: add tests for environment serialization
Zbigniew Jędrzejewski-Szmek [Sat, 24 Jun 2017 00:43:48 +0000 (20:43 -0400)]
tests: add tests for environment serialization

7 years agobasic/env-util: when serializing, actually use escaping
Zbigniew Jędrzejewski-Szmek [Sat, 24 Jun 2017 00:27:12 +0000 (20:27 -0400)]
basic/env-util: when serializing, actually use escaping

Fixes #6152.

7 years agomanager: just warn about an invalid environment entry
Zbigniew Jędrzejewski-Szmek [Fri, 23 Jun 2017 23:20:54 +0000 (19:20 -0400)]
manager: just warn about an invalid environment entry

Apart from bugs (as in #6152), this can happen if we ever make
our requirements for environment entries more stringent. As with
the rest of deserialization, we should just warn and continue.

7 years agomanager: raise level of notices about failed deserialization
Zbigniew Jędrzejewski-Szmek [Fri, 23 Jun 2017 23:17:40 +0000 (19:17 -0400)]
manager: raise level of notices about failed deserialization

This is something that shouldn't happen. If it does, we want to
know about it.

7 years agocore: fix typo (#6183)
Torstein Husebø [Fri, 23 Jun 2017 22:53:29 +0000 (00:53 +0200)]
core: fix typo (#6183)

7 years agoMerge pull request #6179 from poettering/loopback-addr
Zbigniew Jędrzejewski-Szmek [Fri, 23 Jun 2017 19:49:40 +0000 (15:49 -0400)]
Merge pull request #6179 from poettering/loopback-addr

Synchronously set up IP addresses of loopback device in loopback-setup.c.

7 years agoloopback-setup: also add IP addresses to loopback devices
Lennart Poettering [Fri, 23 Jun 2017 10:07:03 +0000 (12:07 +0200)]
loopback-setup: also add IP addresses to loopback devices

This changes loopback setup to not only start the loopback device but
also add the relevant IP addresses to it. This way, we can synchronously
wait until that's complete, and properly guarantee that loopback setup
is complete at the time we start our first processes.

This is a semi-revert of f3fc48150bb443f5b4623a819ebc2b39971a4f66, but
heavily updated.

Fixes: #5641

7 years agotest: show debug log output during test-loopback
Lennart Poettering [Fri, 23 Jun 2017 10:06:58 +0000 (12:06 +0200)]
test: show debug log output during test-loopback

7 years agoMerge pull request #6151 from speakinghedge/6150-LLDP-messages-containing-padding...
Lennart Poettering [Fri, 23 Jun 2017 07:57:23 +0000 (09:57 +0200)]
Merge pull request #6151 from speakinghedge/6150-LLDP-messages-containing-padding-are-dropped

accept LLDP messages containing padding

7 years agoadd note that explains relaxed bytes-left check #6150
hecke [Fri, 23 Jun 2017 06:55:01 +0000 (08:55 +0200)]
add note that explains relaxed bytes-left check #6150

7 years agonspawn: make sure to send SIGTERM/SIGHUP to the main nspawn process if stubinit recei...
Lennart Poettering [Fri, 23 Jun 2017 02:20:09 +0000 (04:20 +0200)]
nspawn: make sure to send SIGTERM/SIGHUP to the main nspawn process if stubinit receives SIGRTMIN+3 (#6167)

This code already existed in some form, however commented. Remove the
comments, as this was most likely simply a forgotten commenting for
debugging purposes.

This also extends the logic a bit, by sending SIGHUP right after the
SIGTERM, so that shells will also terminate, when PID 1 gets a
SIGRTMIN+3.

Fixes: #5711

7 years agoMerge pull request #6176 from poettering/timer-boottime-monotonic
Zbigniew Jędrzejewski-Szmek [Fri, 23 Jun 2017 01:34:39 +0000 (21:34 -0400)]
Merge pull request #6176 from poettering/timer-boottime-monotonic

WakeSystem= and other timer fixes.

7 years agomeson: do not use path separator for target name (#6177)
Yu Watanabe [Fri, 23 Jun 2017 01:27:07 +0000 (10:27 +0900)]
meson: do not use path separator for target name (#6177)

Fixes #6158.

7 years agomeson: install manual and unsafe tests (#6178)
Michael Biebl [Fri, 23 Jun 2017 01:23:30 +0000 (03:23 +0200)]
meson: install manual and unsafe tests (#6178)

Always install all tests if install-tests is set to true, as they might
be useful for CI. This includes manual and unsafe tests. Install those
in subdirectories of /usr/lib/systemd/tests.

Fixes #6163.

7 years agoMerge pull request #6164 from poettering/bus-non-existant-object
Zbigniew Jędrzejewski-Szmek [Fri, 23 Jun 2017 00:56:59 +0000 (20:56 -0400)]
Merge pull request #6164 from poettering/bus-non-existant-object

sd-bus: don't treat requests for non-existent objects as connection errors

7 years agocore: return a friendlier error for a dbus path referring to a non-existent unit
Lennart Poettering [Wed, 21 Jun 2017 18:45:23 +0000 (20:45 +0200)]
core: return a friendlier error for a dbus path referring to a non-existent unit

See: #6059

7 years agocore: unset sysfs path after transition to dead state (#6174)
Michal Sekletar [Fri, 23 Jun 2017 00:29:15 +0000 (02:29 +0200)]
core: unset sysfs path after transition to dead state (#6174)

Device is gone and most likely it will get garbage collected. However in
cases when it doesn't get gc'ed (because it is referenced by some
other unit, e.g. mount from fstab) we need to unset sysfs. This is
because when device appears next time, possibly, with different sysfs
path we need to update the sysfs path. Current code could end up caching
stale sysfs path forever.

In reality this is not a problem for normal disks (unless you swap them
during system runtime). However this issue causes failures to mount
filesystems on LVM where sysfs path depends on activation
order (i.e. logical volumes from volume group that is activated first
get assigned lower dm-X numbers and corresponding syspaths).

Fixes #6126.

7 years agocore: dbus: Interpret released names properly (#6175)
Michal Koutný [Fri, 23 Jun 2017 00:26:04 +0000 (02:26 +0200)]
core: dbus: Interpret released names properly (#6175)

When a DBus name is released, NameOwnerChanged signal contains an empty string
as new_owner. Commit bbc2908 changed interpretation of the empty string to a
valid name, which is not consistent with values that are sent by dbus-daemon.

As a side effect, this masks symptoms of systemd-logind dbus disconnections
(#2925) by completely restarting it so it can freshly reconnect to dbus.

7 years agotests: show current monotonic/boottime/realtime clock values in test-time
Lennart Poettering [Thu, 22 Jun 2017 19:10:34 +0000 (21:10 +0200)]
tests: show current monotonic/boottime/realtime clock values in test-time

When debugging time issues its kinda handy to have an easy way to query
the three clocks, hence let's just output them at the beginning of
test-time.

7 years agotimer: make sure we use the right monotonic timestamp
Lennart Poettering [Thu, 22 Jun 2017 19:04:20 +0000 (21:04 +0200)]
timer: make sure we use the right monotonic timestamp

This reworks timer_enter_waiting() in a couple of ways in order to clean
it up a bit and fix #5629.

Most importantly, we previously we initialized ts_monotonic to either
the current time in CLOCK_MONOTONIC or in CLOCK_BOOTTIME, depending on
t->wake_system. Then given specific conditions we'd use this time as
base for our timers. And afterwards, if t->wake_system was on we'd
convetr the resulting value from CLOCK_MONOTONIC to CLOCK_BOOTTIME again
— which of course is wrong since we already were in CLOCK_BOOTTIME! This
fixes this logic, by using a triple timestamp so that we always have the
right base around, and initially only calculate in CLOCK_MONOTONIC and
only convert as last step.

Conversion between the clocks is now done with the generic
usec_shift_clock(), and additions via usec_add() making these
calculations a bit safer.

Fixes: #5629

7 years agotimer: convert property_get_next_elapse_monotonic() to use usec_shift_clock()
Lennart Poettering [Thu, 22 Jun 2017 18:59:48 +0000 (20:59 +0200)]
timer: convert property_get_next_elapse_monotonic() to use usec_shift_clock()

Let's use the generic clock shifting logic here.

7 years agotime-util: add new call usec_shift_clock() for converting times between clocks
Lennart Poettering [Thu, 22 Jun 2017 18:52:23 +0000 (20:52 +0200)]
time-util: add new call usec_shift_clock() for converting times between clocks

We use that quite often, let's implement one clean version of it.

7 years agotime-util: rename usec_sub() to usec_sub_signed() and add usec_sub_unsigned()
Lennart Poettering [Thu, 22 Jun 2017 18:49:12 +0000 (20:49 +0200)]
time-util: rename usec_sub() to usec_sub_signed() and add usec_sub_unsigned()

Quite often we just want to subtract two normal usec_t values, hence
provide an implementation for that.

7 years agomkosi: order package list alphabetically again
Lennart Poettering [Thu, 22 Jun 2017 18:48:18 +0000 (20:48 +0200)]
mkosi: order package list alphabetically again

7 years agodissect: when dissecting block devices, ignore weird MMC RPMB partitions (#6165)
Lennart Poettering [Thu, 22 Jun 2017 15:40:50 +0000 (17:40 +0200)]
dissect: when dissecting block devices, ignore weird MMC RPMB partitions (#6165)

For now, let's just special-case this in the sources. If more partition
types like this show up we should probably find some other solution.

Fixes: #5806

7 years agomkosi: install libidn2 in the final system (#6173)
Zbigniew Jędrzejewski-Szmek [Thu, 22 Jun 2017 13:23:29 +0000 (09:23 -0400)]
mkosi: install libidn2 in the final system (#6173)

Recent systemd compiled in a build root which had libidn2-devel installed would
not run in the default installation root which had just libidn and did not have
libidn2. Since a8a2a0ed64f727c82e libidn2-devel (or equivalent) is installed in
the build root. Normally, since we install systemd in the installation root,
all dependencies that are needed for the compiled systemd to run are present,
but libidn2 is a new dependency, so the distro packages would just pull in
libidn, and not libidn2.

Temporily add libdn2 to explicitly specified Packages. We can remove that once
distro-compiled systemds have moved to libind2.

7 years agoMerge pull request #6095 from fsateler/machines-mount
Lennart Poettering [Thu, 22 Jun 2017 13:21:57 +0000 (15:21 +0200)]
Merge pull request #6095 from fsateler/machines-mount

nspawn: convert var-lib-machines.mount to an automount

7 years agoMerge pull request #6170 from whot/master
Lennart Poettering [Thu, 22 Jun 2017 13:14:18 +0000 (15:14 +0200)]
Merge pull request #6170 from whot/master

Extend the joystick detection

7 years agolog: pass the correct length to vsnprintf (#6168)
Evgeny Vereshchagin [Thu, 22 Jun 2017 01:10:29 +0000 (04:10 +0300)]
log: pass the correct length to vsnprintf (#6168)

This prevents log_object_internalv from corrupting the stack.
Closes #6147.

Many thanks to Walter Doekes for the code review.

7 years agoudev: always consider devices with joystick axes/buttons as joystick
Peter Hutterer [Wed, 21 Jun 2017 23:19:32 +0000 (09:19 +1000)]
udev: always consider devices with joystick axes/buttons as joystick

Even when they don't have an x/y axis.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoudev: consider a device with BTN_TRIGGER_HAPPY as joystick
Peter Hutterer [Wed, 21 Jun 2017 23:11:15 +0000 (09:11 +1000)]
udev: consider a device with BTN_TRIGGER_HAPPY as joystick

These buttons were added specifically for joysticks with lots of buttons, no
other device should be using them. See kernel commit
cf2f765f18960 "HID: handle joysticks with large number of buttons"

We only test for BTN_TRIGGER_HAPPY (an alias for BTN_TRIGGER_HAPPY1) here, a
device that sets buttons 2 and above but doesn't set 1 is considered buggy.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agomachined: add RequiresMountsFor=/var/lib/machines
Felipe Sateler [Fri, 16 Jun 2017 22:22:50 +0000 (18:22 -0400)]
machined: add RequiresMountsFor=/var/lib/machines

Since any part of the path could be remote mounted, make sure they are
before starting machined

7 years agonspawn: hook var-lib-machines.mount to machines.target and remote-fs.target
Felipe Sateler [Wed, 21 Jun 2017 20:04:38 +0000 (16:04 -0400)]
nspawn: hook var-lib-machines.mount to machines.target and remote-fs.target

/var can be on a remote filesystem, thus hooking it to local-fs.target is not correct.

Also, only install the mount unit when machined is enabled, because
machined is the one managing the underlying device, and thus makes no
sense without machined.

Fixes #1175

7 years agosd-bus: make sure propagate all errors with vtable callbacks back to clients
Lennart Poettering [Wed, 21 Jun 2017 18:42:28 +0000 (20:42 +0200)]
sd-bus: make sure propagate all errors with vtable callbacks back to clients

Previously we'd propagate errors returned by user callbacks configured
in vtables back to the users only for method handlers and property
get/set handlers. This does the same for child enumeration and when we
check whether a fallback unit exists.

Without this the failure will be treated as a non-recoverable connection
error and result in connection termination.

Fixes: #6059

7 years agoonly check signature job error if signature job exists (#6118)
tblume [Wed, 21 Jun 2017 17:29:58 +0000 (19:29 +0200)]
only check signature job error if signature job exists (#6118)

otherwise it will segfault when accessing signature jobs error status

7 years agomeson: add -pthreads and more libs when -Dlink-udev-shared=false (#6159)
Zbigniew Jędrzejewski-Szmek [Wed, 21 Jun 2017 10:05:15 +0000 (06:05 -0400)]
meson: add -pthreads and more libs when -Dlink-udev-shared=false (#6159)

Three binaries would fail to link when ld.bfd was used and link-udev-shared was
false. Add -pthreads (again) to the failing binaries and synchronize the
dependency list between libsystemd-shared .a and .so versions.
Apart from allowing the build to succeed, this shouldn't have much effect becuase
systemd-networkd was already using pthreads.

Fixes #5828.

7 years agohwdb: add axis range corrections for Dell Latitude E7470 (#6156)
Amir Pakdel [Wed, 21 Jun 2017 00:23:16 +0000 (20:23 -0400)]
hwdb: add axis range corrections for Dell Latitude E7470 (#6156)

7 years agoHACKING: update qemu-kvm instructions (#6138)
AsciiWolf [Tue, 20 Jun 2017 21:16:16 +0000 (23:16 +0200)]
HACKING: update qemu-kvm instructions (#6138)

7 years agogithub: how to report bugs for older distribution versions (#6146)
Lukáš Nykrýn [Tue, 20 Jun 2017 18:20:25 +0000 (20:20 +0200)]
github: how to report bugs for older distribution versions (#6146)

7 years agoMerge pull request #6113 from keszybz/shell-quoting
Lennart Poettering [Tue, 20 Jun 2017 18:17:03 +0000 (20:17 +0200)]
Merge pull request #6113 from keszybz/shell-quoting

Use "dollar-single-quotes" to escape shell-sensitive strings

7 years agoUse "dollar-single-quotes" to escape shell-sensitive strings
Zbigniew Jędrzejewski-Szmek [Sun, 11 Jun 2017 19:24:07 +0000 (15:24 -0400)]
Use "dollar-single-quotes" to escape shell-sensitive strings

Also called "ANSI-C Quoting" in info:(bash) ANSI-C Quoting.

The escaping rules are a POSIX proposal, and are described in
http://austingroupbugs.net/view.php?id=249. There's a lot of back-and-forth on
the details of escaping of control characters, but we'll be only using a small
subset of the syntax that is common to all proposals and is widely supported.
Unfortunately dash and fish and maybe some other shells do not support it (see
the man page patch for a list).

This allows environment variables to be safely exported using show-environment
and imported into the shell. Shells which do not support this syntax will have
to do something like
    export $(systemctl show-environment|grep -v '=\$')
or whatever is appropriate in their case. I think csh and fish do not support
the A=B syntax anyway, so the change is moot for them.

Fixes #5536.

v2:
- also escape newlines (which currently disallowed in shell values, so this
  doesn't really matter), and tabs (as $'\t'), and ! (as $'!'). This way quoted
  output can be included directly in both interactive and noninteractive bash.

7 years agoaccept LLDP messages containing padding
hecke [Mon, 19 Jun 2017 23:12:30 +0000 (01:12 +0200)]
accept LLDP messages containing padding

7 years agogithub: tweak the issue template a bit more
Lennart Poettering [Mon, 19 Jun 2017 10:15:44 +0000 (12:15 +0200)]
github: tweak the issue template a bit more

7 years agogithub: tweak the issue template a bit, comment more
Lennart Poettering [Mon, 19 Jun 2017 10:13:28 +0000 (12:13 +0200)]
github: tweak the issue template a bit, comment more

7 years agojob: Ensure JobRunningTimeoutSec= survives serialization (#6128)
Michal Koutný [Sun, 18 Jun 2017 15:51:17 +0000 (17:51 +0200)]
job: Ensure JobRunningTimeoutSec= survives serialization (#6128)

This is a fixup of commit a2df3ea4ae058693bc7bf203d144e8af3c9493d2.
When there is a running job with JobRunningTimeoutSec= and systemd serializes
its state (e.g. during daemon-reload), the timer event source won't be properly
restored in job_coldplug().
Thus save and serialize begin_running_usec too and reinitialize the timer based
on that value.

7 years agoudev: use interface before the string that interface points to is freed by device_add...
Evgeny Vereshchagin [Sun, 18 Jun 2017 09:31:30 +0000 (12:31 +0300)]
udev: use interface before the string that interface points to is freed by device_add_property_internal (#6105)

This prevents udev from reading the data after freeing it.

See https://github.com/systemd/systemd/issues/6040#issuecomment-306589836
==264== Invalid read of size 1
==264==    at 0x4C2E112: strlen (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==264==    by 0x5943EBD: strdup (in /usr/lib/libc-2.25.so)
==264==    by 0x13E263: device_add_property_aux (sd-device.c:122)
==264==    by 0x14788C: device_add_property_internal (sd-device.c:150)
==264==    by 0x14788C: device_rename (device-private.c:786)
==264==    by 0x120DB6: udev_device_rename (libudev-device-private.c:213)
==264==    by 0x120DB6: udev_event_execute_rules (udev-event.c:895)
==264==    by 0x120DB6: worker_spawn (udevd.c:456)
==264==    by 0x1216E5: event_run (udevd.c:584)
==264==    by 0x1216E5: event_queue_start (udevd.c:823)
==264==    by 0x122213: on_uevent (udevd.c:927)
==264==    by 0x141F2F: source_dispatch (sd-event.c:2272)
==264==    by 0x142D52: sd_event_dispatch (sd-event.c:2631)
==264==    by 0x142D52: sd_event_run (sd-event.c:2690)
==264==    by 0x142D52: sd_event_loop (sd-event.c:2710)
==264==    by 0x1159CB: run (udevd.c:1643)
==264==    by 0x1159CB: main (udevd.c:1772)
==264==  Address 0x7b251a0 is 0 bytes inside a block of size 5 free'd
==264==    at 0x4C2C14B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==264==    by 0x13E2A2: freep (alloc-util.h:57)
==264==    by 0x13E2A2: device_add_property_aux (sd-device.c:111)
==264==    by 0x147873: device_add_property_internal (sd-device.c:150)
==264==    by 0x147873: device_rename (device-private.c:781)
==264==    by 0x120DB6: udev_device_rename (libudev-device-private.c:213)
==264==    by 0x120DB6: udev_event_execute_rules (udev-event.c:895)
==264==    by 0x120DB6: worker_spawn (udevd.c:456)
==264==    by 0x1216E5: event_run (udevd.c:584)
==264==    by 0x1216E5: event_queue_start (udevd.c:823)
==264==    by 0x122213: on_uevent (udevd.c:927)
==264==    by 0x141F2F: source_dispatch (sd-event.c:2272)
==264==    by 0x142D52: sd_event_dispatch (sd-event.c:2631)
==264==    by 0x142D52: sd_event_run (sd-event.c:2690)
==264==    by 0x142D52: sd_event_loop (sd-event.c:2710)
==264==    by 0x1159CB: run (udevd.c:1643)
==264==    by 0x1159CB: main (udevd.c:1772)
==264==  Block was alloc'd at
==264==    at 0x4C2AF1F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==264==    by 0x5943EC9: strdup (in /usr/lib/libc-2.25.so)
==264==    by 0x13E263: device_add_property_aux (sd-device.c:122)
==264==    by 0x143B45: device_add_property_internal (sd-device.c:150)
==264==    by 0x143B45: device_amend.lto_priv.235 (device-private.c:454)
==264==    by 0x1387B7: device_append (device-private.c:516)
==264==    by 0x1387B7: device_new_from_nulstr (device-private.c:620)
==264==    by 0x1387B7: udev_device_new_from_nulstr (libudev-device-private.c:268)
==264==    by 0x1387B7: udev_monitor_receive_device (libudev-monitor.c:682)
==264==    by 0x11FC69: worker_spawn (udevd.c:509)
==264==    by 0x1216E5: event_run (udevd.c:584)
==264==    by 0x1216E5: event_queue_start (udevd.c:823)
==264==    by 0x122213: on_uevent (udevd.c:927)
==264==    by 0x141F2F: source_dispatch (sd-event.c:2272)
==264==    by 0x142D52: sd_event_dispatch (sd-event.c:2631)
==264==    by 0x142D52: sd_event_run (sd-event.c:2690)
==264==    by 0x142D52: sd_event_loop (sd-event.c:2710)
==264==    by 0x1159CB: run (udevd.c:1643)
==264==    by 0x1159CB: main (udevd.c:1772)
==264==

7 years agopid1: properly encode infinity when writing CPUQuota snippet (#6141)
Zbigniew Jędrzejewski-Szmek [Sun, 18 Jun 2017 09:18:41 +0000 (05:18 -0400)]
pid1: properly encode infinity when writing CPUQuota snippet (#6141)

We would write
  [Slice]
  CPUQuota=1844674407370955%
which is (numerically) correct, but it seems better to just write
  [Slice]
  CPUQuota=
which is interpreted as USEC_INFINITY by the parser in config_parse_cpu_quota().

Fixes #5965.

7 years agoMerge pull request #6064 from keszybz/lock-session
Lennart Poettering [Sun, 18 Jun 2017 09:16:53 +0000 (11:16 +0200)]
Merge pull request #6064 from keszybz/lock-session

Improvements to loginctl operating on current session

7 years agoMerge pull request #6140 from keszybz/rm-rf-symlink
Lennart Poettering [Sun, 18 Jun 2017 09:15:13 +0000 (11:15 +0200)]
Merge pull request #6140 from keszybz/rm-rf-symlink

Allow symlinks to root to be removed

7 years agoMerge pull request #6142 from keszybz/man-runtimedirectorymode
Djalal Harouni [Sun, 18 Jun 2017 07:36:50 +0000 (09:36 +0200)]
Merge pull request #6142 from keszybz/man-runtimedirectorymode

man: describe RuntimeDirectoryMode=

7 years agoresolved: ignore DNSSEC= option when resolved is built without gcrypt (#6084)
Yu Watanabe [Sat, 17 Jun 2017 20:22:32 +0000 (05:22 +0900)]
resolved: ignore DNSSEC= option when resolved is built without gcrypt (#6084)

Fixes #5583.

7 years agoman: describe RuntimeDirectoryMode=
Zbigniew Jędrzejewski-Szmek [Sat, 17 Jun 2017 19:23:02 +0000 (15:23 -0400)]
man: describe RuntimeDirectoryMode=

Fixes #5509.

7 years agobasic/rm-rf: allow a symlink to / to be removed
Zbigniew Jędrzejewski-Szmek [Sat, 17 Jun 2017 16:41:08 +0000 (12:41 -0400)]
basic/rm-rf: allow a symlink to / to be removed

We open the target path with O_DIRECTORY|O_NOFOLLOW, and if that doesn't work,
we call unlink() on the path. In neither case we will follow the symlink, so
we can relax our check to also not follow symlinks.

Fixes #5864.

7 years agobasic/path-util: allow flags for path_equal_or_files_same
Zbigniew Jędrzejewski-Szmek [Sat, 17 Jun 2017 16:37:16 +0000 (12:37 -0400)]
basic/path-util: allow flags for path_equal_or_files_same

No functional change, just a new parameters and the tests that
AT_SYMLINK_NOFOLLOW works as expected.

7 years agoudev-builtin-blkid: Use _cleanup_blkid_free_probe_ to free probe (#6108)
Nate Clark [Fri, 16 Jun 2017 20:44:57 +0000 (16:44 -0400)]
udev-builtin-blkid: Use _cleanup_blkid_free_probe_ to free probe (#6108)

Use the _cleanup_blkid_free_probe_ to guarantee that the
blkid_probe will be freed when builtin_blkid exits.

7 years agoMerge pull request #6134 from pfl/radv_fixes
Lennart Poettering [Fri, 16 Jun 2017 20:43:36 +0000 (22:43 +0200)]
Merge pull request #6134 from pfl/radv_fixes

Router Advertisement fixes

7 years agoMerge pull request #6133 from wbx-github/idn_config
Lennart Poettering [Fri, 16 Jun 2017 20:06:48 +0000 (22:06 +0200)]
Merge pull request #6133 from wbx-github/idn_config

make IDN support conditional

7 years agomeson: add -Didn=yes|no option
Zbigniew Jędrzejewski-Szmek [Fri, 16 Jun 2017 13:16:28 +0000 (09:16 -0400)]
meson: add -Didn=yes|no option

7 years agoMake IDN support conditional
Waldemar Brodkorb [Thu, 15 Jun 2017 15:44:59 +0000 (17:44 +0200)]
Make IDN support conditional

[zj: rename HAVE_IDN to ENABLE_IDN]

7 years agonetworkd-address: Use DIV_ROUND_UP for consistency
Patrik Flykt [Fri, 16 Jun 2017 06:09:35 +0000 (09:09 +0300)]
networkd-address: Use DIV_ROUND_UP for consistency

Use DIV_ROUND_UP for consistency instead of the previous construct.

7 years agonetworkd-radv: Fix router lifetime assignment
Patrik Flykt [Fri, 16 Jun 2017 06:35:12 +0000 (09:35 +0300)]
networkd-radv: Fix router lifetime assignment

Router lifetime is stored as usec_t, use value accordingly.

7 years agonetworkd: Fix comment
Patrik Flykt [Fri, 16 Jun 2017 06:07:13 +0000 (09:07 +0300)]
networkd: Fix comment

Comment about not being a router is in the wrong place. Router lifetime
is assigned with config_parse_sec().

7 years agomeson: only run c++ tests when c++ compiler is available (#6123)
Davide Cavalca [Thu, 15 Jun 2017 08:55:13 +0000 (09:55 +0100)]
meson: only run c++ tests when c++ compiler is available (#6123)

7 years agonetworkd: Allow DHCP servers to be re-configured on carrier gain
Richard Maw [Fri, 9 Jun 2017 15:18:25 +0000 (16:18 +0100)]
networkd: Allow DHCP servers to be re-configured on carrier gain

In normal operation this would trigger an assertion
when a DHCP server is configured every time the link goes up.

This change makes sd_dhcp_server_configure_pool idempotent
and stops the DHCP server when the link loses carrier.

In addition to this stopping the assertion being triggered,
this has the useful side-effect of allowing the link to be taken down
and then brought back up as a way to have it use DNS from an "upstream"
interface that got its DNS configuration via DHCP
after the downstream link was configured.

7 years agonetworkd: Wait for link to get carrier before setting addresses
Richard Maw [Wed, 7 Jun 2017 15:30:46 +0000 (16:30 +0100)]
networkd: Wait for link to get carrier before setting addresses

For containers the link is effectively always up,
but for virtual and physical machines networkd may have started
before the link has gained carrier.

Networkd will configure addresses when carrier is gained,
but should also configure addresses if the link is already up.
Without this patch the addresses are set unconditionally.

Normally this isn't a problem since addresses are either fixed,
set over DHCP, or is never without carrier.
But for machines that gain carrier and are configured to select
an address from the unallocated local address pool
this causes them to pick an address from the pool twice.

This change to skip address configuration when a link is added
before it has a carrier fixes having multiple addresses assigned
if the machine starts networkd before it has gained carrier
and is configured with an address from the pool.

7 years agonetworkd: Clean up pool addresses on link down
Richard Maw [Tue, 6 Jun 2017 14:43:24 +0000 (15:43 +0100)]
networkd: Clean up pool addresses on link down

When the link comes up it assigns addresses
by checking whether the address is 0.0.0.0,
and if so pulling a new address range out of the pool.

If the addresses aren't removed from the pool when the link goes down
then the set of addresses allocated will grow
until all the local address ranges are exhausted,
while it gets a different IP address every time.

This patch frees the addresses when link config is dropped
to fix the address leak,
and on systems which can expect all interfaces to be brought up or down
in a deterministic order this conveniently makes use the same address each time.

7 years agoman: systemd-timesyncd.service(8) (#6109)
Pat Riehecky [Fri, 9 Jun 2017 22:48:25 +0000 (17:48 -0500)]
man: systemd-timesyncd.service(8) (#6109)

Updates the documentation to note use of SNTP (resolves #5735)

7 years agologind: save/restore session devices and their respective file descriptors
Franck Bui [Thu, 16 Mar 2017 10:17:09 +0000 (11:17 +0100)]
logind: save/restore session devices and their respective file descriptors

This patch ensures that session devices are saved for each session.

In order to make the revokation logic work when logind is restarted, the
session devices are now saved in the session state files and their respective
file descriptors sent to PID1's fdstore in order to keep them open accross
restart.

This is mandatory in order to keep the revokation logic working. Indeed in case
of input-devices, the same file descriptors must be shared by logind and a
given session controller in order EVIOCREVOKE to work otherwise multiple
sessions can have device access in parallel.

This should be the only remaining and missing piece for making logind fully
restartable.

Fixes: #1163

7 years agologind: when setting a new controller, don't prepare the VT if logind is restarted
Franck Bui [Wed, 26 Apr 2017 12:20:41 +0000 (14:20 +0200)]
logind: when setting a new controller, don't prepare the VT if logind is restarted

When assigning a new session controller to a session, the VT is prepared so the
controller can expect the VT to be in a good default state.

However when logind is restarted and a session controller already took control
of a session, there's no need to prepare th VT otherwise logind may screw up
the VT state set by the controller.

This patch prevents the preparation of the VT in this case.

7 years agocore: remove the redundancy of 'n_fds' and 'n_storage_fds' in ExecParameters struct
Franck Bui [Thu, 8 Jun 2017 13:41:26 +0000 (15:41 +0200)]
core: remove the redundancy of 'n_fds' and 'n_storage_fds' in ExecParameters struct

'n_fds' field in the ExecParameters structure was counting the total number of
file descriptors to be passed to a unit.

This counter also includes the number of passed socket fds which is counted by
'n_socket_fds' already.

This patch removes that redundancy by replacing 'n_fds' with
'n_storage_fds'. The new field only counts the fds passed via the storage store
mechanism.  That way each fd is counted at one place only.

Subsequently the patch makes sure to fix code that used 'n_fds' and also wanted
to iterate through all of them by explicitly adding 'n_socket_fds' + 'n_storage_fds'.

Suggested by Lennart.

7 years agocore/mount: pass "-c" flag to /bin/umount (#6093)
NeilBrown [Wed, 7 Jun 2017 12:28:23 +0000 (22:28 +1000)]
core/mount: pass "-c" flag to /bin/umount (#6093)

"-c", which is short for "--no-canonicalize", tells /bin/umount
that the path name is canonical (no .. or symlinks etc).

systemd always uses a canonical name, so this flag is appropriate
for systemd to use.
Knowing that the path is canonical allows umount to avoid
some calls to lstat() on the path.

From v2.30 "-c" goes further and causes umount to avoid all
attempts to 'lstat()' (or similar) the path.  This is important
when automatically unmounting a filesystem, as lstat() can
hang indefinitely in some cases such as when an NFS server
is not accessible.

"-c" has been supported since util-linux 2.17 which is before the
earliest version supported by systemd.
So "-c" is safe to use now, and once util-linux v2.30 is in use,
it will allow mounts from non-responsive NFS servers to be
unmounted.

7 years agoudev: stop freeing value after using it for setting sysattr (#6094)
Evgeny Vereshchagin [Wed, 7 Jun 2017 01:47:47 +0000 (04:47 +0300)]
udev: stop freeing value after using it for setting sysattr (#6094)

This prevents udev from double-freeing and crashing.

See https://github.com/systemd/systemd/issues/6040#issuecomment-306589836
==351== Invalid free() / delete / delete[] / realloc()
==351==    at 0x4C2C14B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==351==    by 0x13CBE8: hashmap_clear_free_free (hashmap.c:900)
==351==    by 0x13CBE8: hashmap_free_free_free (hashmap.c:852)
==351==    by 0x147F4F: sd_device_unref (sd-device.c:88)
==351==    by 0x130CCC: udev_device_unref (libudev-device.c:552)
==351==    by 0x130CD5: udev_device_unref (libudev-device.c:553)
==351==    by 0x11FBBB: worker_spawn (udevd.c:488)
==351==    by 0x1216E5: event_run (udevd.c:584)
==351==    by 0x1216E5: event_queue_start (udevd.c:823)
==351==    by 0x122213: on_uevent (udevd.c:927)
==351==    by 0x141F2F: source_dispatch (sd-event.c:2272)
==351==    by 0x142D52: sd_event_dispatch (sd-event.c:2631)
==351==    by 0x142D52: sd_event_run (sd-event.c:2690)
==351==    by 0x142D52: sd_event_loop (sd-event.c:2710)
==351==    by 0x1159CB: run (udevd.c:1643)
==351==    by 0x1159CB: main (udevd.c:1772)
==351==  Address 0x81745b0 is 0 bytes inside a block of size 1 free'd
==351==    at 0x4C2C14B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==351==    by 0x1447F0: freep (alloc-util.h:57)
==351==    by 0x1447F0: sd_device_set_sysattr_value (sd-device.c:1859)
==351==    by 0x132081: udev_device_set_sysattr_value (libudev-device.c:849)
==351==    by 0x12E777: set_trackpoint_sensitivity (udev-builtin-keyboard.c:180)
==351==    by 0x12E777: builtin_keyboard.lto_priv.170 (udev-builtin-keyboard.c:263)
==351==    by 0x14D03F: udev_builtin_run.constprop.75 (udev-builtin.c:133)
==351==    by 0x11FAEB: udev_event_execute_run (udev-event.c:957)
==351==    by 0x11FAEB: worker_spawn (udevd.c:461)
==351==    by 0x1216E5: event_run (udevd.c:584)
==351==    by 0x1216E5: event_queue_start (udevd.c:823)
==351==    by 0x122213: on_uevent (udevd.c:927)
==351==    by 0x141F2F: source_dispatch (sd-event.c:2272)
==351==    by 0x142D52: sd_event_dispatch (sd-event.c:2631)
==351==    by 0x142D52: sd_event_run (sd-event.c:2690)
==351==    by 0x142D52: sd_event_loop (sd-event.c:2710)
==351==    by 0x1159CB: run (udevd.c:1643)
==351==    by 0x1159CB: main (udevd.c:1772)
==351==  Block was alloc'd at
==351==    at 0x4C2CF35: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==351==    by 0x144853: sd_device_set_sysattr_value (sd-device.c:1888)
==351==    by 0x132081: udev_device_set_sysattr_value (libudev-device.c:849)
==351==    by 0x12E777: set_trackpoint_sensitivity (udev-builtin-keyboard.c:180)
==351==    by 0x12E777: builtin_keyboard.lto_priv.170 (udev-builtin-keyboard.c:263)
==351==    by 0x14D03F: udev_builtin_run.constprop.75 (udev-builtin.c:133)
==351==    by 0x11FAEB: udev_event_execute_run (udev-event.c:957)
==351==    by 0x11FAEB: worker_spawn (udevd.c:461)
==351==    by 0x1216E5: event_run (udevd.c:584)
==351==    by 0x1216E5: event_queue_start (udevd.c:823)
==351==    by 0x122213: on_uevent (udevd.c:927)
==351==    by 0x141F2F: source_dispatch (sd-event.c:2272)
==351==    by 0x142D52: sd_event_dispatch (sd-event.c:2631)
==351==    by 0x142D52: sd_event_run (sd-event.c:2690)
==351==    by 0x142D52: sd_event_loop (sd-event.c:2710)
==351==    by 0x1159CB: run (udevd.c:1643)
==351==    by 0x1159CB: main (udevd.c:1772)

7 years agozsh: add completion for add-wants and add-requires (#6082)
Felipe Sateler [Wed, 7 Jun 2017 01:32:15 +0000 (21:32 -0400)]
zsh: add completion for add-wants and add-requires (#6082)

7 years agocore: only apply NonBlocking= to fds passed via socket activation
Franck Bui [Fri, 12 May 2017 09:32:53 +0000 (11:32 +0200)]
core: only apply NonBlocking= to fds passed via socket activation

Make sure to only apply the O_NONBLOCK flag to the fds passed via socket
activation.

Previously the flag was also applied to the fds which came from the fd store
but this was incorrect since services, after being restarted, expect that these
passed fds have their flags unchanged and can be reused as before.

The documentation was a bit unclear about this so clarify it.

7 years agoparse-util: introduce parse_dev() helper
Franck Bui [Wed, 26 Apr 2017 16:18:03 +0000 (18:18 +0200)]
parse-util: introduce parse_dev() helper