platform/upstream/systemd.git
9 years agohwdb: add Logitech M570 trackball
Peter Hutterer [Fri, 8 May 2015 01:56:45 +0000 (11:56 +1000)]
hwdb: add Logitech M570 trackball

http://www.logitech.com/en-us/product/wireless-trackball-m570#specs
https://bugzilla.redhat.com/show_bug.cgi?id=1217881

9 years agojson: fix a mem leak
Thomas Hindoe Paaboel Andersen [Tue, 19 May 2015 21:19:29 +0000 (23:19 +0200)]
json: fix a mem leak

9 years agoupdate TODO
Lennart Poettering [Tue, 19 May 2015 17:54:39 +0000 (19:54 +0200)]
update TODO

9 years agounits: make sure systemd-nspawn@.slice instances are actually located in machine...
Lennart Poettering [Tue, 19 May 2015 17:47:52 +0000 (19:47 +0200)]
units: make sure systemd-nspawn@.slice instances are actually located in machine.slice

https://plus.google.com/112206451048767236518/posts/SYAueyXHeEX

9 years agocore: don't consider boot-up finished if we are still reloading
Lennart Poettering [Tue, 19 May 2015 17:09:03 +0000 (19:09 +0200)]
core: don't consider boot-up finished if we are still reloading

http://lists.freedesktop.org/archives/systemd-devel/2015-May/032025.html

9 years agopull-dkr: fix memleak
Thomas Hindoe Paaboel Andersen [Tue, 19 May 2015 17:23:53 +0000 (19:23 +0200)]
pull-dkr: fix memleak

9 years agoimport/pull-dkr: V2 image specification and manifest support
Pavel Odvody [Tue, 19 May 2015 14:30:33 +0000 (16:30 +0200)]
import/pull-dkr: V2 image specification and manifest support

The maximum number of layers changed to 127, as in Dkr.

9 years agoimport/pull: Tag replaced with reference
Pavel Odvody [Tue, 19 May 2015 14:30:04 +0000 (16:30 +0200)]
import/pull: Tag replaced with reference

Default pull version set to V2

9 years agotest/test-json: Tests for the tokenizer bugfix and the DOM parser
Pavel Odvody [Tue, 19 May 2015 14:29:53 +0000 (16:29 +0200)]
test/test-json: Tests for the tokenizer bugfix and the DOM parser

The DOM parser tests are accompanied with structure and element analysis

9 years agoshared/json: Added DOM-like JSON parser
Pavel Odvody [Tue, 19 May 2015 14:29:42 +0000 (16:29 +0200)]
shared/json: Added DOM-like JSON parser

This makes working with complexly structured documents easy
and more reliable as the parser is not susceptible to
element re-ordering.

Also fixes a bug when the tokenizer would choke after reading
a number.

9 years agoshared/import-util: Tag renamed to reference
Pavel Odvody [Tue, 19 May 2015 14:29:29 +0000 (16:29 +0200)]
shared/import-util: Tag renamed to reference

Added (sha256) digest validation function

9 years agocore: when propagating restart requests due to deps, downgrade restart to try-restart
Lennart Poettering [Tue, 19 May 2015 16:13:22 +0000 (18:13 +0200)]
core: when propagating restart requests due to deps, downgrade restart to try-restart

Previously, if a service A depended on a service B via Requires=, and A
was not running and B restarted this would trigger a start of A as well,
since the restart was propagated as restart independently of the state
of A.

This patch ensures that a restart of B would be propagated as a
try-restart to A, thus not changing its state if it isn't up.

http://lists.freedesktop.org/archives/systemd-devel/2015-May/032061.html

9 years agodhcp-identifier: fix for unaligned write
Tom Gundersen [Tue, 19 May 2015 15:47:19 +0000 (17:47 +0200)]
dhcp-identifier: fix for unaligned write

Reported by Michael Olbrich.

9 years agocore: sd_bus_error() already checks for NULL, no need to duplicate check
Lennart Poettering [Tue, 19 May 2015 15:56:44 +0000 (17:56 +0200)]
core: sd_bus_error() already checks for NULL, no need to duplicate check

9 years agocore: reinstate propagation of stop/restart jobs via RequsiteOf dependencies
Lennart Poettering [Tue, 19 May 2015 15:40:50 +0000 (17:40 +0200)]
core: reinstate propagation of stop/restart jobs via RequsiteOf dependencies

This reverts the primary effect of be7d9ff730cb88d7c6a869dd5c47754c78ceaef2.

After all Requisite= should be close to Requires=, without the one
exception that it doesn't pull in dependencies on start. However,
reverse deps on stop/restart should be treated the same way as for
Restart=, and this is already documented in the man page, hence stick to
it.

http://lists.freedesktop.org/archives/systemd-devel/2015-May/032049.html

9 years agoutil: fix typo
Jan Synacek [Tue, 19 May 2015 12:26:09 +0000 (14:26 +0200)]
util: fix typo

