]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
9 years agoexit-status: add missing include for SIG* defines 281/head
Michael Olbrich [Thu, 18 Jun 2015 07:00:01 +0000 (09:00 +0200)] 
exit-status: add missing include for SIG* defines

Otherwise building fails with glibc 2.16. It works with glibc >= 2.17
because it is implicitly included via macro.h -> sys/param.h -> signal.h

9 years agoMerge pull request #269 from teg/udev-docs-1
Kay Sievers [Wed, 17 Jun 2015 22:45:51 +0000 (00:45 +0200)] 
Merge pull request #269 from teg/udev-docs-1

man: libudev - add description to udev_device_*

9 years agoMerge pull request #272 from poettering/nspawn-flush-copy-fd
Daniel Mack [Wed, 17 Jun 2015 22:34:22 +0000 (00:34 +0200)] 
Merge pull request #272 from poettering/nspawn-flush-copy-fd

nspawn: when exiting, flush all remaining bytes from the pty to stdout

9 years agobuild-sys: bump versions and sonames
Lennart Poettering [Wed, 17 Jun 2015 22:28:06 +0000 (00:28 +0200)] 
build-sys: bump versions and sonames

9 years agoMerge pull request #276 from poettering/dbus-search-path
Kay Sievers [Wed, 17 Jun 2015 22:26:46 +0000 (00:26 +0200)] 
Merge pull request #276 from poettering/dbus-search-path

bus-proxy: add new dbus policy search paths from /usr

9 years agoNEWS: update
Kay Sievers [Wed, 17 Jun 2015 22:25:17 +0000 (00:25 +0200)] 
NEWS: update

9 years agoMerge pull request #277 from poettering/journal-interleaving-monotonic
Lennart Poettering [Wed, 17 Jun 2015 22:22:22 +0000 (00:22 +0200)] 
Merge pull request #277 from poettering/journal-interleaving-monotonic

journal: make sure the clock increases strict monotonic

9 years agoNEWS: prepare for v221
Lennart Poettering [Wed, 17 Jun 2015 22:18:49 +0000 (00:18 +0200)] 
NEWS: prepare for v221

9 years agohwdb: update databases from upstream
Lennart Poettering [Wed, 17 Jun 2015 21:54:35 +0000 (23:54 +0200)] 
hwdb: update databases from upstream

9 years agoman: minor typo fix
Lennart Poettering [Wed, 17 Jun 2015 21:50:13 +0000 (23:50 +0200)] 
man: minor typo fix

9 years agoman: run make update-man-list
Lennart Poettering [Wed, 17 Jun 2015 21:50:02 +0000 (23:50 +0200)] 
man: run make update-man-list

9 years agoMerge pull request #270 from phomes/master
Tom Gundersen [Wed, 17 Jun 2015 21:27:39 +0000 (23:27 +0200)] 
Merge pull request #270 from phomes/master

udevd: remove dead code

9 years agojournal: make sure the clock increases strict monotonic 277/head
Lennart Poettering [Wed, 17 Jun 2015 21:04:02 +0000 (23:04 +0200)] 
journal: make sure the clock increases strict monotonic

Let's work around crappy clocks in test-journal-interleaving.c too. This
does the same as 98d2a5341788b49e82d628dfdc2e241af6d70dcd but for
test-journal-interlaving.c rather than test-journal-stream.c.

9 years agoMerge pull request #275 from poettering/acl-fixes
Martin Pitt [Wed, 17 Jun 2015 21:10:19 +0000 (23:10 +0200)] 
Merge pull request #275 from poettering/acl-fixes

acl-util: various smaller fixes to parse_acl()

9 years agoupdate TODO
Lennart Poettering [Wed, 17 Jun 2015 21:03:27 +0000 (23:03 +0200)] 
update TODO

9 years agoMerge pull request #271 from poettering/test-journal-stream-crappy-clock
Lennart Poettering [Wed, 17 Jun 2015 20:56:09 +0000 (22:56 +0200)] 
Merge pull request #271 from poettering/test-journal-stream-crappy-clock

journal: ensure test-journal-stream doesn't get confused by crappy cl…

9 years agobus-proxy: add new dbus policy search paths from /usr 276/head
Lennart Poettering [Wed, 17 Jun 2015 20:43:46 +0000 (22:43 +0200)] 
bus-proxy: add new dbus policy search paths from /usr

D-Bus upstream is working on extending the configuration/policy search
path, follow this.

See #274 for details.

9 years agoMerge pull request #273 from teg/libudev-device-get-sysattrs
Martin Pitt [Wed, 17 Jun 2015 20:35:19 +0000 (22:35 +0200)] 
Merge pull request #273 from teg/libudev-device-get-sysattrs

libudev: device - fix typo in udev_device_get_sysattr_list_entry()

9 years agoacl-util: various smaller fixes to parse_acl() 275/head
Lennart Poettering [Wed, 17 Jun 2015 20:08:21 +0000 (22:08 +0200)] 
acl-util: various smaller fixes to parse_acl()

- Make string parameter const

- Don't log some OOM errors, but not others

- Don't eat up errors generated by acl_from_text()

- Make sure check for success of every single strv_push() call

9 years agolibudev: device - fix typo in udev_device_get_sysattr_list_entry() 273/head
Tom Gundersen [Wed, 17 Jun 2015 19:57:25 +0000 (21:57 +0200)] 
libudev: device - fix typo in udev_device_get_sysattr_list_entry()

We were adding the attributes to the wrong list.

