]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
5 years agonetwork: set DynamicUser= to systemd-networkd.service 9040/head
Yu Watanabe [Tue, 22 May 2018 13:37:34 +0000 (22:37 +0900)] 
network: set DynamicUser= to systemd-networkd.service

5 years agoresolve: enable DynamicUser= for systemd-resolved.service
Yu Watanabe [Sat, 19 May 2018 16:18:21 +0000 (01:18 +0900)] 
resolve: enable DynamicUser= for systemd-resolved.service

5 years agocore: chown RuntimeDirectory= if DynamicUser= is set
Yu Watanabe [Tue, 22 May 2018 13:26:22 +0000 (22:26 +0900)] 
core: chown RuntimeDirectory= if DynamicUser= is set

When DynamicUser= is set, then RuntimeDirectory= should be always
chowned, as the service unit may enable RuntimeDirectoryPreserve=,
and the uid or gid may changed from the last run.
This also makes easier to migrate the service to use DynamicUser=.

5 years agotimesync,shared: move logic requesting bus name to shared
Yu Watanabe [Sat, 19 May 2018 16:55:39 +0000 (01:55 +0900)] 
timesync,shared: move logic requesting bus name to shared

Preparation for setting DynamicUser= to other services which
request bus names.

5 years agounit: drop After=systemd-sysusers.service from timesyncd
Yu Watanabe [Sat, 19 May 2018 16:09:57 +0000 (01:09 +0900)] 
unit: drop After=systemd-sysusers.service from timesyncd

After=systemd-sysusers.service is not necessary, as timesyncd
already enables DynamicUser=.

5 years agonspawn: support pivot-root option during directory validation
Arnaud Rebillout [Mon, 21 May 2018 04:10:21 +0000 (11:10 +0700)] 
nspawn: support pivot-root option during directory validation

Signed-off-by: Arnaud Rebillout <arnaud.rebillout@collabora.com>
5 years agoMerge pull request #9059 from keszybz/rm-rf-generators
Lennart Poettering [Tue, 22 May 2018 12:30:03 +0000 (14:30 +0200)] 
Merge pull request #9059 from keszybz/rm-rf-generators

Allow removing generators dirs on real fs

5 years agoMerge pull request #9061 from poettering/dump-string-table
Lennart Poettering [Tue, 22 May 2018 12:28:38 +0000 (14:28 +0200)] 
Merge pull request #9061 from poettering/dump-string-table

add new DUMP_STRING_TABLE() macro and make use of it everywhere

5 years agoMerge pull request #9058 from keszybz/fun-with-uint64_c
Lennart Poettering [Tue, 22 May 2018 11:23:56 +0000 (13:23 +0200)] 
Merge pull request #9058 from keszybz/fun-with-uint64_c

Fun with UINT64_C

5 years agodetect-virt: add new --list command for showing all currently known VM/container... 9061/head
Lennart Poettering [Tue, 22 May 2018 10:12:44 +0000 (12:12 +0200)] 
detect-virt: add new --list command for showing all currently known VM/container envs

5 years agotree-wide: port various bits of the tree over to the new DUMP_STRING_TABLE() macro
Lennart Poettering [Tue, 22 May 2018 10:10:56 +0000 (12:10 +0200)] 
tree-wide: port various bits of the tree over to the new DUMP_STRING_TABLE() macro

5 years agovolatile-mode: use the usual string table macros for implementing volatile_mode_from_...
Lennart Poettering [Tue, 22 May 2018 10:09:59 +0000 (12:09 +0200)] 
volatile-mode: use the usual string table macros for implementing volatile_mode_from_string()

Let's shorten our code a bit, and also add the matching _to_string()
call.

5 years agocoredumpctl: always output proper english sentence
Lennart Poettering [Tue, 22 May 2018 10:08:30 +0000 (12:08 +0200)] 
coredumpctl: always output proper english sentence

Let's uppercase the first character, and finish them in a full stop.

5 years agostring-table: add new DUMP_STRING_TABLE() macro
Lennart Poettering [Tue, 22 May 2018 10:06:54 +0000 (12:06 +0200)] 
string-table: add new DUMP_STRING_TABLE() macro

The macro is inspired by the other string table macros, and takes the
same arguments in the same order and dumps a string table to stdout.
Since it's typesafe it's nice to implement this as macro rather than
regular function.

This new macro is useful for implementing commands such as "systemctl -t
help" and similar, i.e. wherever we want to dump all values of an enum
to stdout.

5 years agoGenerator dirs might be on a real filesystem 9059/head
Zbigniew Jędrzejewski-Szmek [Tue, 22 May 2018 09:56:31 +0000 (11:56 +0200)] 
Generator dirs might be on a real filesystem