9 years agomount: properly check for mounts currently in /proc/self/mountinfo
Lennart Poettering [Tue, 19 May 2015 15:19:27 +0000 (17:19 +0200)]
mount: properly check for mounts currently in /proc/self/mountinfo

http://lists.freedesktop.org/archives/systemd-devel/2015-May/032059.html

9 years agoUpdate TODO
Lennart Poettering [Tue, 19 May 2015 14:57:33 +0000 (16:57 +0200)]
Update TODO

9 years agounit: drop support for pre-v44 job serialization
Lennart Poettering [Tue, 19 May 2015 14:41:14 +0000 (16:41 +0200)]
unit: drop support for pre-v44 job serialization

No distro ships that old systemd versions anyway, hence let's drop
support for live-upgrades for them. Offline updates are still supported.
And live-upgrades will only lose the job queue, hence basically still
work...

9 years agocore: also enforce ratelimiter if we stop a unit due to BindsTo=
Lennart Poettering [Tue, 19 May 2015 14:23:14 +0000 (16:23 +0200)]
core: also enforce ratelimiter if we stop a unit due to BindsTo=

This extends on bea355dac94e82697aa98e25d80ee4248263bf92, and extends
the ratelimiter to not only be used for StopWhenUnneeded=1 units but
also for units that have BindsTo= on a unit that is dead.

http://lists.freedesktop.org/archives/systemd-devel/2015-April/030224.html

9 years agocore: use bitfield where possible
Lennart Poettering [Tue, 19 May 2015 14:03:01 +0000 (16:03 +0200)]
core: use bitfield where possible

9 years agoupdate TODO
Lennart Poettering [Tue, 19 May 2015 14:02:51 +0000 (16:02 +0200)]
update TODO

9 years agocore: enforce a ratelimiter when stopping units due to StopWhenUnneeded=1
Lennart Poettering [Tue, 19 May 2015 14:00:24 +0000 (16:00 +0200)]
core: enforce a ratelimiter when stopping units due to StopWhenUnneeded=1

Otherwise we might end up in an endless stop loop.

http://lists.freedesktop.org/archives/systemd-devel/2015-April/030224.html

9 years agounit: fix unit_check_unneeded() dependency iteration
Lennart Poettering [Tue, 19 May 2015 13:42:03 +0000 (15:42 +0200)]
unit: fix unit_check_unneeded() dependency iteration

Fixes a regression introduced in be7d9ff730cb88d7c6a869dd5c47754c78ceaef2.

9 years agomount: don't claim a device is gone from /proc/self/mountinfo before it is gone from...
Lennart Poettering [Tue, 19 May 2015 11:50:36 +0000 (13:50 +0200)]
mount: don't claim a device is gone from /proc/self/mountinfo before it is gone from *all* lines

Devices might be referenced by multiple mount points in
/proc/self/mountinfo, hence we should consider them unmounted only after
they disappeared from all lines, not just from one.

http://lists.freedesktop.org/archives/systemd-devel/2015-May/032026.html

9 years agodevice: create units with intended "found" value
Martin Pitt [Sun, 17 May 2015 13:07:47 +0000 (15:07 +0200)]
device: create units with intended "found" value

Change device_found_node() to also create a .device unit if a device is not
known by udev; this is the case for "tentative" devices picked up by mountinfo
(DEVICE_FOUND_MOUNT).  With that we can record the "found" attribute on the
unit.

Change device_setup_unit() to also accept a NULL udev_device, and don't
add the extra udev information in that case.

Previously device_found_node() would not create a .device unit, and
unit_add_node_link() would then create a "dead" stub one via
manager_load_unit(), so we lost the "found" attribute and unmounted everything
from that device.

https://launchpad.net/bugs/1444402
http://lists.freedesktop.org/archives/systemd-devel/2015-May/031658.html

9 years agohostname: Allow comments in /etc/hostname
Martin Pitt [Tue, 19 May 2015 05:49:56 +0000 (07:49 +0200)]
hostname: Allow comments in /etc/hostname

The hostname(1) tool allows comments in /etc/hostname. Introduce a new
read_hostname_config() in hostname-util which reads a hostname configuration
file like /etc/hostname, strips out comments, whitespace, and cleans the
hostname. Use it in hostname-setup.c and hostnamed and remove duplicated code.

Update hostname manpage. Add tests.

https://launchpad.net/bugs/1053048

9 years agocore: fix OOM checks in dbus-unit
Thomas Hindoe Paaboel Andersen [Tue, 19 May 2015 04:45:52 +0000 (06:45 +0200)]
core: fix OOM checks in dbus-unit

CID#1299014

9 years agotest-hashmap: fix an assert
Thomas Hindoe Paaboel Andersen [Tue, 19 May 2015 04:33:54 +0000 (06:33 +0200)]
test-hashmap: fix an assert