9 years agoMerge pull request #248 from llua/zsh-completion
Daniel Mack [Wed, 17 Jun 2015 19:37:46 +0000 (21:37 +0200)] 
Merge pull request #248 from llua/zsh-completion

zsh-completion: _loginctl - general bug fixes

9 years agonspawn: when exiting, flush all remaining bytes from the pty to stdout 272/head
Lennart Poettering [Wed, 17 Jun 2015 18:54:45 +0000 (20:54 +0200)] 
nspawn: when exiting, flush all remaining bytes from the pty to stdout

This is a simpler fix for #210, it simply uses copy_bytes() for the
copying.

9 years agoMerge pull request #44 from filbranden/unquote_first_word1
Lennart Poettering [Wed, 17 Jun 2015 18:41:30 +0000 (20:41 +0200)] 
Merge pull request #44 from filbranden/unquote_first_word1

Replace FOREACH_WORD_QUOTED with a loop using unquote_first_word in config_parse_exec()

9 years agojournal: ensure test-journal-stream doesn't get confused by crappy clocks 271/head
Lennart Poettering [Wed, 17 Jun 2015 18:37:19 +0000 (20:37 +0200)] 
journal: ensure test-journal-stream doesn't get confused by crappy clocks

This ensures that we write strictly monotonic timestamps into the
journal files, to ensure that we can properly interleave everything
correctly.

See #175 for details.

9 years agoudved: remove dead code 270/head
Thomas Hindoe Paaboel Andersen [Wed, 17 Jun 2015 18:29:41 +0000 (20:29 +0200)] 
udved: remove dead code

Leftover from 6af5e6a4c918a68b196a04346732e094e5373a36

9 years agologs-show: print a debug message when we skip entries without MESSAGE= fields
Lennart Poettering [Wed, 17 Jun 2015 18:28:20 +0000 (20:28 +0200)] 
logs-show: print a debug message when we skip entries without MESSAGE= fields

9 years agoload-fragment: reset the list on an ExecStart= containing only whitespace 44/head
Filipe Brandenburger [Sat, 6 Jun 2015 06:12:25 +0000 (23:12 -0700)] 
load-fragment: reset the list on an ExecStart= containing only whitespace

This is consistent with how an empty string works in an ExecStart=
statement.  We should not differentiate between an empty string and
whitespace only (since they look the same.)

Update the test case with whitespace only to reflect that the list is
reset.

Tested that `test-unit-file` passes and other test cases are not
affected.  Installed the patched systemd binaries on a machine, booted
it, looked for out of the usual behavior but did not find any.

9 years agoload-fragment: use unquote_first_word in config_parse_exec
Filipe Brandenburger [Sun, 31 May 2015 05:48:52 +0000 (22:48 -0700)] 
load-fragment: use unquote_first_word in config_parse_exec

Convert config_parse_exec() from using FOREACH_WORD_QUOTED into a loop
of unquote_first_word.

Loop through the arguments only once (the FOREACH_WORD_QUOTED
implementation did it twice, once to count them and another time to
process and store them.)

Use newly introduced flag UNQUOTE_UNESCAPE_RELAX to preserve
unrecognized escape sequences such as regexps matches such as "\w",
"\d", etc. (Valid escape sequences such as "\s" or "\b" still need an
extra backslash if literals are desired for regexps.)

Differences in behavior:

- Handle ; (command separator) in special, so that only ; on its own is
  valid for that purpose, an quoted semicolon ";" or ';' will now behave
  as a literal semicolon.  This is probably what was initially intended.

- Handle \; (to introduce a literal semicolon) in special, so that only \;
  is turned into a semicolon but not \\; or "\\;" or "\;" which are kept
  as a literal \; in the output.  This is probably what was initially
  intended.

Known issues:

- Using an empty string (for example, ExecStartPre=<empty>) will empty
  the list and remove the existing commands, but using whitespace only
  (for example, ExecStartPre=<spaces>) will not.  This is a pre-existing
  issue and will be dealt with in a follow up commit.

Tested:

- Unit tests passing.  Also `make distcheck` still works as expected.

- Installed it on a local machine and booted with it, checked console
  output, systemctl and journalctl output, did not notice any issues
  running the patched systemd binaries.

Relevant bug: https://bugs.freedesktop.org/show_bug.cgi?id=90794

9 years agotests: additional cases in test-unit-file
Filipe Brandenburger [Tue, 9 Jun 2015 05:01:52 +0000 (22:01 -0700)] 
tests: additional cases in test-unit-file

These tests will be useful to check the cases regarding quoted and
escaped semicolon when we switch to using unquote_first_word.

Additionally, convert some of the tests that have semicolons so that the
argument after the semicolon looks like a path (starts with /) so that
we can see the change of behavior when making config_parse_exec more
strict about what it accepts as a command separator.

9 years agoutil: Introduce unquote_first_word_and_warn
Filipe Brandenburger [Tue, 9 Jun 2015 04:31:43 +0000 (21:31 -0700)] 
util: Introduce unquote_first_word_and_warn

It will try to unquot_first_word, but if it runs into escaping problems
it will retry it adding UNQUOTE_CUNESCAPE_RELAX to the flags.  If it
succeeds on the second try, it will log a warning about it.  If it fails
both times, it will log an error.

Add test cases to confirm it behaves as expected.

9 years agoutil: New flag UNQUOTE_UNESCAPE_RELAX for unquote_first_word
Filipe Brandenburger [Wed, 3 Jun 2015 04:08:24 +0000 (21:08 -0700)] 
util: New flag UNQUOTE_UNESCAPE_RELAX for unquote_first_word