Most of the time, tmpfs is used for /tmp, but this is not required.
Applied to both pid1 and systemd-analyze verify.

Fixes #8592.

5 years agobasic/rm-rf: include the path in error messages
Zbigniew Jędrzejewski-Szmek [Tue, 22 May 2018 09:33:01 +0000 (11:33 +0200)] 
basic/rm-rf: include the path in error messages

Attempted to remove disk file system under "/tmp/systemd-temporary-aWPkbQ", and we can't allow that.

5 years agosystemd-nspawn: make SettingsMask 64 bit wide 9058/head
Zbigniew Jędrzejewski-Szmek [Tue, 22 May 2018 07:13:31 +0000 (09:13 +0200)] 
systemd-nspawn: make SettingsMask 64 bit wide

The use of UINT64_C() in the SettingsMask enum definition is misleading:
it does not mean that individual fields have this width. E.g., with
enum {
   FOO = UINT64_C(1)
}
sizeof(FOO) gives 4. It only means that the shift is done properly. So
1 << 35 is undefined, but UINT64_C(1) << 35 is the expected 64 bit
constant. Thus, the use UINT64_C() is useful, because we know that the shifts
are done properly, no matter what the value of _RLIMIT_MAX is, but when those
fields are used in expressions, we don't know what size they will be
(probably 4). Let's add a define which "hides" the enum definition behind a
define which gives the same value but is actually 64 bit. I think this is a
nicer solution than requiring all users to cast SETTING_RLIMIT_FIRST before
use.

Fixes #9035.

5 years agosd-resolve: remove misleading casts
Zbigniew Jędrzejewski-Szmek [Tue, 22 May 2018 07:36:08 +0000 (09:36 +0200)] 
sd-resolve: remove misleading casts

As shown in previous commit, UINT64_C() has no effect here, the field can still
be smaller. Remove it.

5 years agotest-sizeof: show that a small 64 field is not enough to force the enum to be 64...
Zbigniew Jędrzejewski-Szmek [Tue, 22 May 2018 07:07:35 +0000 (09:07 +0200)] 
test-sizeof: show that a small 64 field is not enough to force the enum to be 64 bits

On both 32 and 64 bits, the result is:
enum Enum → 32 bits, unsigned
enum BigEnum → 32 bits, unsigned
enum BigEnum2 → 64 bits, unsigned
big_enum2_pos → 4
big_enum2_neg → 8

The last two lines show that even if the enum is 64 bit, and the field of an
enum is defined with UINT64_C(), the field can still be smaller.

5 years agoman: fix typo in man page citation
Zbigniew Jędrzejewski-Szmek [Sun, 20 May 2018 20:42:23 +0000 (22:42 +0200)] 
man: fix typo in man page citation

Fixes #9045.

5 years agocore/job: shortening
Zbigniew Jędrzejewski-Szmek [Sat, 19 May 2018 09:39:57 +0000 (11:39 +0200)] 
core/job: shortening

Follow-up for a7a7163df7fc8a9f794f6803b2f6c9c9b0745a1f.

5 years agoMerge pull request #9036 from keszybz/rpm-macro-cleanup
Yu Watanabe [Sun, 20 May 2018 14:20:24 +0000 (23:20 +0900)] 
Merge pull request #9036 from keszybz/rpm-macro-cleanup

rpm macro cleanup

5 years agorpm: add macros for common configuration dirs 9036/head
Zbigniew Jędrzejewski-Szmek [Sat, 19 May 2018 15:02:37 +0000 (17:02 +0200)] 
rpm: add macros for common configuration dirs

%_environmnentdir /usr/lib/environment.d
%_modulesloaddir /usr/lib/modules-load.d
%_modprobedir /usr/lib/modprobe.d

This makes installing files there more convenient because people don't need to
construct the path from %_prefix/lib/… .

See https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/GBF5WJLTQVSXMHGYGBF3723ZYCWFBR7C/.

5 years agofs-util: don't alter errno in unlink_tempfilep()
Lennart Poettering [Fri, 18 May 2018 18:14:54 +0000 (20:14 +0200)] 
fs-util: don't alter errno in unlink_tempfilep()

Functions whose only purpose is to be used with _cleanup_() should not
touch errno, so that failing removals do not alter errno at unexpected
places.

This is already done in unlink_and_freep(), rmdir_and_freep(),
rm_rf_physical_and_freep(), hence do so for unlink_tempfilep(), too.

Follow-up for #9013