CID#1299016

9 years agoman: explain UseDomains a bit more
Zbigniew Jędrzejewski-Szmek [Tue, 19 May 2015 02:34:07 +0000 (22:34 -0400)]
man: explain UseDomains a bit more

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

9 years agoupdate TODO
Lennart Poettering [Mon, 18 May 2015 23:32:40 +0000 (01:32 +0200)]
update TODO

9 years agoupdate TODO
Lennart Poettering [Mon, 18 May 2015 23:27:33 +0000 (01:27 +0200)]
update TODO

9 years agocore: introduce seperate reverse dependencies for Requires= and Requisite=
Lennart Poettering [Mon, 18 May 2015 23:24:28 +0000 (01:24 +0200)]
core: introduce seperate reverse dependencies for Requires= and Requisite=

This allows us to ensure that Requisite= dependencies never cause
propagation between units, while Requires= dependencies might.

http://lists.freedesktop.org/archives/systemd-devel/2015-May/031742.html

9 years agojournalctl: unify how we free boot id lists a bit
Lennart Poettering [Mon, 18 May 2015 22:35:02 +0000 (00:35 +0200)]
journalctl: unify how we free boot id lists a bit

Instead of use LIST_FOREACH_SAFE, just use the same, seperate destructor
everywhere.

9 years agojournalctl: clean up how we log errors
Lennart Poettering [Mon, 18 May 2015 22:25:45 +0000 (00:25 +0200)]
journalctl: clean up how we log errors

All functions should either log the errors they run into, or only return
them in which case the caller should log them.

Make sure this rule is followed, so that each error is logged precisely
once, and neither never, nor more than once.

9 years agojournalctl: rename boot_id_t to BootId
Lennart Poettering [Mon, 18 May 2015 22:24:27 +0000 (00:24 +0200)]
journalctl: rename boot_id_t to BootId

So far we tried to reserve the _t suffix to types we use like a value in
contrast to types we use as objects, hence let's do this in journalctl
too.

9 years agojournalctl: lstat() should suffice if we call canonicalize_file_name() first
Lennart Poettering [Mon, 18 May 2015 22:22:56 +0000 (00:22 +0200)]
journalctl: lstat() should suffice if we call canonicalize_file_name() first

9 years agojournalctl: free all command line argument objects
Lennart Poettering [Mon, 18 May 2015 21:54:05 +0000 (23:54 +0200)]
journalctl: free all command line argument objects

let's try to be valgrind clean

9 years agojournalctl: only have a single exit path from main()
Lennart Poettering [Mon, 18 May 2015 21:50:34 +0000 (23:50 +0200)]
journalctl: only have a single exit path from main()

That way we can be sure we execute the destructors properly, and can be
valgrind-clean.

9 years agojournalctl: Improve boot ID lookup
Jan Janssen [Fri, 1 May 2015 13:15:16 +0000 (15:15 +0200)]
journalctl: Improve boot ID lookup

This method should greatly improve offset based lookup, by simply jumping
from one boot to the next boot. It starts at the journal head to get the
a boot ID, makes a _BOOT_ID match and then comes from the opposite
journal direction (tail) to get to the end that boot. After flushing the matches
and advancing the journal from that exact position, we arrive at the start
of next boot. Rinse and repeat.

This is faster than the old method of aggregating the full boot listing just
so we can jump to a specific boot, which can be a real pain on big journals
just for a mere "-b -1" case.

As an additional benefit --list-boots should improve slightly too, because
it does less seeking.

Note that there can be a change in boot order with this lookup method
because it will use the order of boots in the journal, not the realtime stamp
stored in them. That's arguably better, though.
Another deficiency is that it will get confused with boots interleaving in the
journal, therefore, it will refuse operation in --merge, --file and --directory mode.

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

9 years agoudevd: main - use _exit() when daemonizing
Tom Gundersen [Mon, 18 May 2015 15:21:03 +0000 (17:21 +0200)]
udevd: main - use _exit() when daemonizing

Makes it a bit clearer what is going on, rather than jumping to the end of main().

No functional change.

9 years agoudevd: main - reshuffle
Tom Gundersen [Mon, 18 May 2015 15:19:38 +0000 (17:19 +0200)]
udevd: main - reshuffle

First parse config, then sanitize environment before donig any further setup.

No functional change.

9 years agoudevd: rename on_reque_{exit,reload} to on_sig{term,chld}
Tom Gundersen [Mon, 18 May 2015 15:18:46 +0000 (17:18 +0200)]
udevd: rename on_reque_{exit,reload} to on_sig{term,chld}

No functional change.

9 years agoudevd: introduce on_event_timeout{,_warning}
Tom Gundersen [Mon, 18 May 2015 15:17:07 +0000 (17:17 +0200)]
udevd: introduce on_event_timeout{,_warning}

This uses kill_and_sigcont() instead of kill(), otherwise no functional change.

