]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
7 years agoudevadm: fix fd leak on oom 8188/head
Zbigniew Jędrzejewski-Szmek [Thu, 15 Feb 2018 09:30:46 +0000 (10:30 +0100)] 
udevadm: fix fd leak on oom

Unlikely, but let's be correct.

CID #1386003.

7 years agonspawn: make sure we don't leak the fd in chase_symlinks_and_update
Zbigniew Jędrzejewski-Szmek [Thu, 15 Feb 2018 09:18:25 +0000 (10:18 +0100)] 
nspawn: make sure we don't leak the fd in chase_symlinks_and_update

No callers use CHASE_OPEN right now, but let's be defensive.

7 years agocore: move very long argument to a separate statement
Zbigniew Jędrzejewski-Szmek [Thu, 15 Feb 2018 09:10:01 +0000 (10:10 +0100)] 
core: move very long argument to a separate statement

I like compact, but this was a bit too much.

7 years agosd-dhcp6: fix check if serverid is set
Zbigniew Jędrzejewski-Szmek [Thu, 15 Feb 2018 08:37:44 +0000 (09:37 +0100)] 
sd-dhcp6: fix check if serverid is set

Ever since the initial implementation in 631bbe71298ec892f77f44f94feb612646fe6853,
client_parse_message() was supposed to check that the message contains exactly
one serverid. The check that no more than one is given was implemented
correctly, but the check that at least one is given was not. Simplify the whole
thing by making dhcp6_lease_get_serverid() return an error if the id is not
set, and do not require the arguments to be present if the contents of the id
are not needed.

7 years agolibsystemd-network: unitialized return value
Zbigniew Jędrzejewski-Szmek [Thu, 15 Feb 2018 08:20:36 +0000 (09:20 +0100)] 
libsystemd-network: unitialized return value

r will *usually* be set, but for some packets it might not.

CID #1385308.