5 years agomeson: use run_target for generating tags with ctags
Evegeny Vereshchagin [Fri, 18 May 2018 10:52:17 +0000 (10:52 +0000)] 
meson: use run_target for generating tags with ctags

In https://github.com/systemd/systemd/pull/6561, `run_target`
was changed to `custom_target`, which inadvertently caused
relative paths to be passed to ctags due to
https://github.com/mesonbuild/meson/issues/3589.
The switch to `run_target` causes absolute paths to be
passed again and makes it easier to jump from file to
file, hopefully delaying the need to exit Vim :-)

5 years agosd-resolve: tweak error assignment code a bit, use abs() and regular functions
Lennart Poettering [Fri, 18 May 2018 18:35:01 +0000 (20:35 +0200)] 
sd-resolve: tweak error assignment code a bit, use abs() and regular functions

Let's tweak the assignment of errors a bit, and automatically abs()
errnos, similar to how log_error_errno() and friends does it.

Macros are fine to use, but regular functions usually preferable if
there's no reason to use macros, because they avoid multiple evaluation
and suchlike. Hence, let's just use a regular funciton for assigning
errors, instead of macros.

Follow-up for #8993

5 years agorpm: simplify redirects to /dev/null
Zbigniew Jędrzejewski-Szmek [Sat, 19 May 2018 11:04:21 +0000 (13:04 +0200)] 
rpm: simplify redirects to /dev/null

5 years agorpm: remove confusing --user before --global
Zbigniew Jędrzejewski-Szmek [Sat, 19 May 2018 11:01:55 +0000 (13:01 +0200)] 
rpm: remove confusing --user before --global

Fixes #9027.

5 years agofix race between daemon-reload and other commands
David Tardon [Tue, 24 Apr 2018 13:19:38 +0000 (15:19 +0200)] 
fix race between daemon-reload and other commands

When "systemctl daemon-reload" is run at the same time as "systemctl
start foo", the latter might hang. That's because commands like start
wait for JobRemoved signal to know when the job is finished. But if the
job is finished during reloading, the signal is never sent.

The hang can be easily reproduced by running

    # for ((N=1; N>0; N++)) ; do echo $N ; systemctl daemon-reload ; done
    # for ((N=1; N>0; N++)) ; do echo $N ; systemctl start systemd-coredump.socket ; done

in two different terminals. The start command will hang after 1-2
iterations.

This keeps track of jobs that were started before reload and finished
during it and sends JobRemoved after the reload has finished.

5 years agoman: fix typo
Lucas Werkmeister [Fri, 18 May 2018 20:04:35 +0000 (22:04 +0200)] 
man: fix typo

5 years agoMerge pull request #8981 from keszybz/ratelimit-and-dbus
Lennart Poettering [Fri, 18 May 2018 19:38:30 +0000 (21:38 +0200)] 
Merge pull request #8981 from keszybz/ratelimit-and-dbus

Ratelimit renaming and dbus error message fix

5 years agocore: keep the kernel coredump defaults when systemd-coredump is disabled
Franck Bui [Fri, 18 May 2018 16:37:56 +0000 (18:37 +0200)] 
core: keep the kernel coredump defaults when systemd-coredump is disabled

If systemd-coredump is disabled (at build time), PID1 should keep the
(old) kernel defaults as they are.

5 years agolocalectl: drop duplicate property entry
David Tardon [Fri, 18 May 2018 14:52:01 +0000 (16:52 +0200)] 
localectl: drop duplicate property entry

5 years agoMerge pull request #8993 from keszybz/sd-resolve-coverity-and-related-fixes
Lennart Poettering [Fri, 18 May 2018 18:30:12 +0000 (20:30 +0200)] 
Merge pull request #8993 from keszybz/sd-resolve-coverity-and-related-fixes

sd-resolve coverity and related fixes

5 years agoMerge pull request #8985 from yuwata/bus-macro-3
Lennart Poettering [Fri, 18 May 2018 18:25:52 +0000 (20:25 +0200)] 
Merge pull request #8985 from yuwata/bus-macro-3

tree-wide: use BUS_DEFINE_PROPERTY_GET* macros

5 years agofs-util,test: add helper to remove tempfiles
Zbigniew Jędrzejewski-Szmek [Wed, 16 May 2018 09:35:41 +0000 (11:35 +0200)] 
fs-util,test: add helper to remove tempfiles

This simplifies the use of tempfiles in tests and fixes "leaked"
temporary files in test-fileio, test-catalog, test-conf-parser.

Not the whole tree is converted.