9 years agoudevd: process all SIGCHLD events every time the handler is invoked
Tom Gundersen [Mon, 18 May 2015 15:07:04 +0000 (17:07 +0200)]
udevd: process all SIGCHLD events every time the handler is invoked

We were returning rather than continuing in some cases. The intention
was always to fully process all pending events before returning
from the SIGCHLD handler. Restore this behaviour.

9 years agoudevd: init/exit the builtins in manager_new/free
Tom Gundersen [Wed, 13 May 2015 09:39:45 +0000 (11:39 +0200)]
udevd: init/exit the builtins in manager_new/free

No functional change.

9 years agoudevd: move file descriptors to Manager
Tom Gundersen [Tue, 12 May 2015 19:16:47 +0000 (21:16 +0200)]
udevd: move file descriptors to Manager

No functional change.

9 years agoresolved: allow DnsAnswer objects with no space for RRs
Lennart Poettering [Mon, 18 May 2015 21:38:47 +0000 (23:38 +0200)]
resolved: allow DnsAnswer objects with no space for RRs

They might be created as result of merged answer sets, hence accept
them.

http://lists.freedesktop.org/archives/systemd-devel/2015-April/030834.html

9 years agoresolved: fix crash when shutting down
Lennart Poettering [Mon, 18 May 2015 21:23:17 +0000 (23:23 +0200)]
resolved: fix crash when shutting down

Reported by Cristian Rodríguez

http://lists.freedesktop.org/archives/systemd-devel/2015-May/031626.html

9 years agonspawn: close extra fds before execing init
Alban Crequy [Mon, 18 May 2015 14:45:30 +0000 (16:45 +0200)]
nspawn: close extra fds before execing init

When systemd-nspawn gets exec*()ed, it inherits the followings file
descriptors:
- 0, 1, 2: stdin, stdout, stderr
- SD_LISTEN_FDS_START, ... SD_LISTEN_FDS_START+LISTEN_FDS: file
  descriptors passed by the system manager (useful for socket
  activation). They are passed to the child process (process leader).
- extra lock fd: rkt passes a locked directory as an extra fd, so the
  directory remains locked as long as the container is alive.

systemd-nspawn used to close all open fds except 0, 1, 2 and the
SD_LISTEN_FDS_START..SD_LISTEN_FDS_START+LISTEN_FDS. This patch delays
the close just before the exec so the nspawn process (parent) keeps the
extra fds open.

This patch supersedes the previous attempt ("cloexec extraneous fds"):
http://lists.freedesktop.org/archives/systemd-devel/2015-May/031608.html

9 years agoata_id: drop spurious space
Lennart Poettering [Mon, 18 May 2015 19:52:26 +0000 (21:52 +0200)]
ata_id: drop spurious space

9 years agoCODING_STYLE: document that we should avoid kernel types like u32
Lennart Poettering [Mon, 18 May 2015 16:47:22 +0000 (18:47 +0200)]
CODING_STYLE: document that we should avoid kernel types like u32

9 years agocore: Private*/Protect* options with RootDirectory
Alban Crequy [Mon, 18 May 2015 10:20:28 +0000 (12:20 +0200)]
core: Private*/Protect* options with RootDirectory

When a service is chrooted with the option RootDirectory=/opt/..., then
the options PrivateDevices, PrivateTmp, ProtectHome, ProtectSystem must
mount the directories under $RootDirectory/{dev,tmp,home,usr,boot}.

The test-ns tool can test setup_namespace() with and without chroot:
 $ sudo TEST_NS_PROJECTS=/home/lennart/projects ./test-ns
 $ sudo TEST_NS_CHROOT=/home/alban/debian-tree TEST_NS_PROJECTS=/home/alban/debian-tree/home/alban/Documents ./test-ns

9 years agokmod-setup: conditionalize kmod autoloading properly
Lennart Poettering [Mon, 18 May 2015 15:27:37 +0000 (17:27 +0200)]
kmod-setup: conditionalize kmod autoloading properly

Load kdbus.ko only if we are built with kdbus, and load ip_tables.ko
only if we are built with iptables support.

9 years agoutil: split all hostname related calls into hostname-util.c
Lennart Poettering [Mon, 18 May 2015 15:10:07 +0000 (17:10 +0200)]
util: split all hostname related calls into hostname-util.c

9 years agoREADME: document that we prefer if CONFIG_CHECKPOINT_RESTORE is turned on, for the...
Lennart Poettering [Mon, 18 May 2015 14:35:24 +0000 (16:35 +0200)]
README: document that we prefer if CONFIG_CHECKPOINT_RESTORE is turned on, for the kcmp() syscall

9 years agofstab-generator: add x-systemd.requires and x-systemd.requires-mounts-for
Karel Zak [Mon, 18 May 2015 10:30:37 +0000 (12:30 +0200)]
fstab-generator: add x-systemd.requires and x-systemd.requires-mounts-for

