]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
6 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)

6 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

6 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.

6 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

6 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

6 years agosystemctl: show: use EnvironmentFiles= instead of EnvironmentFile= 8065/head
Yu Watanabe [Thu, 1 Feb 2018 10:39:30 +0000 (19:39 +0900)] 
systemctl: show: use EnvironmentFiles= instead of EnvironmentFile=

EnvironmentFile= is used in the unit file, but in the dbus,
the related field name is EnvironmentFiles=.
As the other variables, let's use the field name instead of the name
used in the unit file setting.

6 years agosystemctl: update 'show' format for path units
Yu Watanabe [Thu, 1 Feb 2018 06:22:00 +0000 (15:22 +0900)] 
systemctl: update 'show' format for path units

Before this.
```
$ systemctl show cups.path | grep ^Path
PathExistsGlob=/var/spool/cups/d*
$ systemctl show --property PathExistsGlob cups.path
$ systemctl show --property Paths cups.path
PathExistsGlob=/var/spool/cups/d*
```

After this.
```
$ systemctl show cups.path | grep ^Path
Paths=/var/spool/cups/d* (PathExistsGlob)
$ systemctl show --property Paths cups.path
Paths=/var/spool/cups/d* (PathExistsGlob)
```

6 years agosystemctl: update 'show' format for socket units
Yu Watanabe [Thu, 1 Feb 2018 06:18:17 +0000 (15:18 +0900)] 
systemctl: update 'show' format for socket units

Before this.
```
$ systemctl show systemd-journald.socket | grep Listen
ListenStream=/run/systemd/journal/stdout
ListenDatagram=/run/systemd/journal/socket
$ systemctl show --property ListenStream systemd-journald.socket
$ systemctl show --property ListenDatagram systemd-journald.socket
$ systemctl show --property Listen systemd-journald.socket
ListenStream=/run/systemd/journal/stdout
ListenDatagram=/run/systemd/journal/socket
```

After this.
```
$ systemctl show systemd-journald.socket | grep Listen
Listen=/run/systemd/journal/stdout (Stream)
Listen=/run/systemd/journal/socket (Datagram)
$ systemctl show --property Listen systemd-journald.socket
ListenStream=/run/systemd/journal/stdout
ListenDatagram=/run/systemd/journal/socket
```

Fixes #8064.

6 years agosystemctl: show Timers{Monotonic,Calendar}=
Yu Watanabe [Mon, 5 Feb 2018 06:27:42 +0000 (15:27 +0900)] 
systemctl: show Timers{Monotonic,Calendar}=