7 years agoman: make systemd-socket-activate point to systemd-run (#8151)
Lucas Werkmeister [Wed, 14 Feb 2018 13:11:24 +0000 (14:11 +0100)] 
man: make systemd-socket-activate point to systemd-run (#8151)

Now that systemd-run also supports socket units, it makes sense to link
to that command from the systemd-socket-activate manpage.

7 years agoAllow timers to trigger timers (#8043)
Boucman [Wed, 14 Feb 2018 13:10:07 +0000 (14:10 +0100)] 
Allow timers to trigger timers (#8043)

Unlike any other unit type, it makes sense for a timer to start another
timer. It is an easy way to crate logical "and" between time conditions

for instance, every day but no less than 5' after boot can easily be
implemented by a OnBootSec triggering an OnCalendar.

This is particulary usefull with Persistant timers which tend to all fire
together at startup

7 years agomeson: factor out daemon/event/id128 sources into variables (#8170)
Davide Cavalca [Wed, 14 Feb 2018 13:08:50 +0000 (05:08 -0800)] 
meson: factor out daemon/event/id128 sources into variables (#8170)

7 years agopo: update Polish translation (#8169)
Piotr Drąg [Wed, 14 Feb 2018 13:06:14 +0000 (14:06 +0100)] 
po: update Polish translation (#8169)

7 years agoMerge pull request #8144 from poettering/journal-inotify-fixes
Zbigniew Jędrzejewski-Szmek [Wed, 14 Feb 2018 12:52:17 +0000 (13:52 +0100)] 
Merge pull request #8144 from poettering/journal-inotify-fixes

various journal fixes

7 years agoman: link latest FHS spec in file-hierarchy(7) (#8178)
Jan Synacek [Wed, 14 Feb 2018 10:34:47 +0000 (11:34 +0100)] 
man: link latest FHS spec in file-hierarchy(7) (#8178)

7 years agopo: update French translation
Sylvain Plantefève [Tue, 13 Feb 2018 19:45:54 +0000 (20:45 +0100)] 
po: update French translation

7 years agomailmap: one more person
Zbigniew Jędrzejewski-Szmek [Wed, 14 Feb 2018 08:34:46 +0000 (09:34 +0100)] 
mailmap: one more person

For a083b4875e8dec5ce5379d8bc437d750cd338c37.

7 years agomanager: avoid infinite loop for unexpected waitid() error (#8168)
Alan Jenkins [Tue, 13 Feb 2018 18:04:31 +0000 (18:04 +0000)] 
manager: avoid infinite loop for unexpected waitid() error (#8168)

I think if we log the error as being _ignored_, we should also consider
the event as handled and clear it.  This was the behaviour prior to
575b300b (PR #7968).

I don't think we particularly wanted to change behaviour and keep retrying.
Sometimes that's useful, other times you cause more problems by filling the
logs.

Plus a nearby typo fix.

7 years agol10n: update POTFILES.in (#8163)
AsciiWolf [Tue, 13 Feb 2018 03:05:22 +0000 (04:05 +0100)] 
l10n: update POTFILES.in (#8163)

7 years agotmpfiles: age root-owned read-only files, by default (#7917)
itsbill [Mon, 12 Feb 2018 14:47:08 +0000 (09:47 -0500)] 
tmpfiles: age root-owned read-only files, by default (#7917)

[zj: The note in NEWS was added in 82c8e3e6503a40684cf265842bb1c26a8f7681b5
and released as part of systemd-237.]

7 years agojournalctl: Periodically call sd_journal_process in journalctl 8144/head
Peter Portante [Sun, 28 Jan 2018 21:48:04 +0000 (16:48 -0500)] 
journalctl: Periodically call sd_journal_process in journalctl

If `journalctl` take a long time to process messages, and during that
time journal file rotation occurs, a `journalctl` client will keep
those rotated files open until it calls `sd_journal_process()`, which
typically happens as a result of calling `sd_journal_wait()` below in
the "following" case.  By periodically calling `sd_journal_process()`
during the processing loop we shrink the window of time a client
instance has open file descriptors for rotated (deleted) journal
files.

(Lennart: slightly reworked version, that dropped some of the commenting
which was solved otherwise)

7 years agosd-journal: make sure it's safe to call sd_journal_process() before the first sd_jour...
Lennart Poettering [Fri, 9 Feb 2018 21:38:46 +0000 (22:38 +0100)] 
sd-journal: make sure it's safe to call sd_journal_process() before the first sd_journal_wait()

In that case we have no inotify fd yet, and there's nothing to process
hence. Let's make the call a NOP.

(Previously, without this change we'd end up trying to read off inotify
fd -1, which is quite a problem... 😢)

7 years agocoredump,journal: when vacuuming use new unlinkat_deallocate() calls
Lennart Poettering [Fri, 9 Feb 2018 08:53:52 +0000 (09:53 +0100)] 
coredump,journal: when vacuuming use new unlinkat_deallocate() calls

This ensures that clients can't keep all files pinned interfering with
our vacuuming logic.

This should fix the last issue pointed out in #7998 and #8032

Fixes: #7998
7 years agorm-rf: make flags fields easier to read
Lennart Poettering [Fri, 9 Feb 2018 08:52:36 +0000 (09:52 +0100)] 
rm-rf: make flags fields easier to read

7 years agofs-util: add new unlinkat_deallocate() helper
Lennart Poettering [Fri, 9 Feb 2018 08:50:31 +0000 (09:50 +0100)] 
fs-util: add new unlinkat_deallocate() helper

This new helper not only removes a file from a directory but also
ensures its space on disk is deallocated, by either punching a hole over
the full file or truncating the file afterwards if the file's link
counter is 0. This is useful in "vacuuming" algorithms to ensure that
client's can't keep the disk space the vacuuming is supposed to recover
pinned simply by keeping an fd open to it.

7 years agocopy: wrap some unlink() calls in (void) casts
Lennart Poettering [Fri, 9 Feb 2018 08:50:13 +0000 (09:50 +0100)] 
copy: wrap some unlink() calls in (void) casts

7 years agosd-journal: properly handle inotify queue overflow
Lennart Poettering [Thu, 8 Feb 2018 19:11:43 +0000 (20:11 +0100)] 
sd-journal: properly handle inotify queue overflow

This adds proper handling of IN_Q_OVERFLOW: when the inotify queue runs
over we'll reiterate all directories we are looking at. At the same time
we'll mark all files and directories we encounter that way with a
generation counter we first increased. All files and directories not
marked like this are then unloaded.

With this logic we do the best when the inotify queue overflows: we
synchronize our in-memory state again with what's on disk.

This contains some refactoring of the directory logic, to share more
code between uuid directories and "root" directories and generally make
things a bit more readable by splitting things up into smaller bits.

See: #7998 #8032

7 years agosd-journal: use more appropriate API to validate 128bit ids
Lennart Poettering [Thu, 8 Feb 2018 19:10:51 +0000 (20:10 +0100)] 
sd-journal: use more appropriate API to validate 128bit ids

We have id128_is_valid(), let's use it.

7 years agotree-wide: use path_hash_ops instead of string_hash_ops whenever we key by a path
Lennart Poettering [Thu, 8 Feb 2018 17:58:35 +0000 (18:58 +0100)] 
tree-wide: use path_hash_ops instead of string_hash_ops whenever we key by a path

Let's make use of our new hash_ops!

7 years agohash-func: add generic hash_ops implementation for hashing paths
Lennart Poettering [Thu, 8 Feb 2018 17:31:15 +0000 (18:31 +0100)] 
hash-func: add generic hash_ops implementation for hashing paths

This is similar to string_hash_ops but operates one file system paths
specifically. It will ensure that "/foo//bar" and "///foo/bar" are
considered to be the same path for hashmap purposes.

This makes use of the existing path_compare() API, and adds a matching
hashing function for it.

Note that relative and absolute paths will hash to different values,
however whether the path is suffixed with a slash or not is not
detected. This matches the existing path_compare() behaviour, and
follows the logic that on Linux there can't be two different objects at
path /foo/bar and /foo/bar/ either.

7 years agohash-funcs: remove redundant definition of devt_hash_ops
Lennart Poettering [Thu, 8 Feb 2018 16:37:56 +0000 (17:37 +0100)] 
hash-funcs: remove redundant definition of devt_hash_ops

We should assign a value only in the .c file, not in both the .c and .h
file.

7 years agojournal: move code that checks for network fs to stat-util.[ch]
Lennart Poettering [Thu, 8 Feb 2018 16:14:37 +0000 (17:14 +0100)] 
journal: move code that checks for network fs to stat-util.[ch]

We have similar code in stat-util.[ch] and managing this at a central
place almost definitely is the better choice.

7 years agoMerge pull request #8143 from yuwata/drop-unused-func
Yu Watanabe [Sat, 10 Feb 2018 03:47:12 +0000 (12:47 +0900)] 
Merge pull request #8143 from yuwata/drop-unused-func

Drop several unused functions

7 years agosocket-util: drop getnameinfo_pretty() 8143/head
Yu Watanabe [Fri, 9 Feb 2018 08:52:05 +0000 (17:52 +0900)] 
socket-util: drop getnameinfo_pretty()

7 years agoRevert "Periodically call sd_journal_process in journalctl" (#8147)
Zbigniew Jędrzejewski-Szmek [Fri, 9 Feb 2018 19:10:00 +0000 (20:10 +0100)] 
Revert "Periodically call sd_journal_process in journalctl" (#8147)

This reverts commit 992149c07e3ecfbfe4067641e92a6923e7aacda4.

https://github.com/systemd/systemd/pull/8144#issuecomment-364464627
$ (set -o pipefail; sudo ./build/journalctl --no-pager | wc -l; echo $?)
Failed to process inotify events: Bad file descriptor
1025
1

7 years agobasic/socket-util: drop use of NI_IDN_USE_STD3_ASCII_RULES
Zbigniew Jędrzejewski-Szmek [Fri, 9 Feb 2018 12:31:37 +0000 (13:31 +0100)] 
basic/socket-util: drop use of NI_IDN_USE_STD3_ASCII_RULES

The only use of socknameinfo_pretty() is in src/journal-remote/journal-remote.c,
to determine the output filename.

Replaces #8120.

7 years agofd-util: move certain fds above fd #2 (#8129)
Lennart Poettering [Fri, 9 Feb 2018 16:53:28 +0000 (17:53 +0100)] 
fd-util: move certain fds above fd #2 (#8129)

This adds some paranoia code that moves some of the fds we allocate for
longer periods of times to fds > 2 if they are allocated below this
boundary. This is a paranoid safety thing, in order to avoid that
external code might end up erroneously use our fds under the assumption
they were valid stdin/stdout/stderr. Think: some app closes
stdin/stdout/stderr and then invokes 'fprintf(stderr, …' which causes
writes on our fds.

This both adds the helper to do the moving as well as ports over a
number of users to this new logic. Since we don't want to litter all our
code with invocations of this I tried to strictly focus on fds we keep
open for long periods of times only and only in code that is frequently
loaded into foreign programs (under the assumptions that in our own
codebase we are smart enough to always keep stdin/stdout/stderr
allocated to avoid this pitfall). Specifically this means all code used
by NSS and our sd-xyz API:

1. our logging APIs
2. sd-event
3. sd-bus
4. sd-resolve
5. sd-netlink

This changed was inspired by this:

https://github.com/systemd/systemd/issues/8075#issuecomment-363689755

This shows that apparently IRL there are programs that do close
stdin/stdout/stderr, and we should accomodate for that.

Note that this won't fix any bugs, this just makes sure that buggy
programs are less likely to interfere with out own code.

7 years agoSuspend on lid close based on power status. (#8016)
Simon Fowler [Fri, 9 Feb 2018 16:37:39 +0000 (02:37 +1000)] 
Suspend on lid close based on power status. (#8016)

This change adds support for controlling the suspend-on-lid-close
behaviour based on the power status as well as whether the machine is
docked or has an external monitor. For backwards compatibility the new
configuration file variable is ignored completely by default, and must
be set explicitly before being considered in any decisions.

7 years agoMerge pull request #8066 from LittleCVR/udevadm-trigger-and-settle
Zbigniew Jędrzejewski-Szmek [Fri, 9 Feb 2018 16:09:42 +0000 (17:09 +0100)] 
Merge pull request #8066 from LittleCVR/udevadm-trigger-and-settle

udevadm: allow trigger command to be synchronous

7 years agoMerge pull request #8134 from keszybz/unit-load-paths
Zbigniew Jędrzejewski-Szmek [Fri, 9 Feb 2018 16:08:23 +0000 (17:08 +0100)] 
Merge pull request #8134 from keszybz/unit-load-paths

Various fixes to unit load paths, and systemd-analyze load-paths verb to list them

7 years agoservice: relax PID file symlink chain checks a bit (#8133)
Lennart Poettering [Fri, 9 Feb 2018 16:05:17 +0000 (17:05 +0100)] 
service: relax PID file symlink chain checks a bit (#8133)

Let's read the PID file after all if there's a potentially unsafe
symlink chain in place. But if we do, then refuse taking the PID if its
outside of the cgroup.

Fixes: #8085
7 years agoman:systemd.service(5): fix description of specifiers in command lines (#8146)
Oleander Reis [Fri, 9 Feb 2018 16:03:09 +0000 (17:03 +0100)] 
man:systemd.service(5): fix description of specifiers in command lines (#8146)

Command lines now accept specifiers within the first argument.

see issues #3061, #679 and pr #4835

7 years agoanalyze: slight simplification 8134/head
Zbigniew Jędrzejewski-Szmek [Thu, 8 Feb 2018 21:20:19 +0000 (22:20 +0100)] 
analyze: slight simplification

7 years agoanalyze: remove implicit conversions of numbers to booleans
Zbigniew Jędrzejewski-Szmek [Thu, 8 Feb 2018 21:20:01 +0000 (22:20 +0100)] 
analyze: remove implicit conversions of numbers to booleans

7 years agoman: make Notes section in systemd.geneator(5) toplevel
Zbigniew Jędrzejewski-Szmek [Thu, 8 Feb 2018 15:33:28 +0000 (16:33 +0100)] 
man: make Notes section in systemd.geneator(5) toplevel

This is mostly a indentation change and rewrapping.

7 years agoman: document unit load paths
Zbigniew Jędrzejewski-Szmek [Thu, 8 Feb 2018 15:23:43 +0000 (16:23 +0100)] 
man: document unit load paths

So far we didn't document control, transient, dbus config, or generator paths.
But those paths are visible to users, and they need to understand why systemd
loads units from those paths, and how the precedence hierarchy looks.
The whole thing is a bit messy, since the list of paths is quite long.
I made the tables a bit shorter by combining rows for the alternatives
where $XDG_* is set and the fallback.

In various places, tags are split like <element
  param="blah">
this. This is necessary to keep everyting in one logical XML line so that
docbook renders the table properly.

Replaces #8050.

7 years agoshared/path-lookup: rename user control dirs to "user.control"
Zbigniew Jędrzejewski-Szmek [Thu, 8 Feb 2018 13:36:17 +0000 (14:36 +0100)] 
shared/path-lookup: rename user control dirs to "user.control"

$ diff -u <(old/systemd-analyze --user unit-paths) <(new/systemd-analyze --user unit-paths)|colordiff
--- /proc/self/fd/14 2018-02-08 14:36:34.190046129 +0100
+++ /proc/self/fd/15 2018-02-08 14:36:34.190046129 +0100
@@ -1,5 +1,5 @@
-/home/zbyszek/.config/systemd/system.control
-/run/user/1000/systemd/system.control
+/home/zbyszek/.config/systemd/user.control
+/run/user/1000/systemd/user.control
 /run/user/1000/systemd/transient
 ...

Strictly speaking, online upgrades of user instances through daemon-reexec will
be broken. We can get away with this since
a) reexecs of the user instance are not commonly done, at least package upgrade
   scripts don't do this afawk.
b) cgroups aren't delegateable on cgroupsv1 there's little reason to use "systemctl
   set-property" for --user mode

7 years agoshared/path-lookup: rearrange paths in --global mode to match --user mode
Zbigniew Jędrzejewski-Szmek [Thu, 8 Feb 2018 13:12:13 +0000 (14:12 +0100)] 
shared/path-lookup: rearrange paths in --global mode to match --user mode

It's not good if the paths are in different order. With --user, we expect
more paths, but it must be a strict superset, and the order for the ones
that appear in both sets must be the same.

$  diff -u <(build/systemd-analyze --global unit-paths) <(build/systemd-analyze --user unit-paths)|colordiff
--- /proc/self/fd/14 2018-02-08 14:11:45.425353107 +0100
+++ /proc/self/fd/15 2018-02-08 14:11:45.426353116 +0100
@@ -1,6 +1,17 @@
+/home/zbyszek/.config/systemd/system.control
+/run/user/1000/systemd/system.control
+/run/user/1000/systemd/transient
+/run/user/1000/systemd/generator.early
+/home/zbyszek/.config/systemd/user
 /etc/systemd/user
+/run/user/1000/systemd/user
 /run/systemd/user
+/run/user/1000/systemd/generator
+/home/zbyszek/.local/share/systemd/user
+/home/zbyszek/.local/share/flatpak/exports/share/systemd/user
+/var/lib/flatpak/exports/share/systemd/user
 /usr/local/share/systemd/user
 /usr/share/systemd/user
 /usr/local/lib/systemd/user
 /usr/lib/systemd/user
+/run/user/1000/systemd/generator.late

A test is added so that we don't regress on this.

7 years agopath-lookup: include paths from --global in --user search path too
Zbigniew Jędrzejewski-Szmek [Thu, 8 Feb 2018 12:57:05 +0000 (13:57 +0100)] 
path-lookup: include paths from --global in --user search path too

This doesn't matter that much, because set-property --global does not work,
so at least those paths wouldn't be used automatically. It is still possible
to create such snippets manually, so we better fix this.

7 years agopath-lookup: fix confusion between persistent_control and persistent_config
Zbigniew Jędrzejewski-Szmek [Thu, 8 Feb 2018 12:54:37 +0000 (13:54 +0100)] 
path-lookup: fix confusion between persistent_control and persistent_config

persistent_config would not appear in the search path at all, hence
those overrides would not work at all.

7 years agoshell-completion: add --global and unit-paths
Zbigniew Jędrzejewski-Szmek [Thu, 8 Feb 2018 11:09:28 +0000 (12:09 +0100)] 
shell-completion: add --global and unit-paths

7 years agoanalyze: add unit-paths verb
Zbigniew Jędrzejewski-Szmek [Fri, 9 Feb 2018 11:27:27 +0000 (12:27 +0100)] 
analyze: add unit-paths verb

7 years agoMerge pull request #8083 from shawnl/close-ssh
Lennart Poettering [Fri, 9 Feb 2018 11:17:26 +0000 (12:17 +0100)] 
Merge pull request #8083 from shawnl/close-ssh

sd-bus: cleanup ssh sessions (Closes: #8076)

7 years agoudevadm: check for oom and other style fixes 8066/head
Zbigniew Jędrzejewski-Szmek [Fri, 9 Feb 2018 11:04:03 +0000 (12:04 +0100)] 
udevadm: check for oom and other style fixes

7 years agoudevadm: allow trigger command to be synchronous
Mao [Thu, 1 Feb 2018 09:33:13 +0000 (17:33 +0800)] 
udevadm: allow trigger command to be synchronous

There are cases that we want to trigger and settle only specific
commands. For example, let's say at boot time we want to make sure all
the graphics devices are working correctly because it's critical for
booting, but not the USB subsystem (we'll trigger USB events later). So
we do:

  udevadm trigger --action="add" --subsystem-match="graphics"
  udevadm settle

However, we cannot block the kernel from emitting kernel events from
discovering USB devices. So if any of the USB kernel event was emitted
before the settle command, the settle command would still wait for the
entire queue to complete. And if the USB event takes a long time to be
processed, the system slows down.

The new `settle` option allows the `trigger` command to wait for only
the triggered events, and effectively solves this problem.

7 years agoMerge pull request #8142 from yuwata/sd-bus-memleak
Lennart Poettering [Fri, 9 Feb 2018 10:39:26 +0000 (11:39 +0100)] 
Merge pull request #8142 from yuwata/sd-bus-memleak

Fix potential memory leaks and several code style updates

7 years agofs-util: drop readlink_and_make_absolute_root()
Yu Watanabe [Fri, 9 Feb 2018 07:58:56 +0000 (16:58 +0900)] 
fs-util: drop readlink_and_make_absolute_root()

7 years agofs-util: drop readlink_and_canonicalize()
Yu Watanabe [Fri, 9 Feb 2018 07:49:54 +0000 (16:49 +0900)] 
fs-util: drop readlink_and_canonicalize()

7 years agocore: remove unnecessary initialization 8142/head
Yu Watanabe [Fri, 9 Feb 2018 07:36:37 +0000 (16:36 +0900)] 
core: remove unnecessary initialization

7 years agoudev: use "#pragma once"
Yu Watanabe [Fri, 9 Feb 2018 07:33:30 +0000 (16:33 +0900)] 
udev: use "#pragma once"

7 years agosd-bus: explicitly convert int to bool
Yu Watanabe [Fri, 9 Feb 2018 07:19:11 +0000 (16:19 +0900)] 
sd-bus: explicitly convert int to bool

7 years agosd-bus: use free_and_replace()
Yu Watanabe [Fri, 9 Feb 2018 07:21:51 +0000 (16:21 +0900)] 
sd-bus: use free_and_replace()

7 years agosd-bus: avoid potential memory leaks
Yu Watanabe [Fri, 9 Feb 2018 07:21:29 +0000 (16:21 +0900)] 
sd-bus: avoid potential memory leaks

7 years agoman: fix capability name in man:systemd-tmpfiles(8) (#8139)
Lucas Werkmeister [Fri, 9 Feb 2018 02:05:49 +0000 (03:05 +0100)] 
man: fix capability name in man:systemd-tmpfiles(8) (#8139)

CAP_ADMIN does not exist (the closest existing capability name would be
CAP_SYS_ADMIN), and according to man:open(2) and man:capabilities(7),
the capability required to specify O_NOATIME is actually CAP_FOWNER.

7 years agoPeriodically call sd_journal_process in journalctl
Peter Portante [Sun, 28 Jan 2018 21:48:04 +0000 (16:48 -0500)] 
Periodically call sd_journal_process in journalctl

If `journalctl` take a long time to process messages, and during that
time journal file rotation occurs, a `journalctl` client will keep
those rotated files open until it calls `sd_journal_process()`, which
typically happens as a result of calling `sd_journal_wait()` below in
the "following" case.  By periodically calling `sd_journal_process()`
during the processing loop we shrink the window of time a client
instance has open file descriptors for rotated (deleted) journal
files.

**Warning**

This change does not appear to solve the case of a "paused" output
stream. If somebody is using `journalctl | less` and pauses the
output, then without a background thread periodically listening for
inotify delete events and cleaning up, journal logs will eventually
stop flowing in cases where a journal client with enough open files
causes the "free" disk space threshold to be crossed.

7 years agosd-bus: cleanup ssh sessions (Closes: #8076) 8083/head
Shawn Landden [Sat, 3 Feb 2018 18:16:33 +0000 (10:16 -0800)] 
sd-bus: cleanup ssh sessions (Closes: #8076)

we still invoke ssh unnecessarily when there in incompatible or erreneous input
The fallow-up to finish that would make the code a bit more verbose,
as it would require repeating this bit:
```
        r = bus_connect_transport(arg_transport, arg_host, false, &bus);
        if (r < 0) {
                log_error_errno(r, "Failed to create bus connection: %m");
                goto finish;
        }

        sd_bus_set_allow_interactive_authorization(bus, arg_ask_password);
```
in every verb, after parsing.

v2: add waitpid() to avoid a zombie process, switch to SIGTERM from SIGKILL
v3: refactor, wait in bus_start_address()

7 years agomachine: add some missing asserts
Shawn Landden [Sat, 3 Feb 2018 03:14:32 +0000 (19:14 -0800)] 
machine: add some missing asserts

7 years agoanalyze: add --global option
Zbigniew Jędrzejewski-Szmek [Thu, 8 Feb 2018 10:53:00 +0000 (11:53 +0100)] 
analyze: add --global option

This is somewhat useful for 'verify', and will be used later with 'unit-paths'.

7 years agotree-wide: use "cannot" instead of "can not"
Zbigniew Jędrzejewski-Szmek [Thu, 8 Feb 2018 09:34:52 +0000 (10:34 +0100)] 
tree-wide: use "cannot" instead of "can not"

This is the usual spelling, and a bit shorter.

7 years agonetworkd: vxlan require Remote= to be a non multicast address (#8117)
Susant Sahani [Thu, 8 Feb 2018 09:22:46 +0000 (14:52 +0530)] 
networkd: vxlan require Remote= to be a non multicast address (#8117)

Remote= must be a non multicast address. ip-link(8) says:
> remote IPADDR - specifies the unicast destination IP address to
>                      use in outgoing packets when the destination link layer address
>                      is not known in the VXLAN device forwarding database.

Closes #8088.

7 years agoman: .service <filename> to <literal> (#8126)
Faalagorn [Thu, 8 Feb 2018 08:14:55 +0000 (09:14 +0100)] 
man: .service <filename> to <literal> (#8126)

Changed <filename>.service</filename> to <literal>.service</literal> to match style in other manual pages: man 5 systemd.socket, device, mount, automount, swap, target path, timer, slice and scope.

7 years agojournal: avoid code that relies on LOG_KERN == 0 (#8110)
Alan Jenkins [Thu, 8 Feb 2018 08:14:32 +0000 (08:14 +0000)] 
journal: avoid code that relies on LOG_KERN == 0 (#8110)

LOG_FAC() is the general way to extract the logging facility (when it has
been combined with the logging priority).

LOG_FACMASK can be used to mask off the priority so you only have the
logging facility bits... but to get the logging facility e.g. LOG_USER,
you also have to bitshift it as well.  (The priority is in the low bits,
and so only requires masking).

((priority & LOG_FACMASK) == LOG_KERN) happens to work only because
LOG_KERN is 0, and hence has the same value with or without the bitshift.

Code that relies on weird assumptions like this could make it harder to
realize how the logging values are treated.

7 years agoMerge pull request #8042 from zx2c4-forks/jd/networkctl-type
Zbigniew Jędrzejewski-Szmek [Thu, 8 Feb 2018 08:12:31 +0000 (09:12 +0100)] 
Merge pull request #8042 from zx2c4-forks/jd/networkctl-type

networkd: fixup networkctl type display

7 years agoman: "reboot" to "power off" in poweroff.target (#8124)
Faalagorn [Wed, 7 Feb 2018 18:10:41 +0000 (19:10 +0100)] 
man: "reboot" to "power off" in poweroff.target (#8124)

Changed "reboot" to "power off" in poweroff.target description. It was most likely copied and pasted from the reboot.target below, compare with e.g. halt.target

7 years agocore: use id unit when retrieving unit file state (#8038)
Franck Bui [Wed, 7 Feb 2018 13:08:02 +0000 (14:08 +0100)] 
core: use id unit when retrieving unit file state (#8038)

Previous code was using the basename(id->fragment_path) which returned
incorrect result if the unit was an instance.

For example, assuming that no instances of "template" have been created so far:

 $ systemctl enable template@1
 Created symlink from /etc/systemd/system/multi-user.target.wants/template@1.service to /usr/lib/systemd/system/template@.service.

 $ systemctl is-enabled template@3.service
 disabled

 $ systemctl status template@3.service
 ● template@3.service - openQA Worker #3
    Loaded: loaded (/usr/lib/systemd/system/template@.service; enabled; vendor preset: disabled)
    [...]

Here the unit file states reported by "status" and "is-enabled" were different.

7 years agoMerge pull request #8104 from keszybz/tmpfiles-allow-overrides
Lennart Poettering [Wed, 7 Feb 2018 11:12:52 +0000 (12:12 +0100)] 
Merge pull request #8104 from keszybz/tmpfiles-allow-overrides

tmpfiles allow overrides

7 years agoprocess-util: use raw_getpid() in getpid_cache() internally (#8115)
Lennart Poettering [Wed, 7 Feb 2018 02:10:09 +0000 (03:10 +0100)] 
process-util: use raw_getpid() in getpid_cache() internally (#8115)

We have the raw_getpid() definition in place anyway, and it's certainly
beneficial to expose the same semantics on pre glibc 2.24 and after it
too, hence always bypass glibc for this, and always cache things on our
side.

Fixes: #8113
7 years agocore: Avoid empty directory warning when we are bind-mounting a file (#8069)
Andrei Gherzan [Tue, 6 Feb 2018 15:35:52 +0000 (15:35 +0000)] 
core: Avoid empty directory warning when we are bind-mounting a file (#8069)

7 years agoMerge pull request #8044 from yuwata/fix-7790
Zbigniew Jędrzejewski-Szmek [Tue, 6 Feb 2018 10:03:02 +0000 (11:03 +0100)] 
Merge pull request #8044 from yuwata/fix-7790

 core: make ExecRuntime be manager managed object

7 years agoMerge pull request #8107 from sourcejedi/pedant
Zbigniew Jędrzejewski-Szmek [Tue, 6 Feb 2018 09:17:05 +0000 (10:17 +0100)] 
Merge pull request #8107 from sourcejedi/pedant

core: a couple of tidyups to synthesized units

7 years agoAdd more file triggers to handle more aspects of systemd (#8090)
Neal Gompa (ニール・ゴンパ) [Tue, 6 Feb 2018 09:11:36 +0000 (04:11 -0500)] 
Add more file triggers to handle more aspects of systemd (#8090)

For quite a while now, there have been file triggers to handle
automatically setting up service units in upstream systemd. However,
most of the actions being done by these macros upon files can be set up
as RPM file triggers.

In fact, in Mageia, we had been doing this for most of these. In particular,
we have file triggers in place for sysusers, tmpfiles, hwdb, and the journal.

This change adds Lua versions of the original file triggers used in Mageia,
based on the existing Lua-based file triggers for service units.

In addition, we can also have useful file triggers for udev rules, sysctl
directives, and binfmt directives. These are based on the other existing
file triggers.

7 years agoMerge pull request #8112 from yuwata/gcc-warning
Zbigniew Jędrzejewski-Szmek [Tue, 6 Feb 2018 09:09:29 +0000 (10:09 +0100)] 
Merge pull request #8112 from yuwata/gcc-warning

Fix gcc warnings

7 years agonss-mymachines: add work-around to silence gcc warning 8112/head
Yu Watanabe [Tue, 6 Feb 2018 08:08:38 +0000 (17:08 +0900)] 
nss-mymachines: add work-around to silence gcc warning

This is similar to 3c3d384ae93700ef08545b078c37065fdb98eee7 and
a workaround for the following warning.
```
In file included from ../src/basic/in-addr-util.h:28,
                 from ../src/nss-mymachines/nss-mymachines.c:31:
../src/nss-mymachines/nss-mymachines.c: In function '_nss_mymachines_getgrnam_r':
../src/nss-mymachines/nss-mymachines.c:653:32: warning: argument to 'sizeof' in 'memset' call is the same pointer type 'char *' as the destination; expected 'char' or an explicit length [-Wsizeof-pointer-memaccess]
         memzero(buffer, sizeof(char*));
                                ^~~~
../src/basic/util.h:118:39: note: in definition of macro 'memzero'
 #define memzero(x,l) (memset((x), 0, (l)))
                                       ^
../src/nss-mymachines/nss-mymachines.c: In function '_nss_mymachines_getgrgid_r':
../src/nss-mymachines/nss-mymachines.c:730:32: warning: argument to 'sizeof' in 'memset' call is the same pointer type 'char *' as the destination; expected 'char' or an explicit length [-Wsizeof-pointer-memaccess]
         memzero(buffer, sizeof(char*));
                                ^~~~
../src/basic/util.h:118:39: note: in definition of macro 'memzero'
 #define memzero(x,l) (memset((x), 0, (l)))
                                       ^
```

7 years agonetworkd: fix dhcp6_prefixes_compare_func()
Yu Watanabe [Tue, 6 Feb 2018 08:05:58 +0000 (17:05 +0900)] 
networkd: fix dhcp6_prefixes_compare_func()

Found by the following warning by gcc.
```
../src/network/networkd-manager.c: In function 'dhcp6_prefixes_compare_func':
../src/network/networkd-manager.c:1383:16: warning: 'memcmp' reading 16 bytes from a region of size 8 [-Wstringop-overflow=]
         return memcmp(&a, &b, sizeof(*a));
                ^
```

7 years agocore/execute: make arguments constant if possible 8044/head
Yu Watanabe [Tue, 6 Feb 2018 03:17:50 +0000 (12:17 +0900)] 
core/execute: make arguments constant if possible

Also make functions static if possible.

7 years agocore: make ExecRuntime be manager managed object
Yu Watanabe [Tue, 6 Feb 2018 07:00:34 +0000 (16:00 +0900)] 
core: make ExecRuntime be manager managed object

Before this, each ExecRuntime object is owned by a unit. However,
it may be shared with other units which enable JoinsNamespaceOf=.
Thus, by the serialization/deserialization process, its sharing
information, more specifically, reference counter is lost, and
causes issue #7790.

This makes ExecRuntime objects be managed by manager, and changes
the serialization/deserialization process.

Fixes #7790.

7 years agoMerge pull request #8101 from keszybz/two-gcc-workarounds
Lennart Poettering [Mon, 5 Feb 2018 17:59:52 +0000 (18:59 +0100)] 
Merge pull request #8101 from keszybz/two-gcc-workarounds

Two gcc workarounds

7 years agojournal: include kmsg lines from the systemd process which exec()d us (#8078)
Alan Jenkins [Mon, 5 Feb 2018 16:53:40 +0000 (16:53 +0000)] 
journal: include kmsg lines from the systemd process which exec()d us (#8078)

Let the journal capture messages emitted by systemd, before it ran
exec("/usr/lib/systemd/systemd-journald").  Usually such messages will only
appear with `systemd.log_level=debug`.  kmsg lines written after the exec()
will be ignored as before.

In other words, we are avoiding reading our own lines, which start
"systemd-journald[100]: " assuming we are PID 100.  But now we will start
allowing ourself to read lines which start "systemd[100]: ", or any other
prefix which is not "systemd-journald[100]: ".

So this can't help you see messages when we fail to exec() journald :). But,
it makes it easier to see what the pre-exec() messages look like in
the successful case.  Comparing messages like this can be useful when
debugging.  Noticing weird omissions of messages, otoh, makes me anxious.

7 years agohwdb: fix mute microphone button on TravelMate P645-S (#8105)
CuBiC [Mon, 5 Feb 2018 16:43:23 +0000 (17:43 +0100)] 
hwdb: fix mute microphone button on TravelMate P645-S (#8105)

7 years agonss-systemd: add work-around to silence gcc warning 8101/head
Zbigniew Jędrzejewski-Szmek [Mon, 5 Feb 2018 10:07:40 +0000 (11:07 +0100)] 
nss-systemd: add work-around to silence gcc warning

In file included from ../src/basic/fs-util.h:32,
                 from ../src/nss-systemd/nss-systemd.c:28:
../src/nss-systemd/nss-systemd.c: In function '_nss_systemd_getgrnam_r':
../src/nss-systemd/nss-systemd.c:416:32: warning: argument to 'sizeof' in 'memset' call is the same pointer type 'char *' as the destination; expected 'char' or an explicit length [-Wsizeof-pointer-memaccess]
         memzero(buffer, sizeof(char*));
                                ^~~~
../src/basic/util.h:118:39: note: in definition of macro 'memzero'
 #define memzero(x,l) (memset((x), 0, (l)))
                                       ^

gcc is trying to be helpful, and it's not far from being right. It _looks_ like
sizeof(char*) is an error, but in this case we're really leaving a space empty
for a pointer, and our calculation is correct. Since this is a short file,
let's just use simplest option and turn off the warning above the two functions
that trigger it.

7 years agobasic/glob-util: add closedir wrapper to silence gcc
Zbigniew Jędrzejewski-Szmek [Mon, 5 Feb 2018 09:55:24 +0000 (10:55 +0100)] 
basic/glob-util: add closedir wrapper to silence gcc

../src/test/test-glob-util.c: In function 'test_glob_no_dot':
../src/test/test-glob-util.c:61:32: warning: cast between incompatible function types from 'int (*)(DIR *)' {aka 'int (*)(struct __dirstream *)'} to 'void (*)(void *)' [-Wcast-function-type]
                 .gl_closedir = (void (*)(void *)) closedir,
                                ^

7 years agorpm macros: add %tmpfiles_create_package 8104/head
Zbigniew Jędrzejewski-Szmek [Mon, 5 Feb 2018 14:02:07 +0000 (15:02 +0100)] 
rpm macros: add %tmpfiles_create_package

I expect that this will be mostly obsoleted by transfiletriggers that
(I hope) we will soon add. But let's do this for completeness anyway.
I'm keeping the description of the macro a bit vague, since I expect
that it'll be changed when transfiletriggers are added.

7 years agotmpfiles: allow admin/runtime overrides to runtime config
Zbigniew Jędrzejewski-Szmek [Mon, 5 Feb 2018 13:53:11 +0000 (14:53 +0100)] 
tmpfiles: allow admin/runtime overrides to runtime config

This is very similar to d16a1c1bb6. For tmpfiles this is much less useful
compared to sysusers, but let's add this anyway for consistency.

7 years agoMerge pull request #8077 from sourcejedi/seccomp_cosmetic
Lennart Poettering [Mon, 5 Feb 2018 12:52:23 +0000 (13:52 +0100)] 
Merge pull request #8077 from sourcejedi/seccomp_cosmetic

seccomp: allow x86-64 syscalls on x32, used by the VDSO (fix #8060)

7 years agoMerge pull request #8100 from keszybz/free-gcrypt-context
Lennart Poettering [Mon, 5 Feb 2018 12:47:29 +0000 (13:47 +0100)] 
Merge pull request #8100 from keszybz/free-gcrypt-context

Free gcrypt contexts properly

7 years agohwdb: added Cube i7 Book rotation info (#8103)
Olof Mogren [Mon, 5 Feb 2018 10:52:43 +0000 (11:52 +0100)] 
hwdb: added Cube i7 Book rotation info (#8103)

7 years agoresolved: use _cleanup_ in one more place 8100/head
Zbigniew Jędrzejewski-Szmek [Mon, 5 Feb 2018 09:07:39 +0000 (10:07 +0100)] 
resolved: use _cleanup_ in one more place

No functional change.

7 years agoresolved: fix memleak of gcrypt context on error
Zbigniew Jędrzejewski-Szmek [Mon, 5 Feb 2018 09:06:36 +0000 (10:06 +0100)] 
resolved: fix memleak of gcrypt context on error

Bug found by Stef Bon <stefbon@gmail.com>. Thanks!

7 years agogcrypt-util: fix memleak
Zbigniew Jędrzejewski-Szmek [Mon, 5 Feb 2018 08:54:57 +0000 (09:54 +0100)] 
gcrypt-util: fix memleak

7 years agotest: add a simple smoke test for string_hashsum()
Zbigniew Jędrzejewski-Szmek [Mon, 5 Feb 2018 08:48:38 +0000 (09:48 +0100)] 
test: add a simple smoke test for string_hashsum()

This is enough to show memory leakages pointed out by Stef Bon <stefbon@gmail.com>.

7 years agoMerge pull request #8058 from keszybz/sysusers-inline
Yu Watanabe [Mon, 5 Feb 2018 07:50:51 +0000 (16:50 +0900)] 
Merge pull request #8058 from keszybz/sysusers-inline

Extend sysusers for package installation scripts

7 years agoman: document meaning of age in tmpfiles.d (#8092)
Lucas Werkmeister [Mon, 5 Feb 2018 07:19:09 +0000 (08:19 +0100)] 
man: document meaning of age in tmpfiles.d (#8092)

This documents how the age of a file is determined, which previously was
only alluded to in other parts of the documentation. Fixes #8091.

The phrasings of “last modification timestamp” etc. are taken from
man:inode(7) (as of man-pages 4.14). The debug messages in tmpfiles.c
use different messages (“modify time”), which according to a code
comment follow man:stat(1); however, my copy of that manpage (from GNU
coreutils 8.29) documents %y as “time of last data modification”
instead.

7 years agoMerge pull request #8065 from yuwata/fix-8064
Zbigniew Jędrzejewski-Szmek [Mon, 5 Feb 2018 07:17:26 +0000 (08:17 +0100)] 
Merge pull request #8065 from yuwata/fix-8064

systemctl: update 'show' command formats

7 years agotest: sort imports and use "new" string formatting
Batuhan Osman Taşkaya [Mon, 5 Feb 2018 06:28:53 +0000 (09:28 +0300)] 
test: sort imports and use "new" string formatting

Followed PEP8 and PEP3101 rules (#8079)
Imports re-ordered by Alphabetical Standarts for following PEP8
Old type string formattings (" example %s " % exampleVar ) re-writed as new type string
formattings ( " example {} ".format(exampleVar) ) for following PEP3101