Currently we have no way how to specify dependencies between fstab
entries (or another units) in the /etc/fstab. It means that users are
forced to bypass fstab and write .mount units manually.

The patch introduces new systemd fstab options:

x-systemd.requires=<PATH>

 - to specify dependence an another mount (PATH is translated to unit name)

x-systemd.requires=<UNIT>

 - to specify dependence on arbitrary UNIT

x-systemd.requires-mounts-for=<PATH ...>

 - to specify dependence on another paths, implemented by
   RequiresMountsFor=. The option may be specified more than once.

For example two bind mounts where B depends on A:

 /mnt/test/A    /mnt/test/A     none    bind,defaults
 /mnt/test/A    /mnt/test/B     none    bind,x-systemd.requires=/mnt/test/A

More complex example with overlay FS where one mount point depends on
"low" and "upper" directories:

 /dev/sdc1   /mnt/low    ext4     defaults
 /dev/sdc2   /mnt/high   ext4     defaults
 overlay     /mnt/merged overlay  lowerdir=/mnt/low,upperdir=/mnt/high/data,workdir=/mnt/high/work,x-systemd.requires-mounts-for=/mnt/low,x-systemd.requires-mounts-for=mnt/high

https://bugzilla.redhat.com/show_bug.cgi?id=812826
https://bugzilla.redhat.com/show_bug.cgi?id=1164334

9 years agobuildsys: actually install 70-pointingstick.hwdb
Mantas Mikulėnas [Mon, 18 May 2015 08:18:10 +0000 (11:18 +0300)]
buildsys: actually install 70-pointingstick.hwdb

9 years agohwdb: Add trackpoint sensitivity setting for Thinkpad X230 tablet
Hans de Goede [Mon, 18 May 2015 07:54:00 +0000 (09:54 +0200)]
hwdb: Add trackpoint sensitivity setting for Thinkpad X230 tablet

This model needs the trackpoint sensitivity to be boosted to not be too slow
to be usable, see: https://bugzilla.redhat.com/show_bug.cgi?id=1200717

9 years agozsh-completion: make the arrays _sys_active_units, _sys_startable_units and _sys_rest...
Eric Cook [Mon, 18 May 2015 05:02:43 +0000 (01:02 -0400)]
zsh-completion: make the arrays _sys_active_units, _sys_startable_units and _sys_restartable_units local to the completer.

9 years agozsh-completion: removing more pointless forks
Eric Cook [Mon, 18 May 2015 07:19:59 +0000 (03:19 -0400)]
zsh-completion: removing more pointless forks

I seem to have forgot about _systemctl_active_units().

9 years agozsh-completion: less forking in _systemctl_failed_units() and make the array `_sys_fa...
Eric Cook [Mon, 18 May 2015 05:02:41 +0000 (01:02 -0400)]
zsh-completion: less forking in _systemctl_failed_units() and make the array `_sys_failed_units' local to the completer.

9 years agozsh-completion: less forking in _systemctl_get_template_names()
Eric Cook [Mon, 18 May 2015 05:02:40 +0000 (01:02 -0400)]
zsh-completion: less forking in _systemctl_get_template_names()

9 years agozsh-completion: actually complete template names for subcommands enable, reenable...
Eric Cook [Mon, 18 May 2015 05:02:39 +0000 (01:02 -0400)]
zsh-completion: actually complete template names for subcommands enable, reenable and disable.

compadd's -a option treats non-option arguments as arrays. So
$(_systemctl_get_template_names) expands to some words that aren't
legal array names. Even if there were, they would be empty; thus adding
nothing.

deduplicated a few functions too.

9 years agozsh-completion: actually run _filter_units_by_property when creating the arrays _sys_...
Eric Cook [Mon, 18 May 2015 05:02:38 +0000 (01:02 -0400)]
zsh-completion: actually run _filter_units_by_property when creating the arrays _sys_(re|)startable_units

9 years agoUse "new" --job-mode= option in more places
Zbigniew Jędrzejewski-Szmek [Mon, 18 May 2015 04:58:24 +0000 (00:58 -0400)]
Use "new" --job-mode= option in more places

--irreversible/--ignore-dependencies/--fail are deprececated since 4dc5b821ae737914499119e29811fc3346e3d97c.

Also add shell completions for --jobs-mode.

9 years agoload-fragment: put quotes around iffy rvalue
Zbigniew Jędrzejewski-Szmek [Sat, 16 May 2015 22:21:01 +0000 (18:21 -0400)]
load-fragment: put quotes around iffy rvalue

9 years agoUse fflush_and_check() in more places
Zbigniew Jędrzejewski-Szmek [Sat, 16 May 2015 22:11:12 +0000 (18:11 -0400)]
Use fflush_and_check() in more places