5 years agoMerge pull request #9026 from yuwata/followup-9021
Lennart Poettering [Fri, 18 May 2018 18:02:43 +0000 (20:02 +0200)] 
Merge pull request #9026 from yuwata/followup-9021

core: refuse StateDirectory=private

5 years agocore: use free_and_replace() 9026/head
Yu Watanabe [Fri, 18 May 2018 08:35:23 +0000 (17:35 +0900)] 
core: use free_and_replace()

5 years agocore: fix coding style
Yu Watanabe [Fri, 18 May 2018 08:34:59 +0000 (17:34 +0900)] 
core: fix coding style

5 years agoMerge pull request #8940 from poettering/nspawn-attrs
Zbigniew Jędrzejewski-Szmek [Fri, 18 May 2018 08:33:10 +0000 (10:33 +0200)] 
Merge pull request #8940 from poettering/nspawn-attrs

nspawn: make a couple of additional container parameters configurable

5 years agotmpfiles: fix up and complain paths referring to /var/run (instead of /run) automatically
Lennart Poettering [Thu, 17 May 2018 02:15:46 +0000 (22:15 -0400)] 
tmpfiles: fix up and complain paths referring to /var/run (instead of /run) automatically

tmpfiles.d relies on merging lines for the same file paths, as well as
detecting conflicts between lines for the same file paths. /var/run is a
prominent case that is an alias for /run, any many tmpfiles snippets
refer to paths in /var/run rather than /run currently, which breaks the
conflict detection and merging.

We can't really fix this comprehensively, as doing so would require us
to resolve symlinks early on, but that's precisely not what we want to
do, as tmpfiles is usually run very early on where the paths might not
be fully available yet (in particular as we might likely create them
ourselves).

Hence, let's at least detect and fix this case for the most prominent
case of this ambiguity, and also log explicitly about this, asking users
to fix the snippets in question so that the merging and conflict
detection works properly again.

5 years agoinhibit: use pager for systemd-inhibit --list
David Tardon [Thu, 17 May 2018 13:45:37 +0000 (15:45 +0200)] 
inhibit: use pager for systemd-inhibit --list

5 years agocore: refuse StateDirectory=private
Yu Watanabe [Fri, 18 May 2018 04:29:26 +0000 (13:29 +0900)] 
core: refuse StateDirectory=private

