Commit graph

27918 commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 12d6389c14 build-sys: treat format errors as fatal (#4910)
We currently don't expect any warnings about format strings, on any
architecture (#4612 removed the last few warnings). Turn those warnings into
errors in the future.

As requested by Martin Pitt.

gcc documentation says that -Wformat=2 includes -Wformat-security and
-Wformat-nonliteral so don't include them explicitly.
2016-12-18 21:47:41 +01:00
Zbigniew Jędrzejewski-Szmek 3f4a69629d Merge pull request #4892 from poettering/buspolicymove
build-sys: stop placing D-Bus policy below /etc
2016-12-18 11:43:18 -05:00
Zbigniew Jędrzejewski-Szmek a80c157506 core: downgrade "Time has been changed" to debug (#4906)
That message is emitted by every systemd instance on every resume:
Dec 06 08:03:38 laptop systemd[1]: Time has been changed
Dec 06 08:03:38 laptop systemd[823]: Time has been changed
Dec 06 08:03:38 laptop systemd[916]: Time has been changed
Dec 07 08:00:32 laptop systemd[1]: Time has been changed
Dec 07 08:00:32 laptop systemd[823]: Time has been changed
Dec 07 08:00:32 laptop systemd[916]: Time has been changed
-- Reboot --
Dec 07 08:02:46 laptop systemd[836]: Time has been changed
Dec 07 08:02:46 laptop systemd[1]: Time has been changed
Dec 07 08:02:46 laptop systemd[926]: Time has been changed
Dec 07 19:48:12 laptop systemd[1]: Time has been changed
Dec 07 19:48:12 laptop systemd[836]: Time has been changed
Dec 07 19:48:12 laptop systemd[926]: Time has been changed
...

Fixes #4896.
2016-12-18 13:21:19 +01:00
Martin Pitt 8b35656c33 Merge pull request #4911 from keszybz/fixlets
A few simple fixes / improvements
2016-12-18 13:20:12 +01:00
Zbigniew Jędrzejewski-Szmek 5b5688afbe basic/log: use IN_SET 2016-12-17 22:45:31 -05:00
Zbigniew Jędrzejewski-Szmek 777fe71fdf test-compress: fix warning about LZ4_compress_limitedOutput
691b90d465 fixed one spot, but missed the other one.
2016-12-17 18:27:01 -05:00
Zbigniew Jędrzejewski-Szmek eb56bec413 core: remove spurious newline 2016-12-17 17:26:59 -05:00
Zbigniew Jędrzejewski-Szmek 3a8a0ace2c debug-generator: simplify handling of arg_default_unit
Also free the allocated memory before exiting.
2016-12-17 17:26:59 -05:00
Zbigniew Jędrzejewski-Szmek 075dafd204 Use SPECIAL_DEFAULT_TARGET consistently 2016-12-17 17:26:59 -05:00
Zbigniew Jędrzejewski-Szmek c73838280c Modify mount_propagation_flags_from_string to return a normal int code
This means that callers can distiguish an error from flags==0,
and don't have to special-case the empty string.
2016-12-17 13:57:04 -05:00
Zbigniew Jędrzejewski-Szmek 117d5a27a3 Merge pull request #4845 from poettering/various-smaller-fixes
Various smaller fixes
2016-12-17 13:36:00 -05:00
Franck Bui 3e7bc89b8f coredumpctl: let gdb handle the SIGINT signal (#4901)
Even if pressing Ctrl-c after spawning gdb with "coredumpctl gdb" is not really
useful, we should let gdb handle the signal entirely otherwise the user can be
suprised to see a different behavior when gdb is started by coredumpctl vs when
it's started directly.

Indeed in the former case, gdb exits due to coredumpctl being killed by the
signal.

So this patch makes coredumpctl ignore SIGINT as long as gdb is running.
2016-12-17 09:49:17 -05:00
Zbigniew Jędrzejewski-Szmek 52b2f6b35d README: bump dbus dep
We should also mention this in NEWS before release. Suggested text:
> DBus policy files are now installed into /usr rather than /etc. Make sure
> your system has dbus = 1.9.18 running before upgrading to this version, or
> override the install path with --with-dbuspolicydir=
2016-12-17 09:26:44 -05:00
Douglas Christman 482f3b5441 calendarspec: remove superfluous variables 2016-12-16 19:47:04 -05:00
Douglas Christman e78fce48c4 calendarspec: rename fields of CalendarComponent
value/range_end -> start/stop
2016-12-16 19:45:06 -05:00
Douglas Christman a2eb5ea79c calendarspec: allow repetition values with ranges
"Every other hour from 9 until 5" can be written as
`9..17/2:00` instead of `9,11,13,15,17:00`
2016-12-16 19:27:33 -05:00
Franck Bui ebc8968bc0 core: make mount units from /proc/self/mountinfo possibly bind to a device (#4515)
Since commit 9d06297, mount units from mountinfo are not bound to their devices
anymore (they use the "Requires" dependency instead).

This has the following drawback: if a media is mounted and the eject button is
pressed then the media is unconditionally ejected leaving some inconsistent
states.

Since udev is the component that is reacting (no matter if the device is used
or not) to the eject button, users expect that udev at least try to unmount the
media properly.

This patch introduces a new property "SYSTEMD_MOUNT_DEVICE_BOUND". When set on
a block device, all units that requires this device will see their "Requires"
dependency upgraded to a "BindTo" one. This is currently only used by cdrom
devices.

This patch also gives the possibility to the user to restore the previous
behavior that is bind a mount unit to a device. This is achieved by passing the
"x-systemd.device-bound" option to mount(8). Please note that currently this is
not working because libmount treats the x-* options has comments therefore
they're not available in utab for later application retrievals.
2016-12-16 17:13:58 +01:00
Lucas Werkmeister d6ccb4f942 bootctl: fix typo (#4897) 2016-12-16 15:41:31 +01:00
Stefan Hajnoczi b9495e8d58 core: prevent invalid socket symlink target dereference (#4895)
socket_find_symlink_target() returns a pointer to
p->address.sockaddr.un.sun_path when the first byte is non-zero without
checking that this is AF_UNIX socket.  Since sockaddr is a union this
byte could be non-zero for AF_INET sockets.

Existing callers happen to be safe but is an accident waiting to happen.
Use socket_address_get_path() since it checks for AF_UNIX.
2016-12-16 11:20:27 +01:00
Daniel Drake d84071d569 rules: identify internal sound cards on platform bus (#4893)
We have a system which has the HDMI audio capability internally,
but pulseaudio is not giving it a very high priority compared
to e.g. USB sound cards.

The sound device appears on the platform bus and it is not
currently tagged with any form factor information.

It seems safe to assume that any sound card that is directly on the
platform bus is of internal form factor, but we must be careful because
udev rules will match all parent devices, not just the immediate parent,
and you will frequently encounter setups such as:

 Platform bus -> USB host controller -> USB sound card

In that case, SUBSYSTEMS==platform would match even though we're
clearly working with an external USB sound card.

In order to detect true platform devices here, we rely on the observation
that if any parent devices of the sound card are PCI, USB or firewire
devices, then this sound card cannot directly connected to the platform
bus. Otherwise, if we find a parent device on the platform bus, we assume
this is an internal sound card connected directly to the platform bus.
2016-12-15 23:11:11 +01:00
Lennart Poettering 0298f55bb0 build-sys: stop placing D-Bus policy below /etc
Let's start placing our D-Bus policy files in /usr rather than /etc. D-Bus
supports this since 1.9.18, and moving our files over means we continue to work
even if /etc is flushed out entirely (for example if systemd-nspawn's
--volatile= switch is used).

Since 1.9.18 was released summer 2015 it should be fine to require a newer
version like this for our builds.

https://lists.freedesktop.org/archives/dbus/2015-July/016746.html
2016-12-15 16:06:46 +01:00
Doug Christman fc2371c7b1 calendarspec: free memory when parsing fails (#4890)
This prevents memory leaks on strings like `*~*-*`.

Fixes #4887
2016-12-14 19:21:27 +01:00
Lennart Poettering 8eb7383ba8 update TODO 2016-12-14 18:30:05 +01:00
Lennart Poettering 6344a7eb5c mkosi: change /etc/issue text a bit for mkosi images build from systemd tree 2016-12-14 18:29:30 +01:00
Lennart Poettering ab13cfb85a mkosi: run tests when building mkosi images 2016-12-14 18:29:30 +01:00
Lennart Poettering 9b12360bf6 build-sys: include the builddir in $PATH while testing
udev-test.pl shells out systemd-detect-virt, and it really should invoke the
version from the build tree instead of one supplied by the installed system,
hence let's add the builddir to $PATH while building.
2016-12-14 18:29:30 +01:00
Lennart Poettering 9bfaffd5a9 util-lib: rework rename_process() to be able to make use of PR_SET_MM_ARG_START
PR_SET_MM_ARG_START allows us to relatively cleanly implement process renaming.
However, it's only available with privileges. Hence, let's try to make use of
it, and if we can't fall back to the traditional way of overriding argv[0].

This removes size restrictions on the process name shown in argv[] at least for
privileged processes.
2016-12-14 18:29:30 +01:00
Lennart Poettering e932f5407e sysv-generator: properly translate sysv facilities
We used the wrong return value in one case, so that our translations were
thrown away.

While we are at it, make sure to always initialize *ret on successful function
exits.

Fixes: #4762
2016-12-14 18:29:30 +01:00
Lennart Poettering 61f638e544 machinectl: make "machinectl -E … shell" work
Fixes: #4823
2016-12-14 18:29:30 +01:00
Lennart Poettering 493097eecc journalctl: improve wording in an errors message
Fixes: #4660
2016-12-14 18:29:30 +01:00
Lennart Poettering 33d2308c1f man: document that "systemctl show" shows low-level properties
Fixes: #4654
2016-12-14 18:29:30 +01:00
Lennart Poettering 951aba625e man: minor fixes for sd_journal_print(3)
When sd_journal_perror() was added some footers weren't updated accordingly.
Let's do so.

Fixes: #4755
2016-12-14 18:29:30 +01:00
Lennart Poettering 2eec83d930 mkosi: update mkosi.fedora so that we can run "make check" during build
Our tests require "diff" and "tree", hence let's add them to the set of
development packages.
2016-12-14 18:29:30 +01:00
Lennart Poettering 75bf701f5c nspawn: flush out environment block of the -a stub init process
The container detection code in virt.c we ship checks for /proc/1/environ,
looking for "container=" in it. Let's make sure our "-a" init stub exposes that
correctly.

Without this "systemd-detect-virt" run in a "-a" container won't detect that it
is being run in a container.
2016-12-14 18:29:30 +01:00
Lennart Poettering 8d6e80343a util-lib: improve container detection logic
Previously, systemd-detect-virt was unable to detect "systemd-nspawn -a"
container environments, i.e. where PID 1 is a stub process running in host
context, as in that case /proc/1/environ was inherited from the host. Let's
improve that, and add an additional check for container environments where
/proc/1/environ is not cleaned up and does not contain the $container
environment variable:

The /proc/1/sched file shows the host PID in the first line. if this is not
1, we know we are running in a PID namespace (but not which implementation).

With these changes we should be able to detect container environments that
don't set $container at all.
2016-12-14 18:29:30 +01:00
Zbigniew Jędrzejewski-Szmek f6f372d2f4 Add sd_is_socket_sockaddr (#4885)
Fixes #1188.
2016-12-14 11:51:26 +01:00
Ronny Chevalier 80d8b5bc1f Merge pull request #4889 from evverx/fix-test-fs-util-memleak
test-fs-util: fix memleak
2016-12-14 11:34:48 +01:00
Lennart Poettering 0900593e86 generator: order fsck service After= the device
Otherwise we might get started too early.
2016-12-14 10:13:52 +01:00
Lennart Poettering ad2706db7c core: rework logic to determine when we decide to add automatic deps for mounts
This adds a concept of "extrinsic" mounts. If mounts are extrinsic we consider
them managed by something else and do not add automatic ordering against
umount.target, local-fs.target, remote-fs.target.

Extrinsic mounts are considered:

- All mounts if we are running in --user mode

- API mounts such as everything below /proc, /sys, /dev, which exist from
  earliest boot to latest shutdown.

- All mounts marked as initrd mounts, if we run on the host

- The initrd's private directory /run/initrams that should survive until last
  reboot.

This primarily merges a couple of different exclusion lists into a single
concept.
2016-12-14 10:13:52 +01:00
Lennart Poettering 33e2818093 core: make sure targets that get a default Conflicts=shutdown.target are also ordered against it
Let's tweak the automatic dependency generation of target units: not only add a
Conflicts= towards shutdown.target but also an After= line for it, so that we
can be sure the new target is not started when the old target is still up.

Discovered in the context of #4733

(Also, exclude dependency generation if for shutdown.target itself. — This is
strictly speaking redundant, as unit_add_two_dependencies_by_name() detects
that and becomes a NOP, but let's make this explicit for readability.)
2016-12-14 10:13:52 +01:00
Lennart Poettering 4549fcdb1d Add a bit of documentation for the various undocumented environment variables we honour 2016-12-14 10:13:52 +01:00
Lennart Poettering 295ee9845c util: Fine tune running_in_chroot() a bit
Let's be a bit more careful when detecting chroot() environments, so that we
can discern them from namespaced environments.

Previously this would simply check if the root directory of PID 1 matches our
own root directory. With this commit, we also check whether the namespaces of
PID 1 and ourselves are the same. If not we assume we are running inside of a
namespaced environment instead of a chroot() environment.

This has the benefit that systemctl (which uses running_in_chroot()) will work
as usual when invoked in a namespaced service.
2016-12-14 10:13:52 +01:00
Zbigniew Jędrzejewski-Szmek 4014818d53 Merge pull request #4806 from poettering/keyring-init
set up a per-service session kernel keyring, and store the invocation ID in it
2016-12-13 23:24:42 -05:00
Zbigniew Jędrzejewski-Szmek 9cf314f34d Merge pull request #4727 from poettering/exec-bind
More namespace improvements
2016-12-13 22:30:07 -05:00
Evgeny Vereshchagin f4b85a0fb6 test-fs-util: fix memleak
Fixes:
```
$ ./libtool --mode=execute valgrind --leak-check=full ./test-fs-util
...
==22871==
==22871== 27 bytes in 1 blocks are definitely lost in loss record 1 of 1
==22871==    at 0x4C2FC47: realloc (vg_replace_malloc.c:785)
==22871==    by 0x4E86D05: strextend (string-util.c:726)
==22871==    by 0x4E8F347: chase_symlinks (fs-util.c:712)
==22871==    by 0x109EBF: test_chase_symlinks (test-fs-util.c:75)
==22871==    by 0x10C381: main (test-fs-util.c:305)
==22871==
```
Closes #4888
2016-12-14 00:31:53 +00:00
Lennart Poettering f59d1da8cd update TODO 2016-12-14 00:55:12 +01:00
Lennart Poettering 4ea0d7f431 core: make "Restart" service property accessible via the transient API
Fixes: #4402
2016-12-14 00:54:13 +01:00
Lennart Poettering d2d6c096f6 core: add ability to define arbitrary bind mounts for services
This adds two new settings BindPaths= and BindReadOnlyPaths=. They allow
defining arbitrary bind mounts specific to particular services. This is
particularly useful for services with RootDirectory= set as this permits making
specific bits of the host directory available to chrooted services.

The two new settings follow the concepts nspawn already possess in --bind= and
--bind-ro=, as well as the .nspawn settings Bind= and BindReadOnly= (and these
latter options should probably be renamed to BindPaths= and BindReadOnlyPaths=
too).

Fixes: #3439
2016-12-14 00:54:10 +01:00
Lennart Poettering 8fceda937f namespace: instead of chasing mount symlinks a priori, do so as-we-go
This is relevant as many of the mounts we try to establish only can be followed
when some other prior mount that is a prefix of it is established. Hence: move
the symlink chasing into the actual mount functions, so that we do it as late
as possibly but as early as necessary.

Fixes: #4588
2016-12-14 00:51:37 +01:00
Lennart Poettering 34de407a4f core: rename BindMount structure → MountEntry
After all, these don#t strictly encapsulate bind mounts anymore, and we are
preparing this for adding arbitrary user-defined bind mounts in a later commit,
at which point this would become really confusing. Let's clean this up, rename
the BindMount structure to MountEntry, so that it is clear that it can contain
information about any kind of mount.
2016-12-14 00:48:52 +01:00