The new flag UNQUOTE_UNESCAPE_RELAX preserves unrecognized escape
sequences verbatim in unquote_first_word, either when it's a trailing
backslash (similar to UNQUOTE_RELAX, but in this case keep the extra
backslash in the output) or in the middle of a sequence string.

Add unit test cases to ensure the new flag works as expected and to
prevent regressions from being introduced.

Tested with a follow up commit converting config_parse_exec() to start
using unquote_first_word, in which case this flags makes it possible to
preserve unrecognized escape sequences.

Relevant bug: https://bugs.freedesktop.org/show_bug.cgi?id=90794

9 years agoutil: Refactor common cunescape block in unquote_first_word
Filipe Brandenburger [Sat, 30 May 2015 06:42:47 +0000 (23:42 -0700)] 
util: Refactor common cunescape block in unquote_first_word

9 years agoMerge pull request #267 from phomes/master
Tom Gundersen [Wed, 17 Jun 2015 18:04:17 +0000 (20:04 +0200)] 
Merge pull request #267 from phomes/master

sd-dhcp-client: readd deleted error check

9 years agoMerge pull request #265 from smcv/logind-runtimedir-race-write-earlier
Lennart Poettering [Wed, 17 Jun 2015 17:52:04 +0000 (19:52 +0200)] 
Merge pull request #265 from smcv/logind-runtimedir-race-write-earlier

logind: save /run/systemd/users/UID before starting user@.service

9 years agoman: libudev - add description to udev_device_* 269/head
Tom Gundersen [Wed, 17 Jun 2015 17:48:15 +0000 (19:48 +0200)] 
man: libudev - add description to udev_device_*

9 years agobus: fix installing DRIVER matches on kdbus
David Herrmann [Wed, 17 Jun 2015 17:15:58 +0000 (19:15 +0200)] 
bus: fix installing DRIVER matches on kdbus

In kdbus we still have to support org.freedesktop.DBus matches even though
there is no real bus driver. The reason is that bus-control.c turns
NameOwnerChanged matches into proper kdbus matches. If we drop DRIVER
matches early, we will never match on name-changes for kdbus.

Two ways to fix this:

 1) Install DRIVER matches on kdbus (which is the simple way our and which
    is what this patch does).

 2) Properly fix the scope-detection to let NameOwnerChanged matches
    through (or better: block anything with Member!=NameOwnerChanged).

9 years agosd-dhcp-client: readd deleted error check 267/head
Thomas Hindoe Paaboel Andersen [Wed, 17 Jun 2015 16:09:31 +0000 (18:09 +0200)] 
sd-dhcp-client: readd deleted error check

Seems to have been removed by mistake in:
9021bb9f935c93b516b10c88db2a212a9e3a8140

9 years agoMerge pull request #262 from teg/udev-dup-fds-2
Kay Sievers [Wed, 17 Jun 2015 17:06:49 +0000 (19:06 +0200)] 
Merge pull request #262 from teg/udev-dup-fds-2

udevd: daemon - connect /dev/null to std{in,out,err} in debug mode

9 years agoMerge pull request #263 from kaysievers/wip
Kay Sievers [Wed, 17 Jun 2015 17:06:13 +0000 (19:06 +0200)] 
Merge pull request #263 from kaysievers/wip

turn kdbus support into a runtime option

9 years agowatchdog: Don't require WDIOC_SETOPTIONS/WDIOS_ENABLECARD
Jean Delvare [Wed, 17 Jun 2015 16:57:39 +0000 (18:57 +0200)] 
watchdog: Don't require WDIOC_SETOPTIONS/WDIOS_ENABLECARD

Not all watchdog drivers implement WDIOC_SETOPTIONS. Drivers which do
not implement it have their device always enabled. So it's fine to
report an error if WDIOS_DISABLECARD is passed and the ioctl is not
implemented, however failing when WDIOS_ENABLECARD is passed and the
ioctl is not implemented is not good: if the device was already
enabled then WDIOS_ENABLECARD was a no-op and wasn't needed in the
first place. So we can just ignore the error and continue.

9 years agoMerge pull request #259 from poettering/logind-label-fix
Tom Gundersen [Wed, 17 Jun 2015 17:02:19 +0000 (19:02 +0200)] 
Merge pull request #259 from poettering/logind-label-fix

logind: apply selinux label to XDG_RUNTIME_DIR

9 years agoudevd: daemon - connect /dev/null to std{in,out,err} in debug mode 262/head
Tom Gundersen [Wed, 17 Jun 2015 15:43:11 +0000 (17:43 +0200)] 
udevd: daemon - connect /dev/null to std{in,out,err} in debug mode

This is essentially a revert of 5c67cf2 and fixes issue #190.

9 years agologind: save /run/systemd/users/UID before starting user@.service 265/head
Simon McVittie [Wed, 17 Jun 2015 15:45:49 +0000 (16:45 +0100)] 
logind: save /run/systemd/users/UID before starting user@.service

Previously, this had a race condition during a user's first login.
Some component calls CreateSession (most likely by a PAM service
other than 'systemd-user' running pam_systemd), with the following
results:

- logind:
  * create the user's XDG_RUNTIME_DIR
  * tell pid 1 to create user-UID.slice
  * tell pid 1 to start user@UID.service

Then these two processes race:

- logind:
  * save information including XDG_RUNTIME_DIR to /run/systemd/users/UID

- the subprocess of pid 1 responsible for user@service:
  * start a 'systemd-user' PAM session, which reads XDG_RUNTIME_DIR
    and puts it in the environment
  * run systemd --user, which requires XDG_RUNTIME_DIR in the
    environment