9 years agobuildsys: Remove X_SERVER from AM_CPPFLAGS
Cristian Rodríguez [Sat, 16 May 2015 15:58:15 +0000 (12:58 -0300)]
buildsys: Remove X_SERVER from AM_CPPFLAGS

It is a leftover from multi-seat-x wrapper which is long
gone.

9 years agozsh-completion: add missing completions for systemd-nspawn
Lukas Rusak [Wed, 22 Apr 2015 18:07:39 +0000 (11:07 -0700)]
zsh-completion: add missing completions for systemd-nspawn

9 years agozsh-completion: update -M completion for systemd-analyze
Lukas Rusak [Wed, 22 Apr 2015 18:07:38 +0000 (11:07 -0700)]
zsh-completion: update -M completion for systemd-analyze

9 years agozsh-completion: add missing completions for machinectl
Lukas Rusak [Wed, 22 Apr 2015 22:52:59 +0000 (15:52 -0700)]
zsh-completion: add missing completions for machinectl

Appologies, I'm still getting used to this mailing list thing and using git send-email

9 years agoudevd: queue - update queue state when events are queued/freed
Tom Gundersen [Sat, 16 May 2015 08:14:20 +0000 (10:14 +0200)]
udevd: queue - update queue state when events are queued/freed

This way it is more obvious that the queue flag file is always
up-to-date. Moreover, we only have to touch/unlink it when the
first/last event is allocated/freed.

9 years agoudevd: on_worker - distinguish between EINTR and EAGAIN
Tom Gundersen [Fri, 15 May 2015 23:12:21 +0000 (01:12 +0200)]
udevd: on_worker - distinguish between EINTR and EAGAIN

EAGAIN means there are no more messages to read, so give up. EINTR means we got interrupted
reading a message, so try again.

9 years agoudevd: worker - use loop_write() rather than send()
Tom Gundersen [Fri, 15 May 2015 09:41:36 +0000 (11:41 +0200)]
udevd: worker - use loop_write() rather than send()

When notifying the main daemon about event completion, make sure the message is sent
successfully, and not interrupted.

9 years agoutil: loop_write - accept 0-length message
Tom Gundersen [Fri, 15 May 2015 23:07:45 +0000 (01:07 +0200)]
util: loop_write - accept 0-length message

write() can send empty messages, so make sure loop_write() can do the same.

9 years agoudevd: net - fix leak in .link config
Tom Gundersen [Fri, 15 May 2015 21:59:28 +0000 (23:59 +0200)]
udevd: net - fix leak in .link config

Path, Driver and Type are now strv rather than strings, so free them properly.

9 years agoudev-ctrl: make _unref() always return NULL
Tom Gundersen [Thu, 14 May 2015 13:30:52 +0000 (15:30 +0200)]
udev-ctrl: make _unref() always return NULL

Bring this in line with the rest of the codebase.

9 years agounits: make networkd pull in its own .busname unit
Tom Gundersen [Fri, 15 May 2015 20:59:24 +0000 (22:59 +0200)]
units: make networkd pull in its own .busname unit

The daemon requires the busname unit to operate (on kdbus systems),
since it contains the policy that allows it to acquire its service
name.

This fixes https://bugs.freedesktop.org/show_bug.cgi?id=90287

9 years agotmpfiles: use lstat() instead of stat() when checking whether a file system object...
Lennart Poettering [Fri, 15 May 2015 19:48:20 +0000 (21:48 +0200)]
tmpfiles: use lstat() instead of stat() when checking whether a file system object already exists

9 years agotmpfiles: don't fail if we cannot create a subvolume because a file system is read...
Lennart Poettering [Fri, 15 May 2015 19:47:22 +0000 (21:47 +0200)]
tmpfiles: don't fail if we cannot create a subvolume because a file system is read-only but a dir already exists anyway

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

9 years agoCODING_STYLE: document that EXIT_FAILURE and EXIT_SUCCESS should be used
Lennart Poettering [Fri, 15 May 2015 19:34:14 +0000 (21:34 +0200)]
CODING_STYLE: document that EXIT_FAILURE and EXIT_SUCCESS should be used

9 years agoCODING_STYLE: document best practices when initializing structs
Lennart Poettering [Fri, 15 May 2015 19:06:40 +0000 (21:06 +0200)]
CODING_STYLE: document best practices when initializing structs

9 years agocoredump: make sure we vacuum by default
Lennart Poettering [Fri, 15 May 2015 18:56:55 +0000 (20:56 +0200)]
coredump: make sure we vacuum by default

Only if both keep_free and max_use are actually 0 we can shortcut things
and avoid vacuuming. If either are positive or -1 we need to execute the
vacuuming.

http://lists.freedesktop.org/archives/systemd-devel/2015-April/031382.html

9 years agosocket-util: socket_address_parse() should not log errors on its own
Lennart Poettering [Fri, 15 May 2015 18:15:59 +0000 (20:15 +0200)]
socket-util: socket_address_parse() should not log errors on its own