6 years agokernel 3.10 compat: RTAX_QUICKACK not added until 3.11.0 (#8094)
MilhouseVH [Mon, 5 Feb 2018 05:26:57 +0000 (05:26 +0000)] 
kernel 3.10 compat: RTAX_QUICKACK not added until 3.11.0 (#8094)

6 years agoMerge pull request #8073 from keszybz/two-fixes
Yu Watanabe [Sat, 3 Feb 2018 11:11:17 +0000 (20:11 +0900)] 
Merge pull request #8073 from keszybz/two-fixes

Two fixes

6 years agosocket-util: fix getpeergroups() assert(fd) (#8080)
Vito Caputo [Sat, 3 Feb 2018 11:09:08 +0000 (03:09 -0800)] 
socket-util: fix getpeergroups() assert(fd) (#8080)

Don't assert on zero-value fds.

Fixes #8075.

6 years agoMerge pull request #8041 from zx2c4-forks/jd/doc-fixups
Zbigniew Jędrzejewski-Szmek [Fri, 2 Feb 2018 15:22:47 +0000 (16:22 +0100)] 
Merge pull request #8041 from zx2c4-forks/jd/doc-fixups

WireGuard documentation fixes

6 years agodo not report total time when kernel time is not provided (#8063)
Boucman [Fri, 2 Feb 2018 14:58:40 +0000 (15:58 +0100)] 
do not report total time when kernel time is not provided (#8063)

the whole systemd-analyze time logic is based on the fact that monotonic
time 0 is the start of the kernel.

If the firmware does not provide a correct time, firmware_time degrades to
0, which is the start of the kernel. The diference between FinishTime and
firmware_time is thus correct.

That assumption is still true with containers, but the start time of the
kernel is not what the user expects : It's the time when the host booted.

The total is thus still correct, but highly misleading. Containers can be
easily detected (and, in fact, already are) by systemd not reporting any
kernel non-monotonic timestamp.

This patch simply avoids printing a misleading time when it can detect that
case

6 years agoMerge pull request #8059 from sourcejedi/seccomp_cosmetic
Zbigniew Jędrzejewski-Szmek [Fri, 2 Feb 2018 14:37:44 +0000 (15:37 +0100)] 
Merge pull request #8059 from sourcejedi/seccomp_cosmetic

 Cosmetic seccomp fixes (#8002/#8001)

6 years agoman: fix awkward sentence in systemd-analyze(8) 8073/head
Zbigniew Jędrzejewski-Szmek [Fri, 2 Feb 2018 13:39:57 +0000 (14:39 +0100)] 
man: fix awkward sentence in systemd-analyze(8)

Closes #8070.

6 years agobasic/hashmap: tweak code to avoid pointless gcc warning
Zbigniew Jędrzejewski-Szmek [Fri, 2 Feb 2018 13:34:00 +0000 (14:34 +0100)] 
basic/hashmap: tweak code to avoid pointless gcc warning

gcc says:
[196/1142] Compiling C object 'src/basic/basic@sta/hashmap.c.o'.
../src/basic/hashmap.c: In function ‘cachemem_maintain’:
../src/basic/hashmap.c:1913:17: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
                 mem->active = r = true;
                 ^~~

which conflates two things: the first is transitive assignent a = b = c = d;
the second is assignment of the value of an expression, which happens to be a
an assignment expression here, and boolean. While the second _should_ be
parenthesized, the first should _not_, and it's more natural to understand
our code as the first, and gcc should treat this as an exception and not emit
the warning. But since it's a while until this will be fixed, let's update
our code too.

6 years agosysusers: use the usual comment style 8058/head
Zbigniew Jędrzejewski-Szmek [Fri, 2 Feb 2018 09:35:21 +0000 (10:35 +0100)] 
sysusers: use the usual comment style

6 years agorpm macros: add %sysusers_create_package
Zbigniew Jędrzejewski-Szmek [Wed, 31 Jan 2018 15:07:59 +0000 (16:07 +0100)] 
rpm macros: add %sysusers_create_package

This is close to %sysusers_create_inline and %sysusers_create that we had
already, but expects a file name and uses --replace= to implement proper
priority.

This is used like:
  %sysusers_create_package %{name} %SOURCE1
where %SOURCE1 is a file with called %{name}.conf that will be installed
into /usr/lib/sysusers.d/.

The tough part is that the file needs to be available before %prep,
i.e. outside of the source tarball. This is because the spec file is
parsed (and any macros expanded), before the sources are unpackaged.

v2:
- disallow the case case when --config-name= is given but there are no
  positional args. Most likely this would be a user error, so at least for now
  forbid it.
v3:
- replace --config-name= with --target=
- drop quotes around %1 and %2 — if necessary, the caller should add
  those.
v4:
- replace --target with --replace
- add a big comment

6 years agotest/TEST-21-SYSUSERS: add tests for new functionality
Zbigniew Jędrzejewski-Szmek [Fri, 2 Feb 2018 07:53:47 +0000 (08:53 +0100)] 
test/TEST-21-SYSUSERS: add tests for new functionality

6 years agosysusers: allow admin/runtime overrides to command-line config
Zbigniew Jędrzejewski-Szmek [Wed, 31 Jan 2018 14:37:02 +0000 (15:37 +0100)] 
sysusers: allow admin/runtime overrides to command-line config

When used in a package installation script, we want to invoke systemd-sysusers
before that package is installed (so it can contain files owned by the newly
created user), so the configuration to use is specified on the command
line. This should be a copy of the configuration that will be installed as
/usr/lib/sysusers.d/package.conf. We still want to obey any overrides in
/etc/sysusers.d or /run/sysusers.d in the usual fashion. Otherwise, we'd get a
different result when systemd-sysusers is run with a copy of the new config on
the command line and when systemd-sysusers is run at boot after package
instalation. In the second case any files in /etc or /run have higher priority,
so the same should happen when the configuration is given on the command line.
More generally, we want the behaviour in this special case to be as close to
the case where the file is finally on disk as possible, so we have to read all
configuration files, since they all might contain overrides and additional
configuration that matters. Even files that have lower priority might specify
additional groups for the user we are creating. Thus, we need to read all
configuration, but insert our new configuration somewhere with the right
priority.

If --target=/path/to/file.conf is given on the command line, we gather the list
of files, and pretend that the command-line config is read from
/path/to/file.conf (doesn't matter if the file on disk actually exists or
not). All package scripts should use this option to obtain consistent and
idempotent behaviour.

The corner case when --target= is specified and there are no positional
arguments is disallowed.

v1:
- version with --config-name=
v2:
- disallow --config-name= and no positional args
v3:
- remove --config-name=
v4:
- add --target= and rework the code completely
v5:
- fix argcounting bug and add example in man page
v6:
- rename --target to --replace

6 years agobasic/strv: add function to insert items at position
Zbigniew Jędrzejewski-Szmek [Thu, 1 Feb 2018 11:50:18 +0000 (12:50 +0100)] 
basic/strv: add function to insert items at position

6 years agosysusers: allow the shell to be specified
Zbigniew Jędrzejewski-Szmek [Tue, 30 Jan 2018 13:28:10 +0000 (14:28 +0100)] 
sysusers: allow the shell to be specified

This is necessary for some system users where the "login shell" is
set to a specific binary.

6 years agosysusers: take configuration as positional arguments
Zbigniew Jędrzejewski-Szmek [Mon, 29 Jan 2018 13:47:01 +0000 (14:47 +0100)] 
sysusers: take configuration as positional arguments

If the configuration is included in a script, this is more convient.
I thought it would be possible to use this for rpm scriptlets with
'%pre -p systemd-sysuser "..."', but apparently there is no way to pass
arguments to the executable ($1 is used for the package installation count).
But this functionality seems generally useful, e.g. for testing and one-off
scripts, so let's keep it.

There's a slight change in behaviour when files are given on the command line:
if we cannot parse them, error out instead of ignoring the failure. When trying
to parse all configuration files, we don't want to fail even if some config
files are broken, but when parsing a list of items specified explicitly, we
should.

v2:
- rename --direct to --inline

6 years agosysusers: emit a bit more info at debug level when locking fails
Zbigniew Jędrzejewski-Szmek [Mon, 29 Jan 2018 13:23:31 +0000 (14:23 +0100)] 
sysusers: emit a bit more info at debug level when locking fails

This is the first error message when running unprivileged, and the message is
unspecific, so let's at least add some logging at debug level to make this less
confusing.

6 years agomeson.build: make docdir configurable (#8068)
tblume [Thu, 1 Feb 2018 21:46:15 +0000 (22:46 +0100)] 
meson.build: make docdir configurable (#8068)

SUSE is using a different docdir, so the path should be configurable

6 years agoMerge pull request #7042 from vcaputo/iteratedcache
Lennart Poettering [Thu, 1 Feb 2018 17:08:50 +0000 (18:08 +0100)] 
Merge pull request #7042 from vcaputo/iteratedcache

RFC: Optionally cache hashmap iterated results

6 years agoMerge pull request #8045 from yuwata/dump-more
Lennart Poettering [Thu, 1 Feb 2018 09:16:50 +0000 (10:16 +0100)] 
Merge pull request #8045 from yuwata/dump-more

analyze: dump more settings

6 years agoMerge pull request #8061 from poettering/selinux-mask-fix
Lennart Poettering [Thu, 1 Feb 2018 09:11:30 +0000 (10:11 +0100)] 
Merge pull request #8061 from poettering/selinux-mask-fix

never use /dev/null label when making selinux access decisions

6 years agostrv: drop strv_join_quoted() (#8057)
Yu Watanabe [Thu, 1 Feb 2018 09:11:02 +0000 (18:11 +0900)] 
strv: drop strv_join_quoted() (#8057)

The function `strv_join_quoted()` is now not used, and has a bug
in the buffer size calculation when the strings needs to escaped,
as reported in #8056.
So, let's remove the function.

Closes #8056.

6 years agosysusers: allow force reusing existing user/group IDs (#8037)
Michael Vogt [Thu, 1 Feb 2018 04:47:50 +0000 (05:47 +0100)] 
sysusers: allow force reusing existing user/group IDs (#8037)

On Debian/Ubuntu systems the default passwd/group files use a
slightly strange mapping. E.g. in passwd:
```
man:x:6:12::/var/cache/man:/sbin/nologin
```
and in group:
```
disk:x:6:
man:x:12:
```

This is not supported in systemd-sysusers right now because
sysusers will not re-use an existing uid/gid in its normal
mode of operation. Unfortunately this reuse is needed to
replicate the default Debian/Ubuntu users/groups.

This commit enforces reuse when the "uid:gid" syntax is used
to fix this.

I also added a test that replicates the Debian base-passwd
passwd/group file to ensure things are ok.

6 years agoselinux: make sure we never use /dev/null for making unit selinux access decisions 8061/head
Lennart Poettering [Wed, 31 Jan 2018 18:53:43 +0000 (19:53 +0100)] 
selinux: make sure we never use /dev/null for making unit selinux access decisions

6 years agoupdate TODO
Lennart Poettering [Wed, 31 Jan 2018 18:53:16 +0000 (19:53 +0100)] 
update TODO

6 years agoseccomp-util: fix alarming debug message (#8002, #8001) 8059/head
Alan Jenkins [Wed, 31 Jan 2018 17:11:47 +0000 (17:11 +0000)] 
seccomp-util: fix alarming debug message (#8002, #8001)

Booting with `systemd.log_level=debug` and looking in `dmesg -u` showed
messages like this:

    systemd[433]: Failed to add rule for system call n/a() / 156, ignoring:
    Numerical argument out of domain

This commit fixes it to:

    systemd[449]: Failed to add rule for system call _sysctl() / 156,
    ignoring: Numerical argument out of domain

Some of the messages could be even more misleading, e.g. we were reporting
that utimensat() / 320 was skipped as non-existent on x86, when actually
the syscall number 320 is kexec_file_load() on x86 .

The problem was that syscall NRs are looked up (and correctly passed to
libseccomp) as native syscall NRs.  But we forgot that when we tried to
go back from the syscall NR to the name.

I think the natural way to write this would be
seccomp_syscall_resolve_num(nr), however there is no such function.
I couldn't work out a short comment that would make this clearer.  FWIW
I wrote it up as a ticket for libseccomp instead.
https://github.com/seccomp/libseccomp/issues/104

6 years agoman: systemd.exec: cleanup "only X will be permitted" ... "but X=X+1"
Alan Jenkins [Wed, 31 Jan 2018 15:39:13 +0000 (15:39 +0000)] 
man: systemd.exec: cleanup "only X will be permitted" ... "but X=X+1"

> Only system calls of the *specified* architectures will be permitted to
> processes of this unit.

(my emphasis)

> Note that setting this option to a non-empty list implies that
> native is included too.

Attempting to use "implies" in the later sentence, in a way that
contradicts the very clear meaning of the earlier sentence... it's too
much.

6 years agotest-lldp: use `memcmp` to compare bytes (#8054)
Evgeny Vereshchagin [Wed, 31 Jan 2018 08:54:37 +0000 (11:54 +0300)] 
test-lldp: use `memcmp` to compare bytes (#8054)

Technically, `data` is a sequence of bytes without a trailing zero,
so the use of `memcmp` seems to be logical here. Besides, this helps get
around a bug that makes `asan` report the false positive mentioned in
 #8052.

Closes #8052.

6 years agocore/service: dump more settings 8045/head
Yu Watanabe [Tue, 30 Jan 2018 08:10:47 +0000 (17:10 +0900)] 
core/service: dump more settings

6 years agocore/swap: dump TimeoutSec=
Yu Watanabe [Tue, 30 Jan 2018 08:10:09 +0000 (17:10 +0900)] 
core/swap: dump TimeoutSec=

6 years agocore/mount: dump TimeoutSec=
Yu Watanabe [Tue, 30 Jan 2018 08:09:59 +0000 (17:09 +0900)] 
core/mount: dump TimeoutSec=

6 years agoman: note handling of secret information with permissions 8041/head
Jason A. Donenfeld [Mon, 29 Jan 2018 19:43:30 +0000 (20:43 +0100)] 
man: note handling of secret information with permissions

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agoman: WireGuard is a proper noun
Jason A. Donenfeld [Mon, 29 Jan 2018 19:38:36 +0000 (20:38 +0100)] 
man: WireGuard is a proper noun

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agoMerge pull request #8031 from mrq1/MRQ1_20180128_typo_fix
Vito Caputo [Sun, 28 Jan 2018 21:03:39 +0000 (13:03 -0800)] 
Merge pull request #8031 from mrq1/MRQ1_20180128_typo_fix

journalctl: typo fix

6 years agojournalctl: typo fix 8031/head
Hermann Gausterer [Sun, 28 Jan 2018 19:49:55 +0000 (20:49 +0100)] 
journalctl: typo fix

6 years agoMerge pull request #8030 from keszybz/another-news-update v237
Lennart Poettering [Sun, 28 Jan 2018 15:58:17 +0000 (16:58 +0100)] 
Merge pull request #8030 from keszybz/another-news-update

NEWS: reword one sentence

6 years agoNEWS: add missing equal sign 8030/head
Zbigniew Jędrzejewski-Szmek [Sun, 28 Jan 2018 15:54:18 +0000 (16:54 +0100)] 
NEWS: add missing equal sign

Important!

6 years agoNEWS: reword one sentence
Zbigniew Jędrzejewski-Szmek [Sun, 28 Jan 2018 15:52:47 +0000 (16:52 +0100)] 
NEWS: reword one sentence

6 years agoNEWS: let's get this thing done
Lennart Poettering [Sun, 28 Jan 2018 15:36:03 +0000 (16:36 +0100)] 
NEWS: let's get this thing done

6 years agoNEWS: mention --grep (#8029)
Zbigniew Jędrzejewski-Szmek [Sun, 28 Jan 2018 14:52:06 +0000 (15:52 +0100)] 
NEWS: mention --grep (#8029)

6 years agoMerge pull request #7881 from keszybz/pcre
Lennart Poettering [Sun, 28 Jan 2018 14:29:10 +0000 (15:29 +0100)] 
Merge pull request #7881 from keszybz/pcre

Add new --grep option to journalctl

6 years agojournalctl: add highlighting for matched substring 7881/head
Zbigniew Jędrzejewski-Szmek [Sat, 27 Jan 2018 12:00:09 +0000 (13:00 +0100)] 
journalctl: add highlighting for matched substring

Red is used for highligting, the same as grep does. Except when the line is
highlighted red already, because it has high priority, in which case plain ansi
highlight is used for the matched substring.

Coloring is implemented for short and cat outputs, and not for other types.
I guess we could also add it for verbose output in the future.

6 years agojournalctl: make matching optionally case sensitive
Zbigniew Jędrzejewski-Szmek [Fri, 12 Jan 2018 13:31:49 +0000 (14:31 +0100)] 
journalctl: make matching optionally case sensitive

Case sensitive or case insensitive matching can be requested using
--case-sensitive[=yes|no].

Unless specified, matching is case sensitive if the pattern contains any
uppercase letters, and case insensitive otherwise. This matches what
forward-search does in emacs, and recently also --ignore-case in less.  This
works surprisingly well, because usually when one is wants to do case-sensitive
matching, the pattern is usually camel-cased. In the less frequent case when
case-sensitive matching is required with an all-lowercase pattern,
--case-sensitive can be used to override the automatic logic.

6 years agoSlightly improve performance of startable/restartable unit completion (#7839)
dana [Sun, 28 Jan 2018 12:29:58 +0000 (06:29 -0600)] 
Slightly improve performance of startable/restartable unit completion (#7839)

6 years agoNEWS: update NEWS again, we didn't release yesterday (#8027)
Lennart Poettering [Sun, 28 Jan 2018 12:28:58 +0000 (13:28 +0100)] 
NEWS: update NEWS again, we didn't release yesterday (#8027)

Fix tons of whitespace issues, also add a sysusers.d/ change and update
to contributors list again

6 years agoMerge pull request #8025 from sourcejedi/pid1_journal_or2
Lennart Poettering [Sun, 28 Jan 2018 10:02:24 +0000 (11:02 +0100)] 
Merge pull request #8025 from sourcejedi/pid1_journal_or2

 pid1: when we can't log to journal, remember our fallback log target

6 years agohwdb: Fix bouncing brightness keys on MSI-PR200
Martin Pitt [Sat, 27 Jan 2018 08:35:19 +0000 (09:35 +0100)] 
hwdb: Fix bouncing brightness keys on MSI-PR200

Thanks to djfd for the patch!

Fixes #6972

6 years agoMerge pull request #8026 from phomes/NEWS-fix
Michael Biebl [Sat, 27 Jan 2018 23:08:16 +0000 (00:08 +0100)] 
Merge pull request #8026 from phomes/NEWS-fix

NEWS: typo fix

6 years agoNEWS: typo fix 8026/head
Thomas Hindoe Paaboel Andersen [Sat, 27 Jan 2018 23:05:27 +0000 (00:05 +0100)] 
NEWS: typo fix

6 years agotest-hashmap: test IteratedCache 7042/head
Vito Caputo [Sat, 27 Jan 2018 21:10:39 +0000 (13:10 -0800)] 
test-hashmap: test IteratedCache

Add some rudimentary testing of the new IteratedCache

6 years agojournal: use IteratedCache in sd-journal
Vito Caputo [Sun, 8 Oct 2017 23:52:56 +0000 (16:52 -0700)] 
journal: use IteratedCache in sd-journal

This changes real_journal_next() to leverage the IteratedCache for
accelerating iteration across the open journal files.

journalctl timing comparisons with 100 journal files of 8MiB size
party to this boot:

Pre (~v235):
  # time ./journalctl -b --no-pager > /dev/null
  real    0m9.613s
  user    0m9.560s
  sys     0m0.053s

  # time ./journalctl -b --no-pager > /dev/null
  real    0m9.548s
  user    0m9.525s
  sys     0m0.023s

  # time ./journalctl -b --no-pager > /dev/null
  real    0m9.612s
  user    0m9.582s
  sys     0m0.030s

Post-IteratedCache:

  # time ./journalctl -b --no-pager > /dev/null
  real    0m8.449s
  user    0m8.425s
  sys     0m0.024s

  # time ./journalctl -b --no-pager > /dev/null
  real    0m8.409s
  user    0m8.382s
  sys     0m0.027s

  # time ./journalctl -b --no-pager > /dev/null
  real    0m8.410s
  user    0m8.350s
  sys     0m0.061s

~12.5% improvement, the benefit increases the more log files there are.

6 years agobasic: implement the IteratedCache
Vito Caputo [Sat, 27 Jan 2018 00:38:01 +0000 (16:38 -0800)] 
basic: implement the IteratedCache

Adds the basics of the IteratedCache and constructor support for the
Hashmap and OrderedHashmap types.

iterated_cache_get() is responsible for synchronizing the cache with
the associated Hashmap and making it available to the caller at the
supplied result pointers.  Since iterated_cache_get() may need to
allocate memory, it may fail, so callers must check the return value.

On success, pointer arrays containing pointers to the associated
Hashmap's keys and values, in as-iterated order, are returned in
res_keys and res_values, respectively.  Either may be supplied as NULL
to inhibit caching of the keys or values, respectively.

Note that if the cached Hashmap hasn't changed since the previous call
to iterated_cache_get(), and it's not a call activating caching of the
values or keys, the cost is effectively zero as the resulting pointers
will simply refer to the previously returned arrays as-is.

A cleanup function has also been added, iterated_cache_free().

This only frees the IteratedCache container and related arrays.  The
associated Hashmap, its keys, and values are not affected.  Also note
that the associated Hashmap does not automatically free its associated
IteratedCache when freed.

One could, in theory, safely access the arrays returned by a
successful iterated_cache_get() call after its associated Hashmap has
been freed, including the referenced values and keys.  Provided the
iterated_cache_get() was performed prior to the hashmap free, and that
the type of hashmap free performed didn't free keys and/or values as
well.

6 years agosystemd-shutdown: use log_set_prohibit_ipc(true) 8025/head
Alan Jenkins [Sat, 27 Jan 2018 18:02:06 +0000 (18:02 +0000)] 
systemd-shutdown: use log_set_prohibit_ipc(true)

Now we have log_set_prohibit_ipc(), let's use it to clarify that
systemd-shutdown is not expected to try and log via journald (which it is
about to kill).  We avoided ever asking systemd-shutdown to do this, but
it's more convenient for the reader if they don't have to think about that.
In that sense, it's similar to using assert() to validate a function's
arguments.

6 years agorationalize interface for opening/closing logging
Alan Jenkins [Fri, 26 Jan 2018 13:42:53 +0000 (13:42 +0000)] 
rationalize interface for opening/closing logging

log_open_console() did not switch from stderr to /dev/console, when
"always_reopen_console" was set.  It was necessary to call
log_close_console() first.

By contrast, log_open() did switch between e.g. journald and kmsg according
to the value of "prohibit_ipc".

Let's fix log_open() to respect the values of all the log options, and we
can make log_close_*() private.

Also log_close_console() is changed.  There was some precaution, avoiding
closing the console fd if we are not PID 1.  I think commit 48a601fe made
a little mistake in leaving this in, and it only served to confuse
readers :).

Also I changed systemd-shutdown. Now we have log_set_prohibit_ipc(), let's
use it to clarify that systemd-shutdown is not expected to try and log via
journald (which it is about to kill).  We avoided ever asking it to, but
it's more convenient for the reader if they don't have to think about that.
In that sense, it's similar to using assert() to validate a function's
arguments.

6 years agoUpdate NEWS to reflect changes made in #8020 (#8024)
bleep_blop [Sat, 27 Jan 2018 16:33:52 +0000 (22:03 +0530)] 
Update NEWS to reflect changes made in #8020 (#8024)

6 years ago[gdb-sd_dump_hashmaps.py] String Formatting Update (#7819)
Batuhan Osman Taşkaya [Sat, 27 Jan 2018 13:03:08 +0000 (16:03 +0300)] 
[gdb-sd_dump_hashmaps.py] String Formatting Update (#7819)

Changes: % changed as .format()

6 years agoNEWS: get ready for release today (#8019)
Lennart Poettering [Sat, 27 Jan 2018 12:52:09 +0000 (13:52 +0100)] 
NEWS: get ready for release today (#8019)

6 years agoanalyze: merge {get,set}-log-{level,target} to log-{level,target} (#8020)
Yu Watanabe [Sat, 27 Jan 2018 12:51:32 +0000 (21:51 +0900)] 
analyze: merge {get,set}-log-{level,target} to log-{level,target} (#8020)

Also, service-watchdogs now shows current watchdog state when
no optional argument is provided.

6 years agojournalctl: regexp matching
Zbigniew Jędrzejewski-Szmek [Fri, 12 Jan 2018 06:55:45 +0000 (07:55 +0100)] 
journalctl: regexp matching

6 years agoMerge pull request #7933 from keszybz/fuzz-regression
Evgeny Vereshchagin [Sat, 27 Jan 2018 09:56:42 +0000 (12:56 +0300)] 
Merge pull request #7933 from keszybz/fuzz-regression

test: add fuzzer regression testing

6 years agologin/meson.build: require ACL for uaccess rules
Andrew Jeddeloh [Thu, 25 Jan 2018 21:17:17 +0000 (13:17 -0800)] 
login/meson.build: require ACL for uaccess rules

Don't install udev rules that requires the uaccess builtin if systemd is
being built without the uaccess builtin.

6 years agojournal: losen restrictions on journal file suffix (#8013)
Lennart Poettering [Sat, 27 Jan 2018 08:32:36 +0000 (09:32 +0100)] 
journal: losen restrictions on journal file suffix (#8013)

Previously, we'd refuse open journal files with suffixes that aren't
either .journal or .journal~. With this change we only care when we are
creating the journal file.

I looked over the sources to see whether we ever pass files discovered
by directory enumeration to journal_file_open() without first checking
the suffix (in which case the old check made sense), but I couldn't find
any. hence I am pretty sure removing this check is safe.

Fixes: #7972
6 years agoMerge pull request #8006 from zx2c4-forks/jd/no-wg-ll
Yu Watanabe [Sat, 27 Jan 2018 08:31:02 +0000 (17:31 +0900)] 
Merge pull request #8006 from zx2c4-forks/jd/no-wg-ll

networkd: assume no link local addresses for where it isn't used

6 years agoMerge pull request #7973 from mvo5/sysusers-uid-gid
Yu Watanabe [Sat, 27 Jan 2018 08:24:39 +0000 (17:24 +0900)] 
Merge pull request #7973 from mvo5/sysusers-uid-gid

sysusers: allow uid:gid in sysusers.conf files

6 years agomeson: use env object instead of string in tags targets 7933/head
Zbigniew Jędrzejewski-Szmek [Fri, 26 Jan 2018 15:15:17 +0000 (16:15 +0100)] 
meson: use env object instead of string in tags targets

I used 'tags' before because this way we avoided a unnecessary
line about 'env' detection. But we cannot use 'env' in test(), so
previous commit added 'env' detection. We might just as well use
it in custom_target().

6 years agoHook up oss-fuzz test cases as tests
Zbigniew Jędrzejewski-Szmek [Fri, 19 Jan 2018 06:54:30 +0000 (17:54 +1100)] 
Hook up oss-fuzz test cases as tests

This is a bit painful because a separate build of systemd is necessary. The
tests are guarded by tests!=false and slow-tests==true. Running them is not
slow, but compilation certainly is. If this proves unwieldy, we can add a
separate option controlling those builds later.

The build for each sanitizer has its own directory, and we build all fuzzer
tests there, and then pull them out one-by-one by linking into the target
position as necessary. It would be nicer to just build the desired fuzzer, but
we need to build the whole nested build as one unit.

[I also tried making systemd and nested meson subproject. This would work
nicely, but meson does not allow that because the nested target names are the
same as the outer project names. If that is ever fixed, that would be the way
to go.]

v2:
- make sure things still work if memory sanitizer is not available
v3:
- switch to syntax which works with meson 0.42.1 found in Ubuntu

6 years agobasic: track dirty state in HashmapBase
Vito Caputo [Sun, 8 Oct 2017 23:28:04 +0000 (16:28 -0700)] 
basic: track dirty state in HashmapBase

This only adds marking the HashmapBase as dirty, no clearing of
the dirty state happens yet.

No functional changes.

6 years agopid1: when we can't log to journal, remember our fallback log target
Alan Jenkins [Fri, 26 Jan 2018 22:47:16 +0000 (22:47 +0000)] 
pid1: when we can't log to journal, remember our fallback log target

If we have to force the logging to close the journal fd, then we can open
any fallback log target.  E.g. kmsg, if the target was the default
JOURNAL_OR_KMSG.

This is the behaviour I would expect from the documentation.  I couldn't
find any justification in the code, for why we would want to start dropping
log messages instead of sending them to the fallback target.

This means we will match the behaviour of processes which we fork and which
set `open_when_needed`, and with generators - which use
log_set_prohibit_ipc(true) - which we fork+exec during a reload.

IMO this illustrates that the log_open/log_close interface is too clunky.
So with the behaviour settled, I will refactor the interface in the next
commit :).

6 years agoNEWS: add self to news file for this late commit 8006/head
Jason A. Donenfeld [Thu, 25 Jan 2018 20:16:38 +0000 (21:16 +0100)] 
NEWS: add self to news file for this late commit

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agonetworkd: assume no link local addresses for where it isn't used
Jason A. Donenfeld [Fri, 26 Jan 2018 14:34:09 +0000 (15:34 +0100)] 
networkd: assume no link local addresses for where it isn't used

It turns out that link local doesn't make much sense in its context.
Since link local is disabled by the kernel driver, it's important that
networkd assumes it's off too, so that the link can reach the
"configured" stage, without waiting indefinitely for link local
addresses which will never come.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
6 years agozsh: add service-watchdogs
Zbigniew Jędrzejewski-Szmek [Wed, 24 Jan 2018 04:43:41 +0000 (07:43 +0300)] 
zsh: add service-watchdogs

A zsh counterpart to 21a6abdf0ea9ce1fa5b6edf3b9314347cc0dbca1.

6 years agoNews: some fixes and improvements (#8010)
Clinton Roy [Fri, 26 Jan 2018 10:44:11 +0000 (21:44 +1100)] 
News: some fixes and improvements (#8010)

* missing whitespace.

* NEWS: some small fixes and improvements.

6 years agoMerge pull request #7738 from yuwata/fix-7721
Yu Watanabe [Fri, 26 Jan 2018 04:03:25 +0000 (13:03 +0900)] 
Merge pull request #7738 from yuwata/fix-7721

core: manager logs firmware and loader time when startup finished

6 years agol10n: update Czech Translation (#8007)
AsciiWolf [Fri, 26 Jan 2018 03:51:21 +0000 (04:51 +0100)] 
l10n: update Czech Translation (#8007)

Fix typo

6 years agoMerge pull request #7997 from poettering/systemctl-is-active-fix
Zbigniew Jędrzejewski-Szmek [Thu, 25 Jan 2018 22:48:34 +0000 (01:48 +0300)] 
Merge pull request #7997 from poettering/systemctl-is-active-fix

systemctl is-active fix

6 years agosysusers: ensure GID in uid:gid syntax exists 7973/head
Michael Vogt [Thu, 25 Jan 2018 11:50:14 +0000 (12:50 +0100)] 
sysusers: ensure GID in uid:gid syntax exists

Ensure that the GID already exists or is created when the new
"uid:gid" syntax is used. This ensures the behaviour is always
predictable.

6 years agocore: initalize buffer 7738/head
Zbigniew Jędrzejewski-Szmek [Sat, 20 Jan 2018 00:06:34 +0000 (11:06 +1100)] 
core: initalize buffer

6 years agocore: manager logs firmware and loader time when startup finished
Yu Watanabe [Mon, 25 Dec 2017 04:08:23 +0000 (13:08 +0900)] 
core: manager logs firmware and loader time when startup finished

6 years agoMerge pull request #7996 from poettering/v237-prepare
Zbigniew Jędrzejewski-Szmek [Thu, 25 Jan 2018 14:41:25 +0000 (17:41 +0300)] 
Merge pull request #7996 from poettering/v237-prepare

preparation for v237

6 years agofirstboot: Include <crypt.h> for declaration of crypt() if needed (#7944)
Björn Esser [Thu, 25 Jan 2018 14:30:15 +0000 (15:30 +0100)] 
firstboot: Include <crypt.h> for declaration of crypt() if needed (#7944)

Not every target system may provide a crypt() function in its stdlibc
and may use an external or replacement library, like libxcrypt, for
providing such functions.

See https://fedoraproject.org/wiki/Changes/Replace_glibc_libcrypt_with_libxcrypt.

6 years agoRevert "man: mention that systemctl is-active or is-failed do not load units" 7997/head
Lennart Poettering [Thu, 25 Jan 2018 14:18:27 +0000 (15:18 +0100)] 
Revert "man: mention that systemctl is-active or is-failed do not load units"

This reverts commit c7612b20052d9151f60a96623b8743cbac88390d.

6 years agosystemctl: load unit if needed in "systemctl is-active"
Lennart Poettering [Thu, 25 Jan 2018 14:14:25 +0000 (15:14 +0100)] 
systemctl: load unit if needed in "systemctl is-active"

Previously, we'd explicitly use "GetUnit()" on the server side to
convert a unit name into a bus path, as that function will return an
error if the unit is not currently loaded. If we'd convert the path on
the client side, and access the unit this way directly the unit would be
loaded automatically in the background.

The old logic was done in order to minimize the effect of "is-active" on
the system, i.e. that a monoitoring command does not itself alter the
state of the system.

however, this is problematic as this can lead to confusing results if
the queried unit name is an alias that currently is not loaded: we'd
claim the unit wasn't active even though this isn't strictly true: the
unit the name is an alias for might be.

Hence, let's simplify the code, and accept that we might end up loading
a unit briefly here, and let's make "systemctl is-active" skip the
GetUnit() thing and calculate the unit path right away.

Fixes: #7875
6 years agoboot/efi: TPM V2 fix for GetEventLog EFI function
Raphael Vogelgsang [Tue, 23 Jan 2018 17:58:21 +0000 (18:58 +0100)] 
boot/efi: TPM V2 fix for GetEventLog EFI function

6 years agobus-util: fix format of NextElapseUSecRealtime= and LastTriggerUSec=
Yu Watanabe [Thu, 25 Jan 2018 08:45:53 +0000 (17:45 +0900)] 
bus-util: fix format of NextElapseUSecRealtime= and LastTriggerUSec=

Before this, `systemctl show` for calendar type timer unit outputs
something like below.
```
NextElapseUSecRealtime=48y 3w 3d 15h
NextElapseUSecMonotonic=0
LastTriggerUSec=48y 3w 3d 3h 41min 44.093095s
LastTriggerUSecMonotonic=0
```
As both NextElapseUSecRealtime= and LastTriggerUSec= are not timespan
but timestamp, this makes format these values by `format_timestamp()`.

6 years agogpt-auto: discard boot0/1 hw partitions along rpmb
Nicolas Chauvet [Wed, 24 Jan 2018 09:05:28 +0000 (10:05 +0100)] 
gpt-auto: discard boot0/1 hw partitions along rpmb

/dev/mmcblk0boot0 is a partition found in eMMC
This is not relevant for mounting

This complement the previous fix as reported in
https://github.com/systemd/systemd/issues/5806

Signed-off-by: Nicolas Chauvet <kwizart@gmail.com>
6 years agomeson: bump so revision and systemd version in preparation for v237 7996/head
Lennart Poettering [Thu, 25 Jan 2018 13:18:14 +0000 (14:18 +0100)] 
meson: bump so revision and systemd version in preparation for v237

6 years agohwdb: run "update-hwdb" in preparation for v237
Lennart Poettering [Thu, 25 Jan 2018 13:16:25 +0000 (14:16 +0100)] 
hwdb: run "update-hwdb" in preparation for v237

6 years agoupdate TODO
Lennart Poettering [Thu, 25 Jan 2018 13:14:35 +0000 (14:14 +0100)] 
update TODO

6 years agoNEWS: start putting together an entry for v237
Lennart Poettering [Thu, 25 Jan 2018 12:18:28 +0000 (13:18 +0100)] 
NEWS: start putting together an entry for v237

6 years agosysusers: make ADD_GROUP always create a group
Michael Vogt [Wed, 24 Jan 2018 10:46:10 +0000 (11:46 +0100)] 
sysusers: make ADD_GROUP always create a group

Do not merge group creation with user creation because with the
new uid:gid syntax this can result in confusing (and unwanted)
behavior.

6 years agotest: add TEST-21-SYSUSERS test
Michael Vogt [Wed, 24 Jan 2018 10:18:46 +0000 (11:18 +0100)] 
test: add TEST-21-SYSUSERS test

This test tests the systemd-sysuser binary via the --root=$TESTDIR
option and ensures that for the given inputs the expected passwd
and group files will be generated.

6 years agosysuser: use OrderedHashmap
Michael Vogt [Wed, 24 Jan 2018 08:26:51 +0000 (09:26 +0100)] 
sysuser: use OrderedHashmap

This means we have more predicable behavior for "u foo uid:gid" lines
and also makes the generated files appear in the same order as the
inputs. So e.g.
```
u      root         0 -     /root
u      daemon       1 -     /usr/sbin
u      games        5:60 -     /usr/games
```
will generate
```
root:x:0:0::/root:/bin/sh
daemon:x:1:1::/usr/sbin:/sbin/nologin
games:x:5:60::/usr/games:/sbin/nologin
```