If logind wins the race, which usually happens, everything is fine;
but if the subprocesses of pid 1 win the race, which can happen
under load, then systemd --user exits unsuccessfully.

To avoid this race, we have to write out /run/systemd/users/UID
even though the service has not "officially" started yet;
previously this did an early-return without saving anything.
Record its state as OPENING in this case.

Bug: https://github.com/systemd/systemd/issues/232
Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
9 years agoturn kdbus support into a runtime option 263/head
Kay Sievers [Wed, 17 Jun 2015 14:37:55 +0000 (16:37 +0200)] 
turn kdbus support into a runtime option

./configure --enable/disable-kdbus can be used to set the default
behavior regarding kdbus.

If no kdbus kernel support is available, dbus-dameon will be used.

With --enable-kdbus, the kernel command line option "kdbus=0" can
be used to disable kdbus.

With --disable-kdbus, the kernel command line option "kdbus=1" is
required to enable kdbus support.

9 years agoMerge pull request #256 from kaysievers/wip
Kay Sievers [Wed, 17 Jun 2015 15:18:10 +0000 (17:18 +0200)] 
Merge pull request #256 from kaysievers/wip

libsystemd: remove list of symbols to export only in the future

9 years agoMerge pull request #260 from mbiebl/systemshutdowndir-substitution
Lennart Poettering [Wed, 17 Jun 2015 15:11:42 +0000 (17:11 +0200)] 
Merge pull request #260 from mbiebl/systemshutdowndir-substitution

build-sys: restore systemshutdowndir substitution

9 years agobuild-sys: restore systemshutdowndir substitution 260/head
Michael Biebl [Wed, 17 Jun 2015 14:36:46 +0000 (16:36 +0200)] 
build-sys: restore systemshutdowndir substitution

This was accidentally removed in d6b07ef.

9 years agologind: apply selinux label to XDG_RUNTIME_DIR 259/head
Lennart Poettering [Wed, 17 Jun 2015 14:29:03 +0000 (16:29 +0200)] 
logind: apply selinux label to XDG_RUNTIME_DIR

As discussed in #257: we should ensure the selinux label is correctly
applied to each user's XDG_RUNTIME_DIR.

9 years agolibsystemd: remove list of symbols to export only in the future 256/head
Kay Sievers [Wed, 17 Jun 2015 13:53:56 +0000 (15:53 +0200)] 
libsystemd: remove list of symbols to export only in the future

9 years agoMerge pull request #254 from poettering/external-displays2
David Herrmann [Wed, 17 Jun 2015 13:56:04 +0000 (15:56 +0200)] 
Merge pull request #254 from poettering/external-displays2

logind: rework display counting when detecting whether the system is …

9 years agoMerge pull request #221 from utezduyar/man-cgtop-explain-max-cpu
Lennart Poettering [Wed, 17 Jun 2015 13:48:31 +0000 (15:48 +0200)] 
Merge pull request #221 from utezduyar/man-cgtop-explain-max-cpu

man: explain max CPU load on cgtop

9 years agotmpfiles: only root-owned aquota.* files are special
Zbigniew Jędrzejewski-Szmek [Sat, 13 Jun 2015 17:14:37 +0000 (13:14 -0400)] 
tmpfiles: only root-owned aquota.* files are special

Fixes #188.

9 years agoMerge pull request #253 from dvdhrm/libudev-man
Kay Sievers [Wed, 17 Jun 2015 13:44:02 +0000 (15:44 +0200)] 
Merge pull request #253 from dvdhrm/libudev-man

man: add libudev man-pages (skeletons)

9 years agologind: rework display counting when detecting whether the system is docked 254/head
Lennart Poettering [Tue, 16 Jun 2015 22:24:05 +0000 (00:24 +0200)] 
logind: rework display counting when detecting whether the system is docked

Previously, we'd just count connected displays, and if there was 2 or
more we assumed a "docked" state.

With this change we now:

- Only count external displays, ignore internal ones (which we detect by
  checking the connector name against a whitelist of known external plug
  types)

- We ignore connectors which are explicitly disabled

- We then compare the count with >= 1 rather than >= 2 as before

This new logic has the benefit that systems that disconnect the internal
display when the lid is closed are better supported. Also, explicitly
disabled ports do not confuse the algorithm anymore.

This new algorithm has been suggested here:

http://lists.freedesktop.org/archives/intel-gfx/2015-June/068821.html

This also makes two functions static, that are not used outside of their
.c files.

9 years agoupdate TODO
Lennart Poettering [Wed, 17 Jun 2015 13:40:37 +0000 (15:40 +0200)] 
update TODO

9 years agoman: add libudev man-pages (skeletons) 253/head
David Herrmann [Wed, 17 Jun 2015 13:11:11 +0000 (15:11 +0200)] 
man: add libudev man-pages (skeletons)

This adds man-pages for most of the libudev symbols we export. Similar
symbols are grouped together in a single man-page, with respective links
added. All man-pages contain the full skeleton including NAME, SYNOPSIS,
RETURN VALUE and SEE ALSO. However, most of them still lack the
DESCRIPTION part. This should be copied from the gtkdoc descriptions in
src/libudev/libudev*.[ch]. Any help is welcome! (the whole skeleton is
already done, so it's really just about the prose-part of the man-pages to
be written).

Missing from the man-pages are the following parts:
  - udev_set_log_fn()
  - udev_[gs]et_log_priority()
  - udev_[gs]et_userdata()
  - udev_list_entry_foreach()
  - udev_device_get_seqnum()
  - udev_device_get_usec_since_initialized()
  - udev_util_encode_string()