Given that socket_address_parse() is mostly a "library" call it
shouldn't log on its own, but leave that to its caller.

This patch removes logging from the call in case IPv6 is not available
but and IPv6 address shall be parsed. Instead a new call
socket_address_parse_and_warn() is introduced which first invokes
socket_address_parse() and then logs if necessary.

This should fix "make check" on ipv6-less kernels:

http://lists.freedesktop.org/archives/systemd-devel/2015-April/031385.html

9 years agocore: Fix assertion with empty Exec*= paths
Martin Pitt [Thu, 14 May 2015 07:06:40 +0000 (09:06 +0200)]
core: Fix assertion with empty Exec*= paths

An Exec*= line with whitespace after modifiers, like

  ExecStart=- /bin/true

is considered to have an empty command path. This is as specified, but causes
systemd to crash with

  Assertion 'skip < l' failed at ../src/core/load-fragment.c:607, function config_parse_exec(). Aborting.
  Aborted (core dumped)

Fix this by logging an error instead and ignoring the invalid line.

Add corresponding test cases. Also add a test case for a completely empty value
which resets the command list.

https://launchpad.net/bugs/1454173

9 years agotimedate: fix memory leak in timedated
Cristian Rodríguez [Fri, 15 May 2015 16:26:18 +0000 (13:26 -0300)]
timedate: fix memory leak in timedated

$ /usr/lib/systemd/systemd-timedated (wait until auto-exit)

=================================================================
==396==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 928 byte(s) in 1 object(s) allocated from:
    #0 0x7f782f788db1 in __interceptor_calloc (/usr/lib64/libasan.so.2+0x96db1)
    #1 0x562a83ae60cf in bus_message_from_header src/libsystemd/sd-bus/bus-message.c:480
    #2 0x562a83ae6f5a in bus_message_from_malloc src/libsystemd/sd-bus/bus-message.c:576
    #3 0x562a83ad3cad in bus_socket_make_message src/libsystemd/sd-bus/bus-socket.c:915
    #4 0x562a83ad4cfc in bus_socket_read_message src/libsystemd/sd-bus/bus-socket.c:1051
    #5 0x562a83ab733f in bus_read_message src/libsystemd/sd-bus/sd-bus.c:1647
    #6 0x562a83ab98ea in sd_bus_call src/libsystemd/sd-bus/sd-bus.c:2038
    #7 0x562a83b1f46d in sd_bus_call_method src/libsystemd/sd-bus/bus-convenience.c:94
    #8 0x562a83aab3e1 in context_read_ntp src/timedate/timedated.c:192
    #9 0x562a83aae1af in main src/timedate/timedated.c:730
    #10 0x7f782eb238c4 in __libc_start_main (/lib64/libc.so.6+0x208c4)

Indirect leak of 77 byte(s) in 1 object(s) allocated from:
    #0 0x7f782f788f6a in realloc (/usr/lib64/libasan.so.2+0x96f6a)
    #1 0x562a83ad418a in bus_socket_read_message src/libsystemd/sd-bus/bus-socket.c:963
    #2 0x562a83ab733f in bus_read_message src/libsystemd/sd-bus/sd-bus.c:1647
    #3 0x562a83ab98ea in sd_bus_call src/libsystemd/sd-bus/sd-bus.c:2038
    #4 0x562a83b1f46d in sd_bus_call_method src/libsystemd/sd-bus/bus-convenience.c:94
    #5 0x562a83aab3e1 in context_read_ntp src/timedate/timedated.c:192
    #6 0x562a83aae1af in main src/timedate/timedated.c:730
    #7 0x7f782eb238c4 in __libc_start_main (/lib64/libc.so.6+0x208c4)

Indirect leak of 2 byte(s) in 1 object(s) allocated from:
    #0 0x7f782f75493f in strdup (/usr/lib64/libasan.so.2+0x6293f)
    #1 0x562a83b0229b in bus_message_parse_fields src/libsystemd/sd-bus/bus-message.c:5382
    #2 0x562a83ae7290 in bus_message_from_malloc src/libsystemd/sd-bus/bus-message.c:601
    #3 0x562a83ad3cad in bus_socket_make_message src/libsystemd/sd-bus/bus-socket.c:915
    #4 0x562a83ad4cfc in bus_socket_read_message src/libsystemd/sd-bus/bus-socket.c:1051
    #5 0x562a83ab733f in bus_read_message src/libsystemd/sd-bus/sd-bus.c:1647
    #6 0x562a83ab98ea in sd_bus_call src/libsystemd/sd-bus/sd-bus.c:2038
    #7 0x562a83b1f46d in sd_bus_call_method src/libsystemd/sd-bus/bus-convenience.c:94
    #8 0x562a83aab3e1 in context_read_ntp src/timedate/timedated.c:192
    #9 0x562a83aae1af in main src/timedate/timedated.c:730
    #10 0x7f782eb238c4 in __libc_start_main (/lib64/libc.so.6+0x208c4)