Follow-up for e8865688735ba3bd34297fa89cca6bde7ba33997 (#9021).

5 years agotmpfiles: create /var/{lib,log,cache}/private during early boot
Lennart Poettering [Thu, 17 May 2018 17:52:37 +0000 (19:52 +0200)] 
tmpfiles: create /var/{lib,log,cache}/private during early boot

This directory is used by the DynamicUer= stuff when used in combination
with StateDirectory=/LogDirectory=/CacheDirectory=. Let's make sure the
dir exists early on with the right perms. This is not strictly necessary
as we'll also create the dir on demand if it is missing, but in the
interest of grabbing the name early on, and making things more explicit
let's also list this in a tmpfiles.d/ snippet.

5 years agocore: refuse StateDirectory=private, as our internal DynamicUser=1 symlink is called...
Lennart Poettering [Thu, 17 May 2018 02:25:12 +0000 (22:25 -0400)] 
core: refuse StateDirectory=private, as our internal DynamicUser=1 symlink is called that way

Let's better be safe than sorry.

5 years agonspawn: voidify more things 8940/head
Lennart Poettering [Tue, 8 May 2018 15:03:58 +0000 (08:03 -0700)] 
nspawn: voidify more things

5 years agopath-util: one more empty_or_root() change
Lennart Poettering [Wed, 25 Apr 2018 09:23:01 +0000 (11:23 +0200)] 
path-util: one more empty_or_root() change

5 years agonspawn: split out merging of settings object
Lennart Poettering [Mon, 7 May 2018 19:57:00 +0000 (21:57 +0200)] 
nspawn: split out merging of settings object

Let's separate the loading of the settings object and the merging into
our arg_xyz fields into two.

This will become particularly useful when we eventually are able to load
settings from OCI runtime files in addition to .nspawn files.

5 years agonspawn: add a new --cpu-affinity= switch
Lennart Poettering [Mon, 7 May 2018 19:47:15 +0000 (21:47 +0200)] 
nspawn: add a new --cpu-affinity= switch

Similar as the other options added before, this is primarily useful to
provide comprehensive OCI runtime compatbility, but might be useful
otherwise, too.

5 years agonspawn: show --help text in a pager
Lennart Poettering [Mon, 7 May 2018 19:18:25 +0000 (21:18 +0200)] 
nspawn: show --help text in a pager

The text is long enough now, and we do auto-paging for systemctl
already, hence let's do it here too.

5 years agonspawn: add a new --oom-score-adjust= command line switch
Lennart Poettering [Mon, 7 May 2018 19:17:09 +0000 (21:17 +0200)] 
nspawn: add a new --oom-score-adjust= command line switch

This is primarily useful in order to provide comprehensive OCI runtime
compatibility with nspawn, but might have uses outside of it.

5 years agonspawn: properly handle and log about hostname setting errors
Lennart Poettering [Mon, 7 May 2018 18:45:39 +0000 (20:45 +0200)] 
nspawn: properly handle and log about hostname setting errors

5 years agoprocess-util: add new helper call for adjusting the OOM score
Lennart Poettering [Mon, 7 May 2018 18:44:41 +0000 (20:44 +0200)] 
process-util: add new helper call for adjusting the OOM score

And let's make use of it in execute.c

5 years agobasic: split parsing of the OOM score adjust value into its own function in parse...
Lennart Poettering [Mon, 7 May 2018 18:26:38 +0000 (20:26 +0200)] 
basic: split parsing of the OOM score adjust value into its own function in parse-util.c

And port config_parse_exec_oom_score_adjust() over to use it.

While we are at it, let's also fix config_parse_exec_oom_score_adjust()
to accept an empty string for turning off OOM score adjustments set
earlier.

5 years agonspawn: add a new --no-new-privileges= cmdline option to nspawn
Lennart Poettering [Mon, 7 May 2018 17:35:48 +0000 (19:35 +0200)] 
nspawn: add a new --no-new-privileges= cmdline option to nspawn

This simply controls the PR_SET_NO_NEW_PRIVS flag for the container.
This too is primarily relevant to provide OCI runtime compaitiblity, but
might have other uses too, in particular as it nicely complements the
existing --capability= and --drop-capability= flags.

5 years agonspawn: make the hostname of the container explicitly configurable with a new --hostn...
Lennart Poettering [Mon, 7 May 2018 16:37:32 +0000 (18:37 +0200)] 
nspawn: make the hostname of the container explicitly configurable with a new --hostname= switch

Previously, the container's hostname was exclusively initialized from
the machine name configured with --machine=, i.e. the internal name and
the external name used for and by the container was synchronized. This
adds a new option --hostname= that optionally allows the internal name
to deviate from the external name.

This new option is mainly useful to ultimately implement the OCI runtime
spec directly in nspawn, but it might be useful on its own for some
other usecases too.

5 years agoconf-parser: shorten config_parse_string() by using free_and_strdup() and empty_to_null()
Lennart Poettering [Mon, 7 May 2018 16:18:11 +0000 (18:18 +0200)] 
conf-parser: shorten config_parse_string() by using free_and_strdup() and empty_to_null()

5 years agonspawn: add new --rlimit= switch, and always set resource limits explicitly for our...
Lennart Poettering [Mon, 7 May 2018 15:59:18 +0000 (17:59 +0200)] 
nspawn: add new --rlimit= switch, and always set resource limits explicitly for our container payloads

This ensures we set the various resource limits of our container
explicitly on each invocation so that we inherit less from our callers
into the payload.

By default resource limits are now set to the same values Linux
generally passes to the host PID 1, thus minimizing needless differences
between host and container environments.

The limits are now also configurable using a new --rlimit= switch. This
is preparation for teaching nspawn native OCI runtime support as OCI
permits setting resource limits for container payloads, and it hence
probably makes sense if we do too.

5 years agorlimit-util: tweak setrlimit_closest() a bit
Lennart Poettering [Mon, 7 May 2018 15:56:06 +0000 (17:56 +0200)] 
rlimit-util: tweak setrlimit_closest() a bit

POSIX doesn't declare too clearly how RLIM_INFINITY is set. Let's hence
filter it out explicitly early on, just as safety precaution should it
be defined weirdly on some arch, for example negative or below the
maximum value of the rlim_t type.

5 years agobasic: be more careful when closing fds based on RLIMIT_NOFILE
Lennart Poettering [Mon, 7 May 2018 15:54:59 +0000 (17:54 +0200)] 
basic: be more careful when closing fds based on RLIMIT_NOFILE

Let's make sure we properly handle cases where RLIMIT_NOFILE is set to
infinity, zero or values outside of the "int" range.

5 years agoman: document what happens if --kill-signal= is not used in nspawn and --boot neither
Lennart Poettering [Mon, 7 May 2018 15:51:33 +0000 (17:51 +0200)] 
man: document what happens if --kill-signal= is not used in nspawn and --boot neither

5 years agoman: don't claim systemd-analyze was documented as part of the man-pages project
Lennart Poettering [Mon, 7 May 2018 15:50:48 +0000 (17:50 +0200)] 
man: don't claim systemd-analyze was documented as part of the man-pages project

It's our own command, we document it in our own set of man pages.

5 years agorlimit-util: introduce setrlimit_closest_all()
Lennart Poettering [Thu, 3 May 2018 17:13:27 +0000 (19:13 +0200)] 
rlimit-util: introduce setrlimit_closest_all()

This new call applies all configured resource limits in one.

5 years agorlimit-util: add a common destructor call for arrays of struct rlimit
Lennart Poettering [Thu, 3 May 2018 17:05:59 +0000 (19:05 +0200)] 
rlimit-util: add a common destructor call for arrays of struct rlimit

5 years agocore: move config_parse_limit() to the generic conf-parser.[ch]
Lennart Poettering [Thu, 3 May 2018 17:01:21 +0000 (19:01 +0200)] 
core: move config_parse_limit() to the generic conf-parser.[ch]

That way we can use it in nspawn.

Also, while we are at it, let's rename the call config_parse_rlimit(),
i.e. insert the "r", to clarify what kind of limit this is about.

5 years agorlimit-util: rework rlimit_{from|to}_string() to work without "Limit" prefix
Lennart Poettering [Thu, 3 May 2018 16:45:39 +0000 (18:45 +0200)] 
rlimit-util: rework rlimit_{from|to}_string() to work without "Limit" prefix

let's make the call more generic, so that we can also easily use it for
parsing "RLIMIT_xyz" style constants.

5 years agoMerge pull request #9017 from keszybz/man-coredump
Lennart Poettering [Thu, 17 May 2018 17:45:22 +0000 (10:45 -0700)] 
Merge pull request #9017 from keszybz/man-coredump

coredump documention enhancement

5 years agoMerge pull request #9002 from yuwata/fix-timedate
Lennart Poettering [Thu, 17 May 2018 17:38:37 +0000 (10:38 -0700)] 
Merge pull request #9002 from yuwata/fix-timedate

Fixes timedated and cleanups hostnamed

5 years agoMerge pull request #9016 from yuwata/fix-policy
Lennart Poettering [Thu, 17 May 2018 17:07:56 +0000 (10:07 -0700)] 
Merge pull request #9016 from yuwata/fix-policy

polkit policy related fixes

5 years agoTurn VALGRIND variable into a meson configuration switch
Zbigniew Jędrzejewski-Szmek [Sun, 13 May 2018 20:28:24 +0000 (22:28 +0200)] 
Turn VALGRIND variable into a meson configuration switch

Configuration through environment variable is inconvenient with meson, because
they cannot be convieniently changed and/or are not preserved during
reconfiguration (https://github.com/mesonbuild/meson/issues/1503).
This adds -Dvalgrind=true/false, which has the advantage that it can be set
at any time with meson configure -Dvalgrind=... and ninja will rebuild targets
as necessary. Additional minor advantages are better consistency with the
options for hashmap debugging, and typo avoidance with '#if' instead of '#ifdef'.

5 years agoman: fix ProcessSizeMax= description, describe how to disable coredumps 9017/head
Zbigniew Jędrzejewski-Szmek [Thu, 17 May 2018 15:08:31 +0000 (17:08 +0200)] 
man: fix ProcessSizeMax= description, describe how to disable coredumps

What the man page said was different than what the code did.
save_external_coredump() will store the core temporarily for backtrace
generation, and will delete if afterwards if it is too large. So to disable
processing, it's necessary to both set
Storage=none/Storage=journal+JournalSizeMax=0/Storage=external+ExternalSizeMax=0
and ProcessSizeMax=0. This updates the man page to reflect the code.

The man pages are extended to describe that Storage=none + ProcessSizeMax=0 is
the simplest way to disable coredump processing. All the storage and processing
options make this quite complicated, so let's add a copy-and-pasteable example
of how to disable coredump. Doing it through coredump.conf has the advantage
that we still log, and the effect is immediate, unlike masking the sysconf
file.

Fixes #8788.

5 years agotimedatectl: do not wrap polkit policy message 9016/head
Yu Watanabe [Thu, 17 May 2018 14:56:40 +0000 (23:56 +0900)] 
timedatectl: do not wrap polkit policy message

If messages are wrapped, then only the last line is shown in the
dialog, at least polkit gui for Xfce. It may be a bug of polkit or
Xfce. But it is not necessary to wrap the message in the policy
file. So, let's fix them.

5 years agocore: systemd1.manage-unit-files policy implies systemd1.manage-units
Yu Watanabe [Thu, 17 May 2018 14:47:09 +0000 (23:47 +0900)] 
core: systemd1.manage-unit-files policy implies systemd1.manage-units

This makes e.g. `systemctl enable --now` ask password only once.

Follow-up for b07abe63d3abf03df559f7cb2c9863943df22274.

5 years agocoredump: properly treat Storage=none as disabled storage
Zbigniew Jędrzejewski-Szmek [Thu, 17 May 2018 14:59:21 +0000 (16:59 +0200)] 
coredump: properly treat Storage=none as disabled storage

Also don't attempt to create /var/lib/systemd/coredump if storage
limit is set to 0 and coredump processing is disabled.

6 years agocore: systemd1.manage-unit-files policy implies systemd1.reload-daemon
Yu Watanabe [Tue, 15 May 2018 15:48:26 +0000 (00:48 +0900)] 
core: systemd1.manage-unit-files policy implies systemd1.reload-daemon

Closes #5013.

6 years agoMerge pull request #9005 from fsateler/circular-deps
Zbigniew Jędrzejewski-Szmek [Tue, 15 May 2018 19:56:50 +0000 (21:56 +0200)] 
Merge pull request #9005 from fsateler/circular-deps

core: Fix some header dependencies

6 years agocore: undo the dependency inversion between unit.h and all unit types 9005/head
Felipe Sateler [Tue, 15 May 2018 18:17:34 +0000 (14:17 -0400)] 
core: undo the dependency inversion between unit.h and all unit types

6 years agocore: Break circular dependency between unit.h and cgroup.h
Felipe Sateler [Tue, 15 May 2018 18:12:22 +0000 (14:12 -0400)] 
core: Break circular dependency between unit.h and cgroup.h

6 years agoudev: create /dev/disk/by-label symlink for LUKS2 (#8998)
Milan Broz [Tue, 15 May 2018 14:51:07 +0000 (16:51 +0200)] 
udev: create /dev/disk/by-label symlink for LUKS2 (#8998)

LUKS2 header supports to device label and blkid since 2.32 version
already supports this option.

Persistent udev storage rules should create symlink for this label.

For older devices this value is not set so changed rule should be compatible.

6 years agocore/dbus-unit: do not pass whole Unit object 8985/head
Yu Watanabe [Mon, 14 May 2018 03:38:57 +0000 (12:38 +0900)] 
core/dbus-unit: do not pass whole Unit object

6 years agocore/dbus-unit: introduce unit_can_{start,stop,isolate}_refuse_manual() functions
Yu Watanabe [Mon, 14 May 2018 03:37:57 +0000 (12:37 +0900)] 
core/dbus-unit: introduce unit_can_{start,stop,isolate}_refuse_manual() functions

6 years agocore: use BUS_DEFINE_PROPERTY_GET* macros
Yu Watanabe [Mon, 14 May 2018 01:07:00 +0000 (10:07 +0900)] 
core: use BUS_DEFINE_PROPERTY_GET* macros

6 years agomachine: use BUS_DEFINE_PROPERTY_GET* macros
Yu Watanabe [Tue, 15 May 2018 14:10:49 +0000 (23:10 +0900)] 
machine: use BUS_DEFINE_PROPERTY_GET* macros

6 years agoresolve: use BUS_DEFINE_PROPERTY_GET* macros
Yu Watanabe [Mon, 14 May 2018 01:04:21 +0000 (10:04 +0900)] 
resolve: use BUS_DEFINE_PROPERTY_GET* macros

6 years agotimedate: use BUS_DEFINE_PROPERTY_GET* macros
Yu Watanabe [Mon, 14 May 2018 01:04:04 +0000 (10:04 +0900)] 
timedate: use BUS_DEFINE_PROPERTY_GET* macros

6 years agotimesync: use NULL instead of empty string
Yu Watanabe [Mon, 14 May 2018 01:03:49 +0000 (10:03 +0900)] 
timesync: use NULL instead of empty string

6 years agologin: use BUS_DEFINE_PROPERTY_GET* macros
Yu Watanabe [Mon, 14 May 2018 01:02:55 +0000 (10:02 +0900)] 
login: use BUS_DEFINE_PROPERTY_GET* macros

6 years agobus-util: add more macros for defining functions of getting dbus properties
Yu Watanabe [Mon, 14 May 2018 01:02:17 +0000 (10:02 +0900)] 
bus-util: add more macros for defining functions of getting dbus properties

6 years agotimedate: do not copy input string before bus_verify_polkit_async() 9002/head
Yu Watanabe [Tue, 15 May 2018 13:53:19 +0000 (22:53 +0900)] 
timedate: do not copy input string before bus_verify_polkit_async()

This fixes the commit 2c3def62144c9d689ddda88a866b1e623074eaae which
breaks `timedatectl set-timezone` called by non-privileged user.

6 years agohostname: use free_and_strdup()
Yu Watanabe [Tue, 15 May 2018 13:48:58 +0000 (22:48 +0900)] 
hostname: use free_and_strdup()

Also, this makes hostnamed check the input strings before
bus_verify_polkit_async().

6 years agosysusers: drop an unused variable
Yu Watanabe [Tue, 15 May 2018 11:44:15 +0000 (20:44 +0900)] 
sysusers: drop an unused variable

Follow-up for ec0327d69c260d9a3770e9d722dbdcde996651cc.

6 years agoservice: FileDescriptorStoreMax should also imply NotifyAccess
Alan Jenkins [Mon, 14 May 2018 14:45:09 +0000 (15:45 +0100)] 
service: FileDescriptorStoreMax should also imply NotifyAccess

Commenting out "WatchdogTimeout=3min" in systemd-logind.service causes
NotifyAccess to go from "main" to "none", breaking support for logind
restart.  Let's fix that.

6 years agosd-resolve: fix check for packet size 8993/head
Zbigniew Jędrzejewski-Szmek [Mon, 14 May 2018 14:59:20 +0000 (16:59 +0200)] 
sd-resolve: fix check for packet size

The protocol is that a string is serialized with the nul byte at the end, and
the terminator is included in length. We'd call strndup with offset 0, length
len1-1, and then a second time with offset len1, length len2-1, so in the end
the check was off by one. But let's require the terminating nul too, even if
we don't access it.

CID #1383035.

6 years agosd-resolve: use structured initializers and _cleanup_
Zbigniew Jędrzejewski-Szmek [Mon, 14 May 2018 13:53:00 +0000 (15:53 +0200)] 
sd-resolve: use structured initializers and _cleanup_

Also remove a break that cannot be reached and a resolve->dead check
that duplicates the loop condition.

6 years agosd-resolve: trivial indentation fixes
Zbigniew Jędrzejewski-Szmek [Mon, 14 May 2018 13:52:17 +0000 (15:52 +0200)] 
sd-resolve: trivial indentation fixes

6 years agosd-resolve: do not assert on packet size received over a socket
Zbigniew Jędrzejewski-Szmek [Mon, 14 May 2018 09:08:59 +0000 (11:08 +0200)] 
sd-resolve: do not assert on packet size received over a socket

This is external data, even if trusted. We should not assert on it, but verify
and return proper error instead, which assert_return does. In particular,
write(2) says that a partial write could occur when interupted by a signal.
When compiled with asserts disabled, we could access memory outside of the
allocated buffer.

CID #1237671.
Follow-up for 1a96c8e1ccb06f87b6bfaff4639390ecd00af588.

6 years agobash-completion: add missing options and commands of timedatectl
Yu Watanabe [Tue, 15 May 2018 08:31:32 +0000 (17:31 +0900)] 
bash-completion: add missing options and commands of timedatectl

Follow-up for 6129ec852ee470a3682d55f87852ee7ccabb5520.

6 years agoMerge pull request #8947 from yuwata/meson-0.44
Zbigniew Jędrzejewski-Szmek [Tue, 15 May 2018 06:58:33 +0000 (08:58 +0200)] 
Merge pull request #8947 from yuwata/meson-0.44

meson: bump minimum required version to 0.44

6 years agosd-resolve: add helper macro for setting of ret/_errno/_h_errno
Zbigniew Jędrzejewski-Szmek [Mon, 14 May 2018 07:50:58 +0000 (09:50 +0200)] 
sd-resolve: add helper macro for setting of ret/_errno/_h_errno

Just to make things a bit shorter. This fixes an error where errno==-EIO would be set
(negative value), introduced in 1a96c8e1ccb06f87b6bfaff4639390ecd00af588.

6 years agotest-copy: remove unnecessary initialization
Zbigniew Jędrzejewski-Szmek [Mon, 14 May 2018 07:20:17 +0000 (09:20 +0200)] 
test-copy: remove unnecessary initialization

Initializing just some of the values doesn't make sense. We should handle them
all in the same way. In those tests there are no jumps, all steps are covered
with assert_se(), so we know everything will be set if we get to the end of the
function. And _not_ initializing those variables has the advantage that it
allows valgrind to catch potential initalization errors in the function being
tested.