These are considered legacy, afaik. If not, please feel free to add them
now!

Furthermore, udev-hwdb and udev-queue are not documented at all (for the
same reasons).

9 years agoMerge pull request #176 from filbranden/test_cgroup_mask1
Lennart Poettering [Wed, 17 Jun 2015 13:19:12 +0000 (15:19 +0200)] 
Merge pull request #176 from filbranden/test_cgroup_mask1

test-cgroup-mask: unit_get_sibling_mask ignores cgroup_supported

9 years agoMerge pull request #251 from zonque/signal
Kay Sievers [Wed, 17 Jun 2015 13:09:32 +0000 (15:09 +0200)] 
Merge pull request #251 from zonque/signal

core: execute: fix regression in pam_setup()

9 years agocore: execute: fix regression in pam_setup() 251/head
Daniel Mack [Wed, 17 Jun 2015 12:31:49 +0000 (14:31 +0200)] 
core: execute: fix regression in pam_setup()

Commit 72c0a2c25 ("everywhere: port everything to sigprocmask_many()
and friends") reworked code tree-wide to use the new sigprocmask_many()
helper. In this, it caused a regression in pam_setup, because it
dropped a line to initialize the 'ss' signal mask which is later used
in sigwait().

While at it, move the variable declaration to an inner scope.

9 years agozsh-completion: _loginctl - general bug fixes 248/head
Eric Cook [Wed, 17 Jun 2015 11:41:24 +0000 (07:41 -0400)] 
zsh-completion: _loginctl - general bug fixes

1) the iterator `fun' has an local scope. after running the completer,
it will no longer be defined.

2) use _describe instead of calling compadd. Using compadd without
calling _description or something similar before, restricts the
user's ability to customize what is presented to them.
zstyle ':completion:*' format 'Completing %d'
  - now displays an header showing what is being completed.
zstyle ':completion::complete:loginctl-*::users' users user1 user2
  - allows the user to manually specify which users is offered
zstyle :completion::complete:loginctl-kill-user:\* \
ignored-patterns '(100<0-4>|user1)'
  - selectively ignore some users when completing loginctl kill-user
    <tab>
Sessions, UIDs now have descriptions when selecting them.

3) removed the call to _loginctl_all_seats in _loginctl_attach(), since
_loginctl_seats calls it a second time, right before adding matches.
There isn't a noticeable difference doing this.

9 years agoman: explain max CPU load on cgtop 221/head
Umut Tezduyar Lindskog [Tue, 16 Jun 2015 06:46:25 +0000 (08:46 +0200)] 
man: explain max CPU load on cgtop

9 years agoMerge pull request #246 from smcv/xpg-not-xdg
Lennart Poettering [Wed, 17 Jun 2015 11:08:15 +0000 (13:08 +0200)] 
Merge pull request #246 from smcv/xpg-not-xdg

Stop talking about the "XDG" version of basename()

9 years agoMerge pull request #245 from poettering/always-sdbus-man-pages
Daniel Mack [Wed, 17 Jun 2015 10:55:18 +0000 (12:55 +0200)] 
Merge pull request #245 from poettering/always-sdbus-man-pages

man: always build sd-bus man pages, even if kdbus is disabled

9 years agoman: always build sd-bus man pages, even if kdbus is disabled 245/head
Lennart Poettering [Wed, 17 Jun 2015 10:32:33 +0000 (12:32 +0200)] 
man: always build sd-bus man pages, even if kdbus is disabled

After all, we now moved sd-bus out of the kdbus conditional, hence the
man pages should be too.

9 years agoStop talking about the "XDG" version of basename() 246/head
Simon McVittie [Wed, 17 Jun 2015 10:23:46 +0000 (11:23 +0100)] 
Stop talking about the "XDG" version of basename()

XDG refers to X Desktop Group, a former name for freedesktop.org.
This group is responsible for specifications like basedirs,
.desktop files and icon naming, but as far as I know, it has never
tried to redefine basename().

I think these references were meant to say XPG (X/Open Portability
Guide), a precursor of POSIX. POSIX is better-known and less easily
confused with XDG, and is how the basename(3) man page describes
the libgen.h version of basename().

The other version of basename() is glibc-specific and is described
in basename(3) as "the GNU version"; specifically mention that
version, to disambiguate.

9 years agoMerge pull request #244 from poettering/sdbus-suppress-local
David Herrmann [Wed, 17 Jun 2015 10:20:03 +0000 (12:20 +0200)] 
Merge pull request #244 from poettering/sdbus-suppress-local

sd-bus: suppress installing local bus matches server side

9 years agosd-bus: suppress installing local bus matches server side 244/head
Lennart Poettering [Wed, 17 Jun 2015 09:42:39 +0000 (11:42 +0200)] 
sd-bus: suppress installing local bus matches server side

Matches that can only match against messages from the
org.freedesktop.DBus.Local service (or the local interfaces or path)
should never be installed server side, suppress them hence.

Similar, on kdbus matches that can only match driver messages shouldn't
be passed to the kernel.

9 years agoMerge pull request #241 from jsynacek/doc-fix
Daniel Mack [Wed, 17 Jun 2015 08:56:21 +0000 (10:56 +0200)] 
Merge pull request #241 from jsynacek/doc-fix

doc: improve readability in journald.conf.5

9 years agoMerge pull request #239 from dvdhrm/event-assert
Lennart Poettering [Wed, 17 Jun 2015 08:37:43 +0000 (10:37 +0200)] 
Merge pull request #239 from dvdhrm/event-assert

sd-event: make errors on EPOLL_CTL_DEL pseudo-fatal

9 years agodoc: improve readability in journald.conf.5 241/head
Jan Synacek [Wed, 17 Jun 2015 08:12:09 +0000 (10:12 +0200)] 
doc: improve readability in journald.conf.5

9 years agosd-event: make errors on EPOLL_CTL_DEL pseudo-fatal 239/head
David Herrmann [Tue, 16 Jun 2015 23:15:09 +0000 (01:15 +0200)] 
sd-event: make errors on EPOLL_CTL_DEL pseudo-fatal

If we call EPOLL_CTL_DEL, we *REALLY* expect the file-descriptor to be
present in that given epoll-set. We actually track such state via our
s->io.registered flag, so it better be true.

Make sure if that's not true, we treat it similar to assert_return() (ie.,
print a loud warning).

9 years agoMerge pull request #240 from kaysievers/wip
Kay Sievers [Wed, 17 Jun 2015 05:55:26 +0000 (07:55 +0200)] 
Merge pull request #240 from kaysievers/wip

build-sys: hide magic section variables from exported symbols

9 years agoMerge pull request #238 from dvdhrm/udev-epoll
Kay Sievers [Wed, 17 Jun 2015 05:32:25 +0000 (07:32 +0200)] 
Merge pull request #238 from dvdhrm/udev-epoll

udev: don't close FDs before dropping them from epoll

9 years agobuild-sys: hide magic section variables from exported symbols 240/head
Kay Sievers [Wed, 17 Jun 2015 05:23:31 +0000 (07:23 +0200)] 
build-sys: hide magic section variables from exported symbols

https://github.com/systemd/systemd/issues/234

9 years agoudev: don't close FDs before dropping them from epoll 238/head
David Herrmann [Tue, 16 Jun 2015 21:36:36 +0000 (23:36 +0200)] 
udev: don't close FDs before dropping them from epoll

Make sure we never close fds before we drop their related event-source.
This will cause horrible disruptions if the fd-num is re-used by someone
else. Under normal conditions, this should not cause any problems as the
close() will drop the fd from the epoll-set automatically. However, this
changes if you have any child processes with a copy of that fd.

This fixes issue #163.

Background:
        If you create an epoll-set via epoll_create() (lets call it 'EFD')
        you can add file-descriptors to it to watch for events. Whenever
        you call EPOLL_CTL_ADD on a file-descriptor you want to watch, the
        kernel looks up the attached "struct file" pointer, that this FD
        refers to. This combination of the FD-number and the "struct file"
        pointer is used as key to link it into the epoll-set (EFD).

        This means, if you duplicate your file-descriptor, you can watch
        this file-descriptor, too (because the duplicate will have a
        different FD-number, hence, the combination of FD-number and
        "struct file" is different as before).

        If you want to stop watching an FD, you use EPOLL_CTL_DEL and pass
        the FD to the kernel. The kernel again looks up your
        file-descriptor in your FD-table to find the linked "struct file".
        This FD-number and "struct file" combination is then dropped from
        the epoll-set (EFD).

        Last, but not least: If you close a file-descriptor that is linked
        to an epoll-set, the kernel does *NOTHING* regarding the
        epoll-set. This is a vital observation! Because this means, your
        epoll_wait() calls will still return the metadata you used to
        watch/subscribe your file-descriptor to events.
        There is one exception to this rule: If the file-descriptor that
        you just close()ed was the last FD that referred to the underlying
        "struct file", then _all_ epoll-set watches/subscriptions are
        destroyed. Hence, if you never dup()ed your FD, then a simple
        close() will also unsubscribe it from any epoll-set.

        With this in mind, lets look at fork():
                Assume you have an epoll-set (EFD) and a bunch of FDs
                subscribed to events on that EFD. If you now call fork(),
                the new process gets a copy of your file-descriptor table.
                This means, the whole table is copied and the "struct
                file" reference of each FD is increased by 1. It is
                important to notice that the FD-numbers in the child are
                exactly the same as in the parent (eg., FD #5 in the child
                refers to the same "struct file" as FD #5 in the parent).

                This means, if the child calls EPOLL_CTL_DEL on an FD, the
                kernel will look up the linked "struct file" and drop the
                FD-number and "struct file" combination from the epoll-set
                (EFD). However, this will effectively drop the
                subscription that was installed by the parent.

                To sum up: even though the child gets a duplicate of the
                EFD and all FDs, the subscriptions in the EFD are *NOT*
                duplicated!

Now, with this in mind, lets look at what udevd does:
        Udevd has a bunch of file-descriptors that it watches in its
        sd-event main-loop. Whenever a uevent is received, the event is
        dispatched on its workers. If no suitable worker is present, a new
        worker is fork()ed to handle the event. Inside of this worker, we
        try to free all resources we inherited. However, the fork() call
        is done from a call-stack that is never rewinded. Therefore, this
        call stack might own references that it drops once it is left.
        Those references we cannot deduce from the fork()'ed process;
        effectively causing us to leak objects in the worker (eg., the
        call to sd_event_dispatch() that dispatched our uevent owns a
        reference to the sd_event object it used; and drops it again once
        the function is left).

        (Another example is udev_monitor_ref() for each 'worker' that is
         also inherited by all children; thus keeping the udev-monitor and
         the uevent-fd alive in all children (which is the real cause for
         bug #163))

        (The extreme variant is sd_event_source_unref(), which explicitly
         keeps event-sources alive, if they're currently dispatched,
         knowing that the dispatcher will free the event once done. But
         if the dispatcher is in the parent, the child will never ever
         free that object, thus leaking it)

        This is usually not an issue. However, if such an object has a
        file-descriptor embedded, this FD is left open and never closed in
        the child.

In manager_exit(), if we now destroy an object (i.e., close its embedded
file-descriptor) before we destroy its related sd_event_source, then
sd-event will not be able to drop the FD from the epoll-set (EFD). This
is, because the FD is no longer valid at the time we call EPOLL_CTL_DEL.
Hence, the kernel cannot figure out the linked "struct file" and thus
cannot remove the FD-number plus "struct file" combination; effectively
leaving the subscription in the epoll-set.
Since we leak the uevent-fd in the children, they retain a copy of the FD
pointing to the same "struct file". Thus, the EFD-subscription are not
automatically removed by close() (as described above). Therefore, the main
daemon will still get its metadata back on epoll_watch() whenever an event
occurs (even though it already freed the metadata). This then causes the
free-after-use bug described in #163.

This patch fixes the order in which we destruct objects and related
sd-event-sources. Some open questions remain:

 * Why does source_io_unregister() not warn on EPOLL_CTL_DEL failures?
   This really needs to be turned into an assert_return().

 * udevd really should not leak file-descriptors into its children. Fixing
   this would *not* have prevented this bug, though (since the child-setup
   is still async).
   It's non-trivial to fix this, though. The stack-context of the caller
   cannot be rewinded, so we cannot figure out temporary refs. Maybe it's
   time to exec() the udev-workers?

 * Why does the kernel not copy FD-subscriptions across fork()?
   Or at least drop subscriptions if you close() your FD (it uses the
   FD-number as key, so it better subscribe to it)?
   Or it better used
         FD+"struct file_table*"+"struct file*"
   as key to not allow the childen to share the subscription table..
   *sigh*
   Seems like we have to live with that API forever.

9 years agoMerge pull request #231 from tixxdz/nspawn-userns-fixes-2
Lennart Poettering [Tue, 16 Jun 2015 17:50:59 +0000 (19:50 +0200)] 
Merge pull request #231 from tixxdz/nspawn-userns-fixes-2

nspawn: check if kernel supports userns as early as possible

9 years agonspawn: check if kernel supports userns as early as possible 231/head
Djalal Harouni [Tue, 16 Jun 2015 16:30:45 +0000 (17:30 +0100)] 
nspawn: check if kernel supports userns as early as possible

If the kernel do not support user namespace then one of the children
created by nspawn parent will fail at clone(CLONE_NEWUSER) with the
generic error EINVAL and without logging the error. At the same time
the parent may also try to setup the user namespace and will fail with
another error.

To improve this, check if the kernel supports user namespace as early
as possible.

9 years agoMerge pull request #228 from teg/tmpfiles-btrfs-notdir
Lennart Poettering [Tue, 16 Jun 2015 16:00:28 +0000 (18:00 +0200)] 
Merge pull request #228 from teg/tmpfiles-btrfs-notdir

tmpfiles: silently ignore failed removal of btrfs submount from non-dir

9 years agotmpfiles: silently ignore failed removal of btrfs submount from non-dir 228/head
Tom Gundersen [Tue, 16 Jun 2015 14:22:16 +0000 (16:22 +0200)] 
tmpfiles: silently ignore failed removal of btrfs submount from non-dir

This fixes:
Jun 16 16:00:20 tomegun-x2402 systemd-tmpfiles[233]: rm_rf(/var/lib/machines/.#fedora.lck): Not a directory
Jun 16 16:00:20 tomegun-x2402 systemd-tmpfiles[233]: rm_rf(/var/lib/machines/.#Fedora-Cloud-Base-20141203-21.x86_64.raw.lck): Not a directory

9 years agoMerge pull request #197 from dvdhrm/hashmap
Michal Schmidt [Tue, 16 Jun 2015 12:44:43 +0000 (14:44 +0200)] 
Merge pull request #197 from dvdhrm/hashmap

hashmap: fix iterators to not skip entries

9 years agoMerge pull request #223 from ronnychevalier/rc/warning_va_start
David Herrmann [Tue, 16 Jun 2015 11:04:41 +0000 (13:04 +0200)] 
Merge pull request #223 from ronnychevalier/rc/warning_va_start

signal-util: fix incorrect argument of va_start

9 years agoMerge pull request #222 from utezduyar/mem-leak-on-bus-error
Daniel Mack [Tue, 16 Jun 2015 10:02:56 +0000 (12:02 +0200)] 
Merge pull request #222 from utezduyar/mem-leak-on-bus-error

sd-bus: use proper cleanup macro

9 years agosignal-util: fix incorrect argument of va_start 223/head
Ronny Chevalier [Tue, 16 Jun 2015 09:38:06 +0000 (11:38 +0200)] 
signal-util: fix incorrect argument of va_start

The last argument of the function before the vargs is "old" not "how".

warning: second parameter of ‘va_start’ not last named argument

9 years agosd-bus: use proper cleanup macro 220/head 222/head
Umut Tezduyar Lindskog [Tue, 16 Jun 2015 09:20:10 +0000 (11:20 +0200)] 
sd-bus: use proper cleanup macro

9 years agoMerge pull request #218 from poettering/dual-timestamp-null
Daniel Mack [Tue, 16 Jun 2015 09:03:27 +0000 (11:03 +0200)] 
Merge pull request #218 from poettering/dual-timestamp-null

everywhere: actually make use of DUAL_TIMESTAMP_NULL macro

9 years agoMerge pull request #219 from poettering/logind-docked
Daniel Mack [Tue, 16 Jun 2015 09:02:40 +0000 (11:02 +0200)] 
Merge pull request #219 from poettering/logind-docked

logind: expose "Docked" bool as property on the bus

9 years agologind: cast close() call to (void)
Lennart Poettering [Mon, 15 Jun 2015 23:55:20 +0000 (01:55 +0200)] 
logind: cast close() call to (void)

9 years agologind: expose "Docked" bool as property on the bus 219/head
Lennart Poettering [Mon, 15 Jun 2015 23:02:02 +0000 (01:02 +0200)] 
logind: expose "Docked" bool as property on the bus

We know the state anyway, let's expose it in the bus. It's useful for
debugging at least, but it might be useful for DEs too.

9 years agoeverywhere: actually make use of DUAL_TIMESTAMP_NULL macro 218/head
Lennart Poettering [Mon, 15 Jun 2015 23:08:12 +0000 (01:08 +0200)] 
everywhere: actually make use of DUAL_TIMESTAMP_NULL macro

Let's use it as initializer where appropriate.

9 years agoupdate TODO
Lennart Poettering [Mon, 15 Jun 2015 23:02:52 +0000 (01:02 +0200)] 
update TODO

9 years agoMerge pull request #214 from poettering/signal-rework-2
Lennart Poettering [Mon, 15 Jun 2015 18:35:18 +0000 (20:35 +0200)] 
Merge pull request #214 from poettering/signal-rework-2

everywhere: port everything to sigprocmask_many() and friends

9 years agoMerge pull request #212 from poettering/gc-machine-snapshots
Lennart Poettering [Mon, 15 Jun 2015 18:33:35 +0000 (20:33 +0200)] 
Merge pull request #212 from poettering/gc-machine-snapshots

automatically remove old machine shapshots at boot

9 years agoeverywhere: port everything to sigprocmask_many() and friends 214/head
Lennart Poettering [Mon, 15 Jun 2015 18:13:23 +0000 (20:13 +0200)] 
everywhere: port everything to sigprocmask_many() and friends

This ports a lot of manual code over to sigprocmask_many() and friends.

Also, we now consistly check for sigprocmask() failures with
assert_se(), since the call cannot realistically fail unless there's a
programming error.

Also encloses a few sd_event_add_signal() calls with (void) when we
ignore the return values for it knowingly.

9 years agoMerge pull request #209 from crrodriguez/master
Kay Sievers [Mon, 15 Jun 2015 17:56:23 +0000 (19:56 +0200)] 
Merge pull request #209 from crrodriguez/master

buildsys: missing SECCOMP_CFLAGS in various places

9 years agotmpfiles: automatically remove old machine snapshots at boot 212/head
Lennart Poettering [Mon, 15 Jun 2015 17:24:43 +0000 (19:24 +0200)] 
tmpfiles: automatically remove old machine snapshots at boot

Remove old temporary snapshots, but only at boot. Ideally we'd have
"self-destroying" btrfs snapshots that go away if the last last
reference to it does. To mimic a scheme like this at least remove the
old snapshots on fresh boots, where we know they cannot be referenced
anymore. Note that we actually remove all temporary files in
/var/lib/machines/ at boot, which should be safe since the directory has
defined semantics. In the root directory (where systemd-nspawn
--ephemeral places snapshots) we are more strict, to avoid removing
unrelated temporary files.

This also splits out nspawn/container related tmpfiles bits into a new
tmpfiles snippet to systemd-nspawn.conf

9 years agotmpfiles: make sure "R" lines also remove subvolumes
Lennart Poettering [Mon, 15 Jun 2015 17:11:15 +0000 (19:11 +0200)] 
tmpfiles: make sure "R" lines also remove subvolumes

9 years agoutil: when creating temporary file names, allow including extra id string in it
Lennart Poettering [Mon, 15 Jun 2015 17:09:02 +0000 (19:09 +0200)] 
util: when creating temporary file names, allow including extra id string in it

This adds a "char *extra" parameter to tempfn_xxxxxx(), tempfn_random(),
tempfn_ranomd_child(). If non-NULL this string is included in the middle
of the newly created file name. This is useful for being able to
distuingish the kind of temporary file when we see one.

This also adds tests for the three call.

For now, we don't make use of this at all, but port all users over.

9 years agobuildsys: missing SECCOMP_CFLAGS in various places 209/head
Cristian Rodríguez [Mon, 15 Jun 2015 16:36:51 +0000 (13:36 -0300)] 
buildsys: missing SECCOMP_CFLAGS in various places

libcore, systemd and nspawn fail to build when seccomp headers
are not in the include path.

9 years agoMerge pull request #208 from poettering/btrfs-rec-snapshot
Lennart Poettering [Mon, 15 Jun 2015 16:11:48 +0000 (18:11 +0200)] 
Merge pull request #208 from poettering/btrfs-rec-snapshot

btrfs-util: when snapshotting make sure we don't descent into subvolu…

9 years agobtrfs-util: when snapshotting make sure we don't descent into subvolumes we just... 208/head
Lennart Poettering [Mon, 15 Jun 2015 15:53:50 +0000 (17:53 +0200)] 
btrfs-util: when snapshotting make sure we don't descent into subvolumes we just created

We already had a safety check in place that we don't end up descending
to the original subvolume again, but we also should avoid descending in
the newly created one.

This is particularly important if we make a snapshot below its source,
like we do in "systemd-nspawn --ephemeral -D /".

Closes https://bugs.freedesktop.org/show_bug.cgi?id=90803