SUMMARY: AddressSanitizer: 1007 byte(s) leaked in 3 allocation(s).

This is due to missing  _cleanup_bus_message_unref_ in context_read_ntp()

9 years ago.gitignore: add GNU GLOBAL files
Łukasz Stelmach [Fri, 15 May 2015 15:12:16 +0000 (17:12 +0200)]
.gitignore: add GNU GLOBAL files

9 years agogenerator: use fflush_and_check() where appropriate
Lennart Poettering [Fri, 15 May 2015 15:06:59 +0000 (17:06 +0200)]
generator: use fflush_and_check() where appropriate

9 years agocore: don't consider umask for SocketMode=
Davide Bettio [Fri, 15 May 2015 14:36:28 +0000 (16:36 +0200)]
core: don't consider umask for SocketMode=

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

9 years agoCODING_STYLE: document alloca() DONTS
Lennart Poettering [Fri, 15 May 2015 13:47:37 +0000 (15:47 +0200)]
CODING_STYLE: document alloca() DONTS

9 years agocore: Execute first boot presets in an enable-only preset-mode.
Dimitri John Ledkov [Fri, 15 May 2015 10:44:22 +0000 (11:44 +0100)]
core: Execute first boot presets in an enable-only preset-mode.

This means any existing enabled units well be preserved and no
pre-created symlinks will be removed. This is done on first boot, when
the assumption is that /etc is not populated at all (no machine-id
setup). For minimal containers that gives a significant first boot
speed up, approximately ~20ms / ~16% in my trials.

9 years agonetworkd: don't try to turn on ipv6 forwarding if kernel lacks IPv6 support
Lennart Poettering [Fri, 15 May 2015 10:20:36 +0000 (12:20 +0200)]
networkd: don't try to turn on ipv6 forwarding if kernel lacks IPv6 support

http://lists.freedesktop.org/archives/systemd-devel/2015-May/031598.html

9 years agoman: IPMasquerade only implies IPForward=ipv4
Benedikt Morbach [Sun, 10 May 2015 18:32:14 +0000 (20:32 +0200)]
man: IPMasquerade only implies IPForward=ipv4

at least that's what the code does.

9 years agonetworkd: don't touch global forwarding setting
Benedikt Morbach [Sun, 10 May 2015 18:52:40 +0000 (20:52 +0200)]
networkd: don't touch global forwarding setting

This reverts commit 43c6d5abacaebf813845934ec8d5e5ee3c431854
(and a small part of 4046d8361c55c80ab8577aea52523b9e6eab0d0c)

It turns out we don't actually need to set the global ip_forward setting.
The only relevant setting is the one on each interface.

What the global toggle actually does is switch forwarding on/off for all
currently present interfaces and change the default for new ones.

That means that by setting the global ip_forward we

  - Introduce a race condition, because if the interface with IPForward=yes
    is brought up after one with IPForward=no, both will have forwarding
    enabled, because the global switch turns it on for all interfaces.
    If the other interface comes up first networkd correctly sets forward=0
    and it doesn't get overridden.

  - Change the forwarding setting for interfaces that networkd is not
    configured to touch, even if the user disabled forwarding via sysctl,
    either globally or per-interface

As forwarding works fine without this, as long as all relevant interfacest
individually set IPForward=yes:  just drop it

This means that non-networkd interfaces use the global default while
networkd interfaces default to off if IPForward isn't given.

9 years agosystemctl: introduce --now for enable, disable and mask
Jan Synacek [Fri, 15 May 2015 07:54:10 +0000 (09:54 +0200)]
systemctl: introduce --now for enable, disable and mask

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

9 years agonspawn: allow access to device nodes listed in --bind= and --bind-ro= switches
Stefan Junker [Thu, 14 May 2015 20:51:05 +0000 (22:51 +0200)]
nspawn: allow access to device nodes listed in --bind= and --bind-ro= switches

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

9 years agotest-bus-chat: various modernizations
Lennart Poettering [Thu, 14 May 2015 20:41:19 +0000 (22:41 +0200)]
test-bus-chat: various modernizations

9 years agosd-bus: fix memory leak in test-bus-chat
Cristian Rodríguez [Sun, 10 May 2015 01:14:09 +0000 (22:14 -0300)]
sd-bus: fix memory leak in test-bus-chat

Building with address sanitizer enabled on GCC 5.1.x a memory leak
is reported because we never close the bus, fix it by using
cleanup variable attribute.

9 years agounits: fix typo in systemd-resolved.service
Lennart Poettering [Thu, 14 May 2015 20:32:35 +0000 (22:32 +0200)]
units: fix typo in systemd-resolved.service

There's no network.service unit, we actually mean network.target here.

Reported by Fco. Eduardo Ramírez.