chiark / gitweb /
3 years agoassigning stdout and stderr is not allowed
Matija Skala [Wed, 15 Mar 2017 12:49:05 +0000 (13:49 +0100)]
assigning stdout and stderr is not allowed

3 years agofix includes
Matija Skala [Wed, 15 Mar 2017 12:21:10 +0000 (13:21 +0100)]
fix includes

linux/sockios.h is needed for the SIOCGSTAMPNS macro

xlocale.h is included indirectly in glibc and doesn't even exist in
other libcs

3 years agoheaders: check that __INCLUDE_LEVEL__ is defined before using it (#5575)
Zbigniew Jędrzejewski-Szmek [Mon, 13 Mar 2017 07:11:24 +0000 (03:11 -0400)]
headers: check that __INCLUDE_LEVEL__ is defined before using it (#5575)

That macro is a gcc extension, and while widely supported, not ubiquitous.
In particular the coverity scanner is having trouble with it.

3 years agoFix typo in function name (#5565)
Michal Sekletar [Fri, 10 Mar 2017 14:16:24 +0000 (15:16 +0100)]
Fix typo in function name (#5565)

3 years agomissing.h: add vxlan netlink properties
Susant Sahani [Wed, 8 Mar 2017 13:09:43 +0000 (18:39 +0530)]
missing.h: add vxlan netlink properties

3 years agosd-bus: drop kdbus-related docs (#5533)
AsciiWolf [Tue, 7 Mar 2017 06:51:35 +0000 (07:51 +0100)]
sd-bus: drop kdbus-related docs (#5533)

3 years agotest: skip instead of fail if crypto kmods are not available
Martin Pitt [Thu, 2 Mar 2017 22:42:01 +0000 (23:42 +0100)]
test: skip instead of fail if crypto kmods are not available

Package build machines may have module loading disabled, thus AF_ALG
sockets are not available. Skip the tests that cover those (khash and
id128) instead of failing them in this case.

Fixes #5524

3 years agoRip out setting of the log level from udev_new and put it in a new function
Zbigniew Jędrzejewski-Szmek [Thu, 23 Feb 2017 08:16:44 +0000 (03:16 -0500)]
Rip out setting of the log level from udev_new and put it in a new function

This function is internal to elogind code, so external users of libudev
will not see those log messages. I think this is better. If we want to
allow that, the function could be put in libudev and exported.

v2: check that the string is more than one char before stripping quotes

3 years agobasic/log: split max log level into multiple "realms"
Zbigniew Jędrzejewski-Szmek [Thu, 23 Feb 2017 03:57:34 +0000 (22:57 -0500)]
basic/log: split max log level into multiple "realms"

The single log level is split into an array of log levels. Which index in the
array is used can be determined for each compilation unit separately by setting
a macro before including log.h. All compilation units use the same index
(LOG_REALM_SYSTEMD), so there should be no functional change.

- the "realm" is squished into the level (upper bits that are not used by
  priority or facility), and unsquished later in functions in log.c.


3 years agoVersion 233.3 Release v233.3
Sven Eden [Fri, 21 Jul 2017 05:48:48 +0000 (07:48 +0200)]
Version 233.3 Release

3 years agoPrep v233.3: Add HAVE_UTMP information to basic/build.h
Sven Eden [Fri, 21 Jul 2017 05:46:20 +0000 (07:46 +0200)]
Prep v233.3: Add HAVE_UTMP information to basic/build.h

3 years agoPrep v233.3: Remove stray character.
Sven Eden [Fri, 21 Jul 2017 05:41:40 +0000 (07:41 +0200)]
Prep v233.3: Remove stray character.

3 years agoPrep v233.3: Add 'loginctl list' as a shorthand for list-sessions
Sven Eden [Thu, 20 Jul 2017 16:25:48 +0000 (18:25 +0200)]
Prep v233.3: Add 'loginctl list' as a shorthand for list-sessions

3 years agoPrep v233.3: Moved four functions, that did not need adaptation in elogind-dbus.c...
Sven Eden [Thu, 20 Jul 2017 16:16:13 +0000 (18:16 +0200)]
Prep v233.3: Moved four functions, that did not need adaptation in elogind-dbus.c, back to logind-dbus.c.

3 years agoPrep v233.3: Moved shutdown_or_sleep() and run_helper() to elogind-dbus.c, so elogind...
Sven Eden [Thu, 20 Jul 2017 15:16:50 +0000 (17:16 +0200)]
Prep v233.3: Moved shutdown_or_sleep() and run_helper() to elogind-dbus.c, so elogind-action.c is not needed any more.

3 years agoPrep v233.3: Apply upstream updates to systemctl commands we mimic.
Sven Eden [Thu, 20 Jul 2017 15:03:33 +0000 (17:03 +0200)]
Prep v233.3: Apply upstream updates to systemctl commands we mimic.

3 years agoPrep v233.3: Add a traget 'cccc' to
Sven Eden [Thu, 20 Jul 2017 06:24:36 +0000 (08:24 +0200)]
Prep v233.3: Add a traget 'cccc' to

3 years agoPrep v233.3: Add missing documentation for API functions exported by elogind. (unrevi...
Sven Eden [Wed, 19 Jul 2017 11:46:39 +0000 (13:46 +0200)]
Prep v233.3: Add missing documentation for API functions exported by elogind. (unreviewed)

3 years agoPrep v233.3: Add all possible coverage tests for elogind
Sven Eden [Wed, 19 Jul 2017 09:55:18 +0000 (11:55 +0200)]
Prep v233.3: Add all possible coverage tests for elogind

3 years agoPrep v233.3: Unmask various functions for future coverage tests.
Sven Eden [Tue, 18 Jul 2017 22:56:25 +0000 (00:56 +0200)]
Prep v233.3: Unmask various functions for future coverage tests.

These functions, although not used by elogind itself, are mostly tiny
and crucial for important tests to work.

3 years agoPrep v233.3: Update po files to not include files that do not exist in elogind.
Sven Eden [Tue, 18 Jul 2017 18:30:57 +0000 (20:30 +0200)]
Prep v233.3: Update po files to not include files that do not exist in elogind.

3 years agoPrep v233.3: Remove obsolete test-hash.c
Sven Eden [Tue, 18 Jul 2017 13:42:39 +0000 (15:42 +0200)]
Prep v233.3: Remove obsolete test-hash.c

3 years agoVersion 233.2 Release
Sven Eden [Tue, 18 Jul 2017 07:37:20 +0000 (09:37 +0200)]
Version 233.2 Release

3 years agoPrep v233.2: Mask unneeded functions and definitions in src/shared
Sven Eden [Mon, 17 Jul 2017 16:21:47 +0000 (18:21 +0200)]
Prep v233.2: Mask unneeded functions and definitions in src/shared

3 years agoPrep v233.2: Mask unneeded functions and definitions in src/basic
Sven Eden [Tue, 18 Jul 2017 06:04:37 +0000 (08:04 +0200)]
Prep v233.2: Mask unneeded functions and definitions in src/basic

3 years agoVersion 233.1 Release
Sven Eden [Mon, 17 Jul 2017 16:15:05 +0000 (18:15 +0200)]
Version 233.1 Release

3 years agoPrep v233: Add missing updates from upstream in src/systemd
Sven Eden [Mon, 17 Jul 2017 15:38:58 +0000 (17:38 +0200)]
Prep v233: Add missing updates from upstream in src/systemd

3 years agoPrep v233: Add missing updates from upstream in src/sleep
Sven Eden [Mon, 17 Jul 2017 15:38:46 +0000 (17:38 +0200)]
Prep v233: Add missing updates from upstream in src/sleep

3 years agoPrep v233: Add missing updates from upstream in src/login
Sven Eden [Mon, 17 Jul 2017 15:37:38 +0000 (17:37 +0200)]
Prep v233: Add missing updates from upstream in src/login

3 years agoPrep v233: Add missing updates from upstream in src/libelogind
Sven Eden [Mon, 17 Jul 2017 16:09:52 +0000 (18:09 +0200)]
Prep v233: Add missing updates from upstream in src/libelogind

3 years agoPrep v233: Add missing updates from upstream in src/core
Sven Eden [Mon, 17 Jul 2017 16:09:39 +0000 (18:09 +0200)]
Prep v233: Add missing updates from upstream in src/core

3 years agoPrep v233: Add missing updates from upstream in src/basic
Sven Eden [Mon, 17 Jul 2017 15:13:40 +0000 (17:13 +0200)]
Prep v233: Add missing updates from upstream in src/basic

3 years agoPrep v233: Add missing includes in src/libelogind/sd-id128
Sven Eden [Mon, 17 Jul 2017 15:36:59 +0000 (17:36 +0200)]
Prep v233: Add missing includes in src/libelogind/sd-id128

3 years agoPrep v233: Add missing includes in src/shared
Sven Eden [Mon, 17 Jul 2017 15:38:19 +0000 (17:38 +0200)]
Prep v233: Add missing includes in src/shared

3 years agoPrep v233: Add missing includes in src/basic
Sven Eden [Mon, 17 Jul 2017 15:33:24 +0000 (17:33 +0200)]
Prep v233: Add missing includes in src/basic

3 years agoPrep v233: Unmask now needed functions in src/basic
Sven Eden [Mon, 17 Jul 2017 15:13:52 +0000 (17:13 +0200)]
Prep v233: Unmask now needed functions in src/basic

3 years agoPrep v233: Add missing files from upstream and rename formats-util.[hc]
Sven Eden [Mon, 17 Jul 2017 13:03:10 +0000 (15:03 +0200)]
Prep v233: Add missing files from upstream and rename formats-util.[hc]

Some functionality has been exported to the following files:

 - src/basic/env-util.[hc]
 - src/basic/exec-util.[hc]
 - src/shared/nsflags.[hc]

The content of these files is now needed in elogind, and the files have been
added as-is. Cleanup is done later.

Further the header
has been renamed to

3 years agoPrep v233: Update root build files to upstream version
Sven Eden [Mon, 17 Jul 2017 10:55:17 +0000 (12:55 +0200)]
Prep v233: Update root build files to upstream version

3 years agoRevert "util: Fine tune running_in_chroot() a bit" (#5506)
Lennart Poettering [Wed, 1 Mar 2017 20:22:02 +0000 (21:22 +0100)]
Revert "util: Fine tune running_in_chroot() a bit" (#5506)

This reverts commit 295ee9845c801300298d01256eb5a9e3ff117ae0.

Let'd revert this for now, see #5446 for discussions.

We want elogind-detect-virt --chroot to return true for all chroot-like stuff, for
example mock environments which have use a mount namespace. The downside
of this revert that systemctl will not work from our own namespaced services, anything
with RootDirectory=/RootImage= set.

3 years agomount-util: accept that name_to_handle_at() might fail with EPERM (#5499)
Lennart Poettering [Wed, 1 Mar 2017 16:35:05 +0000 (17:35 +0100)]
mount-util: accept that name_to_handle_at() might fail with EPERM (#5499)

Container managers frequently block name_to_handle_at(), returning
EACCES or EPERM when this is issued. Accept that, and simply fall back
to to fdinfo-based checks.

Note that we accept either EACCES or EPERM here, as container managers
can choose the error code and aren't very good on agreeing on just one.

(note that this is a non-issue with nspawn, as we permit
name_to_handle_at() there, only block open_by_handle_at(), which should
be sufficiently safe).

3 years agosocket-util: introduce address_label_valid
Susant Sahani [Tue, 28 Feb 2017 11:23:58 +0000 (16:53 +0530)]
socket-util: introduce address_label_valid

3 years agoFix missing space in comments (#5439)
AsciiWolf [Fri, 24 Feb 2017 17:14:02 +0000 (18:14 +0100)]
Fix missing space in comments (#5439)

3 years agocgroup: rework cg_all_unified()
Lennart Poettering [Fri, 24 Feb 2017 17:05:31 +0000 (18:05 +0100)]
cgroup: rework cg_all_unified()

Let's just check the unified level, directly. There's really no value in
wrapping cg_unified_controllers() with this, i.e. potentially do string
comparison when there's no reason to.

Also, this makes the clal more alike cg_hybrid_unified().

3 years agocgroup: rename cg_update_unified() → cg_unified_update()
Lennart Poettering [Fri, 24 Feb 2017 17:03:09 +0000 (18:03 +0100)]
cgroup: rename cg_update_unified() → cg_unified_update()

We usually put the noun first, the verb (i.e. method) secont, for
example in cg_unified_flush(), let's follow the logic here...

3 years agocgroup: rename cg_unified() → cg_unified_controller()
Lennart Poettering [Fri, 24 Feb 2017 17:00:04 +0000 (18:00 +0100)]
cgroup: rename cg_unified() → cg_unified_controller()

cg_unified() is a bit generic a name, let's make clear that it checks
whether a specified controller is in unified mode.

3 years agocgroup: change cg_unified() to possibly return errors again
Lennart Poettering [Fri, 24 Feb 2017 16:52:58 +0000 (17:52 +0100)]
cgroup: change cg_unified() to possibly return errors again

We use our cgroup APIs in various contexts, including from our libraries
sd-login, sd-bus. As we don#t control those environments we can't rely
that the unified cgroup setup logic succeeds, and hence really shouldn't
assert on it.

This more or less reverts 415fc41ceaeada2e32639f24f134b1c248b9e43f.

3 years agocgroup-util: check unified_cache before invoking streq()
Lennart Poettering [Fri, 24 Feb 2017 14:53:17 +0000 (15:53 +0100)]
cgroup-util: check unified_cache before invoking streq()

Just a minor optimization.

3 years agocgroup-util: fix the case of default=unified, unified-cgroup-hierarchy=0
Zbigniew Jędrzejewski-Szmek [Thu, 23 Feb 2017 00:55:31 +0000 (19:55 -0500)]
cgroup-util: fix the case of default=unified, unified-cgroup-hierarchy=0

We should mount the hybrid hierarchy if the user disabled the unified
hierarchy on the kernel command line.

3 years agocgroup-util: cache all cg_is_*_wanted answers, disable /sys/fs/cgroups/unified on...
Zbigniew Jędrzejewski-Szmek [Wed, 22 Feb 2017 17:57:43 +0000 (12:57 -0500)]
cgroup-util: cache all cg_is_*_wanted answers, disable /sys/fs/cgroups/unified on unified

If we encounter an error in proc cmdline parsing, just treat that as permanent,
i.e. the same as if the option was not specified. Realistically, it is better
to use the same condition for all related mounts, then to have e.g.
/sys/fs/cgroup mounted and /sys/fs/cgroup/unified not. If we find something is
mounted and base our answer on that, cache that result too.

Fix the conditions so that if "unified" is used, make sure any "hybrid" mounts
are not mounted.

3 years agoFix check for signal in set (#5416)
stuart-mclaren [Tue, 21 Feb 2017 20:39:52 +0000 (20:39 +0000)]
Fix check for signal in set (#5416)

IN_SET(SIGCONT, SIGKILL) will always evaluate to false.
The signal needs to be included as the first argument.

Fixup for 26f417d3e8dd2522adfdc4c8fed4c36fa40f48fc.

3 years agoRevert "basic/strv: allow NULLs to be inserted into strv"
Lennart Poettering [Tue, 21 Feb 2017 17:11:12 +0000 (18:11 +0100)]
Revert "basic/strv: allow NULLs to be inserted into strv"

This reverts commit 18f71a3c8174774c5386c4aba94d54f3b5c36a84.

According to @keszybz we don't need this anymore, hence drop it:

3 years agolog: never log into foreign fd #2 in PID 1 or its pre-execve() children
Lennart Poettering [Tue, 21 Feb 2017 16:57:55 +0000 (17:57 +0100)]
log: never log into foreign fd #2 in PID 1 or its pre-execve() children

Fixes: #5401

3 years agobootctl: create loader.conf only if it doesn't exist yet
Lennart Poettering [Tue, 21 Feb 2017 16:44:35 +0000 (17:44 +0100)]
bootctl: create loader.conf only if it doesn't exist yet

If the snippet aleady exists, don't do anything, as the file was already
installed then.

(This also reworks the code to create the file atomically)

Fixes: #5396

3 years agobasic/fileio: use IN_SET
Zbigniew Jędrzejewski-Szmek [Tue, 21 Feb 2017 16:15:27 +0000 (11:15 -0500)]
basic/fileio: use IN_SET

3 years agobasic/fileio: fix memleak when discarding an invalid variable
Zbigniew Jędrzejewski-Szmek [Tue, 21 Feb 2017 16:15:19 +0000 (11:15 -0500)]
basic/fileio: fix memleak when discarding an invalid variable

Fixes #5405.

3 years agocopy: a plain unlink() works here too
Lennart Poettering [Tue, 21 Feb 2017 16:13:28 +0000 (17:13 +0100)]
copy: a plain unlink() works here too

3 years agoSyntax for defines that is also unterstood by the GNU C/C++ compilers. (#5397)
pyBlob [Mon, 20 Feb 2017 21:24:45 +0000 (22:24 +0100)]
Syntax for defines that is also unterstood by the GNU C/C++ compilers. (#5397)

3 years agocgroup-util: fix the reversed return value of cg_is_unified_elogind_contoller_wanted
Zbigniew Jędrzejewski-Szmek [Mon, 20 Feb 2017 17:26:53 +0000 (12:26 -0500)]
cgroup-util: fix the reversed return value of cg_is_unified_elogind_contoller_wanted

1d84ad944520fc3e062ef518c4db4e1 reversed the meaning of the option.
The kernel command line option has the opposite meaning to the function,
i.e. specifying "legacy=yes" means "unifed elogind controller=no".

3 years agocore/mount-setup: if unified hierarchy is not supported, fall back to legacy
Zbigniew Jędrzejewski-Szmek [Sun, 19 Feb 2017 20:59:21 +0000 (15:59 -0500)]
core/mount-setup: if unified hierarchy is not supported, fall back to legacy

We need this to gracefully support older or strangely configured kernels.

- do not install a callback handler, just embed the right conditions into

- fix bug in cg_is_legacy_wanted()

3 years agoRename cg_is_unified_elogind_controller_wanted to cg_is_hybrid_wanted
Zbigniew Jędrzejewski-Szmek [Sun, 19 Feb 2017 20:36:56 +0000 (15:36 -0500)]
Rename cg_is_unified_elogind_controller_wanted to cg_is_hybrid_wanted

Less typing and doesn't make the table so incredibly wide.

3 years agoshared/pager: abort if we cannot set environment variables
Zbigniew Jędrzejewski-Szmek [Sun, 19 Feb 2017 18:52:18 +0000 (13:52 -0500)]
shared/pager: abort if we cannot set environment variables

This most likely means oom, it's better to exit than to run less with
incomplete settings.

CID #714383.

3 years agologind: check return value from lseek
Zbigniew Jędrzejewski-Szmek [Sun, 19 Feb 2017 18:43:22 +0000 (13:43 -0500)]
logind: check return value from lseek

In practice this doesn't matter much because the read that follows will
likely fail, but we'll get a better error message.

CID #1368233.

3 years agobuild.h: include default cgroup hierarchy setting in --version output
Zbigniew Jędrzejewski-Szmek [Sun, 19 Feb 2017 04:28:01 +0000 (23:28 -0500)]
build.h: include default cgroup hierarchy setting in --version output

This is pretty important, and we print this string during startup, so putting
the default hierarchy information might help with diagnosis if things go awry.

$ ./systemctl --version
elogind 232

v2: make the message nicer by including the ./configure option argument
directly in output

3 years agopid1: add ./configure switch to select default cgroup hierarchy
Zbigniew Jędrzejewski-Szmek [Sun, 19 Feb 2017 04:13:15 +0000 (23:13 -0500)]
pid1: add ./configure switch to select default cgroup hierarchy

The default default is set to "legacy", with "hybrid" and "unified"
being the other two alternatives.

There invert the behaviour for elogind.legacy_elogind_cgroup_controller:
if it is not specified on the kernel command line, "hybrid" is used if
selected as the default. If this option is specified, "hybrid" is used if false,
and full "legacy" if true.

Also make all fields in the configure summary lowercase (unless they are
capitalized names) for consistency.

- update for the fixed interpreation of elogind.legacy_elogind_cgroup_controller

3 years agoTighten checking for variable validity
Zbigniew Jędrzejewski-Szmek [Sat, 18 Feb 2017 03:56:28 +0000 (22:56 -0500)]
Tighten checking for variable validity

In the future we might want to allow additional syntax (for example
"unset VAR". But let's check that the data we're getting does not contain
anything unexpected.

3 years agomissing: add renameat2() definition for 64bit arm (#5378)
Lennart Poettering [Fri, 17 Feb 2017 18:10:09 +0000 (19:10 +0100)]
missing: add renameat2() definition for 64bit arm (#5378)

Following a similar commit in casync:

3 years agovirt: Update cache if the detected vm is virtualbox (#5364)
Benjamin Robin [Fri, 17 Feb 2017 07:45:30 +0000 (08:45 +0100)]
virt: Update cache if the detected vm is virtualbox (#5364)

3 years agohostname-util: default to the compile time default hostname in gethostname_malloc()
Lennart Poettering [Thu, 16 Feb 2017 11:02:17 +0000 (12:02 +0100)]
hostname-util: default to the compile time default hostname in gethostname_malloc()

Currently, if the hostname is not set gethostname_malloc() defaults to
the "sysname", which is "linux" on Linux. Let's change that to also
honour the compile-time fallback hostname as specified on the configure
command line.

3 years agovirt: swap order of cpuid and dmi again, but properly detect oracle (#5355)
Christian Hesse [Wed, 15 Feb 2017 22:51:31 +0000 (23:51 +0100)]
virt: swap order of cpuid and dmi again, but properly detect oracle (#5355)

This breaks again, this time for setups where Qemu is not reported via DMI for whatever
reason. So swap order of cpuid and dmi again, but properly detect oracle.

See issue #5318.

3 years agovirt: detect qemu/kvm as 'kvm'
Christian Hesse [Tue, 14 Feb 2017 13:51:12 +0000 (14:51 +0100)]
virt: detect qemu/kvm as 'kvm'

In commit 050e65a we swapped order of detect_vm_{cpuid,dmi}(). That
fixed Virtualbox but broke qemu with kvm, which is expected to return
'kvm'. So check for qemu/kvm first, then DMI, CPUID last.

This fixes #5318.

Signed-off-by: Christian Hesse <>
3 years agomachined: when copying files from/to userns containers chown to root
Lennart Poettering [Mon, 13 Feb 2017 18:24:01 +0000 (19:24 +0100)]
machined: when copying files from/to userns containers chown to root

This changes the file copy logic of machined to set the UID/GID of all
copied files to 0 if the host and container do not share the same user

Fixes: #4078

3 years agocopy: change the various copy_xyz() calls to take a unified flags parameter
Lennart Poettering [Mon, 13 Feb 2017 18:00:22 +0000 (19:00 +0100)]
copy: change the various copy_xyz() calls to take a unified flags parameter

This adds a unified "copy_flags" parameter to all copy_xyz() function
calls, replacing the various boolean flags so far used. This should make
many invocations more readable as it is clear what behaviour is
precisely requested. This also prepares ground for adding support for
more modes later on.

3 years agocore/manager: split out creation of serialization fd out to a helper
Zbigniew Jędrzejewski-Szmek [Sat, 11 Feb 2017 23:33:16 +0000 (18:33 -0500)]
core/manager: split out creation of serialization fd out to a helper

There is a slight change in behaviour: the user manager for root will create a
temporary file in /run/elogind, not /tmp. I don't think this matters, but
simplifies implementation.

3 years agoAllow braceless variables to be expanded
Zbigniew Jędrzejewski-Szmek [Sat, 11 Feb 2017 19:05:10 +0000 (14:05 -0500)]
Allow braceless variables to be expanded

(Only in environment.d files.)

We have only basic compatibility with shell syntax, but specifying variables
without using braces is probably more common, and I think a lot of people would
be surprised if this didn't work.

3 years agoenv-util,fileio: immediately replace variables in load_env_file_push()
Zbigniew Jędrzejewski-Szmek [Sat, 11 Feb 2017 04:08:53 +0000 (23:08 -0500)]
env-util,fileio: immediately replace variables in load_env_file_push()

strv_env_replace was calling env_match(), which in effect allowed multiple
values for the same key to be inserted into the environment block. That's
pointless, because APIs to access variables only return a single value (the
latest entry), so it's better to keep the block clean, i.e. with just a single
entry for each key.

Add a new helper function that simply tests if the part before '=' is equal in
two strings and use that in strv_env_replace.

In load_env_file_push, use strv_env_replace to immediately replace the previous
assignment with a matching name.

Afaict, none of the callers are materially affected by this change, but it
seems like some pointless work was being done, if the same value was set
multiple times. We'd go through parsing and assigning the value for each
entry. With this change, we handle just the last one.

3 years agobasic/fileio: add helper function for a set of two common checks
Zbigniew Jędrzejewski-Szmek [Sat, 11 Feb 2017 03:14:03 +0000 (22:14 -0500)]
basic/fileio: add helper function for a set of two common checks

3 years agoman: update pam_elogind and elogind-logind man pages a bit
Lennart Poettering [Thu, 9 Feb 2017 17:40:42 +0000 (18:40 +0100)]
man: update pam_elogind and elogind-logind man pages a bit

This builds on @utezduyar's #4640, but extends on it.

Fixes: #4550
Replaces: #4640

3 years agosd-event: "when exiting no signal event are pending" is a wrong assertion (#5271)
Franck Bui [Wed, 8 Feb 2017 19:56:22 +0000 (20:56 +0100)]
sd-event: "when exiting no signal event are pending" is a wrong assertion (#5271)

The code make the following assertion: when freeing a event loop object
(usually it's done after exiting from the main event loop), no signal events
are still queued and are pending.

This assertion can be found in event_unmask_signal_data() with
"assert(!d->current);" assertion.

It appears that this assertion can be wrong at least in a specific case
described below.

Consider the following example which is inspired from udev: a process defines 3
source events: 2 are created by sd_event_add_signal() and 1 is created by

 1. the process receives the 2 signals consecutively so that signal 'A' source
     event is queued and pending. Consequently the post source event is also
     queued and pending. This is done by sd_event_wait().

 2. The callback for signal 'A' is called by sd_event_dispatch().

 3. The next call to sd_event_wait() will queue signal 'B' source event.

 4. The callback for the post source event is called and calls sd_event_exit().

 5. the event loop is exited.

 6. freeing the event loop object will lead to the assertion failure in

This patch simply removes this assertion as it doesn't seem to be a
bug if the signal data still reference a signal source at this point.

3 years agotree-wide: make bus_map_all_properties return a proper sd_bus_error
Lennart Poettering [Wed, 8 Feb 2017 16:59:58 +0000 (17:59 +0100)]
tree-wide: make bus_map_all_properties return a proper sd_bus_error

And then show it, to make things a bit friendlier to the user if we fail
acquiring some props.

In fact, this fixes a number of actual bugs, where we used an error
structure for output that we actually never got an error in.

3 years agobasic/dirent-util: allow suffix to be omitted for dirent_is_file_with_suffix
Zbigniew Jędrzejewski-Szmek [Wed, 8 Feb 2017 02:06:38 +0000 (21:06 -0500)]
basic/dirent-util: allow suffix to be omitted for dirent_is_file_with_suffix

3 years agol10n: fix file permissions of Indonesian translation
AsciiWolf [Tue, 7 Feb 2017 18:02:01 +0000 (19:02 +0100)]
l10n: fix file permissions of Indonesian translation

3 years agoman: document that sd_notify() is racy in some cases
Lennart Poettering [Mon, 6 Feb 2017 12:49:44 +0000 (13:49 +0100)]
man: document that sd_notify() is racy in some cases

3 years agotreewide: replace homegrown memory_erase with explicit_bzero
Zbigniew Jędrzejewski-Szmek [Mon, 6 Feb 2017 01:05:27 +0000 (20:05 -0500)]
treewide: replace homegrown memory_erase with explicit_bzero

explicit_bzero was added in glibc 2.25. Make use of it.

explicit_bzero is hardcoded to zero the memory, so string erase now
truncates the string, instead of overwriting it with 'x'. This causes
a visible difference only in the journalctl case.

3 years agotime-util: Fix overflow check introduce in commit f977849 (#5216)
Benjamin Robin [Fri, 3 Feb 2017 15:13:55 +0000 (16:13 +0100)]
time-util: Fix overflow check introduce in commit f977849 (#5216)

3 years agomanager: refuse reloading/reexecing when /run is overly full
Lennart Poettering [Fri, 3 Feb 2017 11:12:54 +0000 (12:12 +0100)]
manager: refuse reloading/reexecing when /run is overly full

Let's add an extra safety check: before entering a reload/reexec, let's
verify that there's enough room in /run for it.

Fixes: #5016

3 years agologind: Don't try to emit a change signal for the 'Sessions' property (#5211)
afrantzis [Fri, 3 Feb 2017 01:39:26 +0000 (03:39 +0200)]
logind: Don't try to emit a change signal for the 'Sessions' property (#5211)

The 'Sessions' property for both org.freedesktop.login1.User and
org.freedesktop.login1.Seat is marked as EmitsChangedSignal(false).
Trying to emit a change signal that includes the 'Sessions' property
leads to the signal not being sent at all.

Fixes #5210.

3 years agotime-util: add overflow checking to monotonic timestamp specifications
Lennart Poettering [Thu, 2 Feb 2017 17:35:00 +0000 (18:35 +0100)]
time-util: add overflow checking to monotonic timestamp specifications

3 years agotime-util: when formatting usec_t as raw integers use PRIu64
Lennart Poettering [Thu, 2 Feb 2017 17:34:26 +0000 (18:34 +0100)]
time-util: when formatting usec_t as raw integers use PRIu64

After all, usec_t is defined as uint64_t, and not as unsigned long long.

3 years agotime-util: when converting to time_t do something useful in 2038
Lennart Poettering [Thu, 2 Feb 2017 17:33:36 +0000 (18:33 +0100)]
time-util: when converting to time_t do something useful in 2038

On systems where time_t is 32bit we should invalidate the
timeval/timespec instead of proceeding with a potentially overflown

3 years agotime-util: refuse formatting/parsing times that we can't store
Lennart Poettering [Thu, 2 Feb 2017 17:30:29 +0000 (18:30 +0100)]
time-util: refuse formatting/parsing times that we can't store

usec_t is always 64bit, which means it can cover quite a number of
years. However, 4 digit year display and glibc limitations around time_t
limit what we can actually parse and format. Let's make this explicit,
so that we never end up formatting dates we can#t parse and vice versa.

Note that this is really just about formatting/parsing. Internal
calculations with times outside of the formattable range are not

3 years agotime: time_t is signed, and mktime() is happy to return negative time
Lennart Poettering [Thu, 2 Feb 2017 17:25:33 +0000 (18:25 +0100)]
time: time_t is signed, and mktime() is happy to return negative time

Passing a year such as 1960 to mktime() will result in a negative return
value. This is quite confusing, as the man page claims that on failure
the call will return -1...

Given that our own usec_t type is unsigned, and we can't express times
before 1970 hence, let's consider all negative times returned by
mktime() as invalid, regardless if just -1, or anything else negative.

3 years agoConsistently use ERFKILL for masked units
Zbigniew Jędrzejewski-Szmek [Wed, 1 Feb 2017 23:36:09 +0000 (18:36 -0500)]
Consistently use ERFKILL for masked units

76ec966f0e33685f833 changed the code from ESHUTDOWN to ERFKILL, but missed one
spot in bus-common-errors.c. Fix that.

The code in transaction.c was checking for ERFKILL, but I'm not sure if this
mismatch had any effect, i.e. if there were any code paths in which the wrong
code actually made difference.

Also add comments when ESHUTDOWN is used in the journal code, so it's easy to
distinguish those cases when grepping. Standarize on the same capitalization.

(There's also a bunch of uses in sd-bus.c, but that's clearly different.)

3 years agohexdecoct: use typesafe new() instead of malloc()
Lennart Poettering [Wed, 1 Feb 2017 23:10:44 +0000 (00:10 +0100)]
hexdecoct: use typesafe new() instead of malloc()

3 years agofs-util: unify code we use to check if dirent's d_name is "." or ".."
Lennart Poettering [Wed, 1 Feb 2017 23:06:18 +0000 (00:06 +0100)]
fs-util: unify code we use to check if dirent's d_name is "." or ".."

We use different idioms at different places. Let's replace this is the
one true new idiom, that is even a bit faster...

3 years agoshared/cgroup-show: extract funtion to query unit cgroup path
Zbigniew Jędrzejewski-Szmek [Wed, 1 Feb 2017 19:30:57 +0000 (14:30 -0500)]
shared/cgroup-show: extract funtion to query unit cgroup path

…and use it where possible.

3 years agoutil-lib: Fix chase_symlinks() with absolute symlinks (#5185)
3chas3 [Tue, 31 Jan 2017 13:21:15 +0000 (08:21 -0500)]
util-lib: Fix chase_symlinks() with absolute symlinks (#5185)

If chase_symlinks() encouters an absolute symlink, it resets the todo
buffer to just the newly discovered symlink and discards any of the
remaining previous symlink path.  Regardless of whether or not the
symlink is absolute or relative, we need to preserve the remainder of
the path that has not yet been resolved.

3 years agologind: trivial simplification
Zbigniew Jędrzejewski-Szmek [Sat, 28 Jan 2017 02:50:06 +0000 (21:50 -0500)]
logind: trivial simplification

free_and_strdup() handles NULL arg, so make use of that.

3 years agotree-wide: adjust fall through comments so that gcc is happy
Zbigniew Jędrzejewski-Szmek [Fri, 27 Jan 2017 05:50:10 +0000 (00:50 -0500)]
tree-wide: adjust fall through comments so that gcc is happy

gcc 7 adds -Wimplicit-fallthrough=3 to -Wextra. There are a few ways
we could deal with that. After we take into account the need to stay compatible
with older versions of the compiler (and other compilers), I don't think adding
__attribute__((fallthrough)), even as a macro, is worth the trouble. It sticks
out too much, a comment is just as good. But gcc has some very specific
requiremnts how the comment should look. Adjust it the specific form that it
likes. I don't think the extra stuff we had in those comments was adding much

(Note: the documentation seems to be wrong, and seems to describe a different
pattern from the one that is actually used. I guess either the docs or the code
will have to change before gcc 7 is finalized.)

3 years agotree-wide: remove consecutive duplicate words in comments (#5148)
Stefan Schweter [Wed, 25 Jan 2017 02:45:30 +0000 (03:45 +0100)]
tree-wide: remove consecutive duplicate words in comments (#5148)

3 years agovirt: update url to hypervisor top-level functional specification (#5149)
Stefan Schweter [Wed, 25 Jan 2017 02:44:59 +0000 (03:44 +0100)]
virt: update url to hypervisor top-level functional specification (#5149)