Commit graph

27288 commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 605405c6cc tree-wide: drop NULL sentinel from strjoin
This makes strjoin and strjoina more similar and avoids the useless final
argument.

spatch -I . -I ./src -I ./src/basic -I ./src/basic -I ./src/shared -I ./src/shared -I ./src/network -I ./src/locale -I ./src/login -I ./src/journal -I ./src/journal -I ./src/timedate -I ./src/timesync -I ./src/nspawn -I ./src/resolve -I ./src/resolve -I ./src/systemd -I ./src/core -I ./src/core -I ./src/libudev -I ./src/udev -I ./src/udev/net -I ./src/udev -I ./src/libsystemd/sd-bus -I ./src/libsystemd/sd-event -I ./src/libsystemd/sd-login -I ./src/libsystemd/sd-netlink -I ./src/libsystemd/sd-network -I ./src/libsystemd/sd-hwdb -I ./src/libsystemd/sd-device -I ./src/libsystemd/sd-id128 -I ./src/libsystemd-network --sp-file coccinelle/strjoin.cocci --in-place $(git ls-files src/*.c)

git grep -e '\bstrjoin\b.*NULL' -l|xargs sed -i -r 's/strjoin\((.*), NULL\)/strjoin(\1)/'

This might have missed a few cases (spatch has a really hard time dealing
with _cleanup_ macros), but that's no big issue, they can always be fixed
later.
2016-10-23 11:43:27 -04:00
Zbigniew Jędrzejewski-Szmek 3c5d7c978c nss-systemd: remove useless define
We always define those two in configure, so no need to provide a fallback.
2016-10-22 18:39:08 -04:00
Zbigniew Jędrzejewski-Szmek fb4650aa34 tree-wide: use startswith return value to avoid hardcoded offset
I think it's an antipattern to have to count the number of bytes in
the prefix by hand. We should do this automatically to avoid wasting
programmer time, and possible errors. I didn't any offsets that were
wrong, so this change is mostly to make future development easier.
2016-10-22 16:15:46 -04:00
Zbigniew Jędrzejewski-Szmek d7f69e16f1 tree-wide: make parse_proc_cmdline() strip "rd." prefix automatically
This stripping is contolled by a new boolean parameter. When the parameter
is true, it means that the caller does not care about the distinction between
initrd and real root, and wants to act on both rd-dot-prefixed and unprefixed
parameters in the initramfs, and only on the unprefixed parameters in real
root. If the parameter is false, behaviour is the same as before.

Changes by caller:
log.c (systemd.log_*):      changed to accept rd-dot-prefix params
pid1:                       no change, custom logic
cryptsetup-generator:       no change, still accepts rd-dot-prefix params
debug-generator:            no change, does not accept rd-dot-prefix params
fsck:                       changed to accept rd-dot-prefix params
fstab-generator:            no change, custom logic
gpt-auto-generator:         no change, custom logic
hibernate-resume-generator: no change, does not accept rd-dot-prefix params
journald:                   changed to accept rd-dot-prefix params
modules-load:               no change, still accepts rd-dot-prefix params
quote-check:                no change, does not accept rd-dot-prefix params
udevd:                      no change, still accepts rd-dot-prefix params

I added support for "rd." params in the three cases where I think it's
useful: logging, fsck options, journald forwarding options.
2016-10-22 16:08:55 -04:00
Zbigniew Jędrzejewski-Szmek 92e724670f udev: change kernel commandline option parsing
- do not crash if an option without value is specified on the kernel command
  line, e.g. "udev.log-priority" :P
- simplify the code a bit
- warn about unknown "udev.*" options — this should make it easier to spot
  typos and reduce user confusion
2016-10-22 14:42:12 -04:00
Zbigniew Jędrzejewski-Szmek 5707ecf300 journald: convert journald to use parse_proc_cmdline
This makes journald use the common option parsing functionality.
One behavioural change is implemented:
"systemd.journald.forward_to_syslog" is now equivalent to
"systemd.journald.forward_to_syslog=1".
I think it's nicer to use this way.
2016-10-22 14:38:10 -04:00
Zbigniew Jędrzejewski-Szmek 96287a4916 tree-wide: allow state to be passed through to parse_proc_cmdline_item
No functional change.
2016-10-22 14:24:52 -04:00
Umut Tezduyar Lindskog 863a5610c7 journald: systemd.journald.max_level_* kernel command line options (#4427)
The log forward levels can be configured through kernel command line.
2016-10-21 19:40:55 -04:00
Djalal Harouni e49e2c25f3 NEWS: option is ProtectKernelTunables not ProtectedKernelTunables (#4451) 2016-10-21 18:43:36 -04:00
Daniel Mack 5138a901b1 Merge pull request #4447 from poettering/oneshotassertfix
core: if the start command vanishes during runtime don't hit an assert
2016-10-21 16:22:15 +02:00
Djalal Harouni 6fa441140e NEWS: update NEWS about ProtectKernelModules= option (#4445) 2016-10-21 13:25:23 +02:00
Lennart Poettering e0972037fb Merge pull request #4419 from keszybz/install-specifiers
Fix expansion of %i, %u, %N, %n install specifiers
2016-10-21 13:24:09 +02:00
Peter Hutterer 9107a33777 hwdb: add MOUSE_WHEEL_CLICK_COUNT for non-integer click angles (#4440)
MOUSE_WHEEL_CLICK_ANGLE has been an integer, and at least libinput (probably
the only user) parses it as strict integer. For backwards compatibility, we
cannot change it to a decimal number now.

Add a new property to list the number of clicks for a full 360 degree
rotation, to be specified in addition to the old click angle property. Clients
can prefer the new one where available and calculate the decimal value to
whatever precision they want.
2016-10-21 12:31:32 +02:00
Evgeny Vereshchagin 0a12bb1eaa sysusers: fix memleak (#4443)
Fixes:
Oct 20 09:10:49 systemd-sysusers[144]: Direct leak of 20 byte(s) in 1 object(s) allocated from:
Oct 20 09:10:49 systemd-sysusers[144]:     #0 0x7f3565a13e60 in malloc (/lib64/libasan.so.3+0xc6e60)
Oct 20 09:10:49 systemd-sysusers[144]:     #1 0x7f3565526bd0 in malloc_multiply src/basic/alloc-util.h:70
Oct 20 09:10:49 systemd-sysusers[144]:     #2 0x7f356552cb55 in tempfn_xxxxxx src/basic/fileio.c:1116
Oct 20 09:10:49 systemd-sysusers[144]:     #3 0x7f356552c4f0 in fopen_temporary src/basic/fileio.c:1042
Oct 20 09:10:49 systemd-sysusers[144]:     #4 0x7f356555e00e in fopen_temporary_label src/basic/fileio-label.c:63
Oct 20 09:10:49 systemd-sysusers[144]:     #5 0x56197c4a1766 in make_backup src/sysusers/sysusers.c:209
Oct 20 09:10:49 systemd-sysusers[144]:     #6 0x56197c4a6335 in write_files src/sysusers/sysusers.c:710
Oct 20 09:10:49 systemd-sysusers[144]:     #7 0x56197c4ae571 in main src/sysusers/sysusers.c:1817
Oct 20 09:10:49 systemd-sysusers[144]:     #8 0x7f3564dee730 in __libc_start_main (/lib64/libc.so.6+0x20730)
2016-10-21 12:30:45 +02:00
Lennart Poettering 47fffb3530 core: if the start command vanishes during runtime don't hit an assert
This can happen when the configuration is changed and reloaded while we are
executing a service. Let's not hit an assert in this case.

Fixes: #4444
2016-10-21 12:27:46 +02:00
Zbigniew Jędrzejewski-Szmek 75e2089581 Revert "add networkd dbus lease info" (#4435) 2016-10-21 08:17:16 +02:00
Zbigniew Jędrzejewski-Szmek 24597ee0e6 nspawn, NEWS: add missing "s" in --private-users-chown (#4438) 2016-10-21 06:03:26 +03:00
Evgeny Vereshchagin d9b8ea5448 sysusers: fix memleak (#4430)
Fixes:
```
==28075== 64 bytes in 1 blocks are definitely lost in loss record 2 of 3
==28075==    at 0x4C2BAEE: malloc (vg_replace_malloc.c:298)
==28075==    by 0x4C2DCA1: realloc (vg_replace_malloc.c:785)
==28075==    by 0x4ED40A2: greedy_realloc (alloc-util.c:57)
==28075==    by 0x4E90F87: extract_first_word (extract-word.c:78)
==28075==    by 0x4E91813: extract_many_words (extract-word.c:270)
==28075==    by 0x10FE93: parse_line (sysusers.c:1325)
==28075==    by 0x11198B: read_config_file (sysusers.c:1640)
==28075==    by 0x111EB8: main (sysusers.c:1773)
==28075==
```
2016-10-20 14:23:32 -04:00
Lennart Poettering dfc7f59430 update-utmp: let's use STR_IN_SET() where it is pretty 2016-10-20 14:22:43 -04:00
Lennart Poettering 84a4e6608d logind: don't hit assert when we try to free NULL manager object
Fixes: #4431
2016-10-20 14:22:43 -04:00
Lennart Poettering b5bdbcd5ba update TODO 2016-10-20 14:22:43 -04:00
Lennart Poettering 411e869f49 sysctl: run sysctl service if /proc/sys/net is writable (#4425)
This simply changes this line:

    ConditionPathIsReadWrite=/proc/sys/

to this:

     ConditionPathIsReadWrite=/proc/sys/net/

The background for this is that the latter is namespaced through network
namespacing usually and hence frequently set as writable in containers, even
though the former is kept read-only. If /proc/sys is read-only but
/proc/sys/net is writable we should run the sysctl service, as useful settings
may be made in this case.

Fixes: #4370
2016-10-20 19:36:28 +02:00
Lennart Poettering 2fa4f10835 units: extend stop timeout for user@.service to 120s (#4426)
By default all user and all system services get stop timeouts for 90s. This is
problematic as the user manager of course is run as system service. Thus, if
the default time-out is hit for any user service, then it will also be hit for
user@.service as a whole, thus making the whole concept useless for user
services.

This patch extends the stop timeout to 120s for user@.service hence, so that
that the user service manager has ample time to process user services timing
out.

(The other option would have been to shorten the default user service timeout,
but I think a user service should get the same timeout by default as a system
service)

Fixes: #4206
2016-10-20 17:45:27 +02:00
Evgeny Vereshchagin a5d5c0d2df tests: fix memleak in test-calendarspec (#4424)
Fixes:
```
==10750==
==10750== HEAP SUMMARY:
==10750==     in use at exit: 96 bytes in 3 blocks
==10750==   total heap usage: 1,711 allocs, 1,708 frees, 854,545 bytes
allocated
==10750==
==10750== 96 (64 direct, 32 indirect) bytes in 1 blocks are definitely
lost in loss record 3 of 3
==10750==    at 0x4C2DA60: calloc (vg_replace_malloc.c:711)
==10750==    by 0x4EB3BDA: calendar_spec_from_string
(calendarspec.c:771)
==10750==    by 0x109675: test_hourly_bug_4031 (test-calendarspec.c:118)
==10750==    by 0x10A00E: main (test-calendarspec.c:202)
==10750==
==10750== LEAK SUMMARY:
==10750==    definitely lost: 64 bytes in 1 blocks
==10750==    indirectly lost: 32 bytes in 2 blocks
==10750==      possibly lost: 0 bytes in 0 blocks
==10750==    still reachable: 0 bytes in 0 blocks
==10750==         suppressed: 0 bytes in 0 blocks
==10750==
==10750== For counts of detected and suppressed errors, rerun with: -v
==10750== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
```
2016-10-20 17:44:30 +02:00
Martin Pitt d9a0df256d Merge pull request #4418 from keszybz/autogen-params
Allow ./autogen.sh to take parameters for configure
2016-10-20 17:43:42 +02:00
Zbigniew Jędrzejewski-Szmek 8fdea26c94 Merge pull request #4414 from poettering/consolesakcomment
three minor fixes: document /dev/console/SAK handling + another cgroups wording fix + document User= default
2016-10-20 09:35:40 -04:00
Zbigniew Jędrzejewski-Szmek 6309e51ea3 shared/install: fix %u expansion when running under sudo
Test case:
[Install]
DefaultInstance=bond1
WantedBy= foobar-U-%U.device
WantedBy= foobar-u-%u.device

$ sudo systemctl --root=/ enable testing4@.service
(before)
Created symlink /etc/systemd/system/foobar-U-0.device.wants/testing4@bond1.service → /etc/systemd/system/testing4@.service.
Created symlink /etc/systemd/system/foobar-u-zbyszek.device.wants/testing4@bond1.service → /etc/systemd/system/testing4@.service.

(after)
Created symlink /etc/systemd/system/foobar-U-0.device.wants/testing4@bond1.service → /etc/systemd/system/testing4@.service.
Created symlink /etc/systemd/system/foobar-u-root.device.wants/testing4@bond1.service → /etc/systemd/system/testing4@.service.

It doesn't make much sense to use a different user for %U and %u.
2016-10-20 09:28:51 -04:00
Zbigniew Jędrzejewski-Szmek cfd559c9a8 shared/install: fix DefaultInstance expansion in %n, %N
We should substitute DefaultInstance if the instance is not specified.

Test case:
[Install]
DefaultInstance=bond1
WantedBy= foobar-n-%n.device
WantedBy= foobar-N-%N.device

$ systemctl --root=/ enable testing4@.service
Created symlink /etc/systemd/system/foobar-n-testing4@bond1.service.device.wants/testing4@bond1.service → /etc/systemd/system/testing4@.service.
Created symlink /etc/systemd/system/foobar-N-testing4@bond1.device.wants/testing4@bond1.service → /etc/systemd/system/testing4@.service.

(before, the symlink would be created with empty %n, %N parts).
2016-10-20 09:28:46 -04:00
Zbigniew Jędrzejewski-Szmek 6e3136b209 shared/install: fix DefaultInstance expansion in %i
We should substitute DefaultInstance if the instance is not specified.

Test case:
[Install]
DefaultInstance=bond1
WantedBy= foobar-i-%i.device

$ systemctl --root=/ enable testing4@.service
Created symlink /etc/systemd/system/foobar-i-bond1.device.wants/testing4@bond1.service
 → /etc/systemd/system/testing4@.service.
(before, the symlink would be created as
/etc/systemd/system/foobar-i-.device.wants/testing4@bond1.service)

Fixes #4411.
2016-10-20 09:12:42 -04:00
Lennart Poettering 47da760efd man: document default for User=
Replaces: #4375
2016-10-20 13:21:25 +02:00
Lennart Poettering 8ae2c6300f journald,core: add short comments we we keep reopening /dev/console all the time
Just to make sure the next one reading this isn't surprised that the fd isn't
kept open. SAK and stuff...

Fix suggested:

https://github.com/systemd/systemd/pull/4366#issuecomment-253659162
2016-10-20 13:12:53 +02:00
Lennart Poettering e9c880dd2c man: one more cgroup wording fix 2016-10-20 13:12:53 +02:00
Lennart Poettering 332c0d48a9 Merge pull request #4417 from keszybz/man-and-rlimit
Two unrelated patches: man page tweaks and rlimit log levels
2016-10-20 13:10:37 +02:00
Marcel Holtmann 697f494216 hwdb: Update database of Bluetooth company identifiers 2016-10-20 10:24:18 +02:00
Zbigniew Jędrzejewski-Szmek fe9d97c673 build-sys: show configure and make commands
And also hide make clean output which is very verbose and not particularly
interesting.
2016-10-20 01:42:56 -04:00
Zbigniew Jędrzejewski-Szmek a5e739a570 build-sys: allow autogen.sh to take configure params
It is sometimes nice to run autogen with some configure parameters.
For example:

  ./autogen.sh c --disable-manpages

So pass any extra args after the [cgals] verb to the configure command.

Also, check that the verb is correct (empty or one of the known letters)
before doing any non-trivial work.
2016-10-20 01:42:55 -04:00
Zbigniew Jędrzejewski-Szmek 3ce40911bd pid1: downgrade some rlimit warnings
Since we ignore the result anyway, downgrade errors to warning.

log_oom() will still emit an error, but that's mostly theoretical, so it
is not worth complicating the code to avoid the small inconsistency
2016-10-19 22:17:16 -04:00
Lennart Poettering 5368222db6 core: let's upgrade the log level for service processes dying of signal (#4415)
As suggested in
https://github.com/systemd/systemd/pull/4367#issuecomment-253670328
2016-10-19 19:48:35 -04:00
Lennart Poettering 45c0de1f3c Merge pull request #4360 from fbuihuu/journald-fix-flush-when-restarting
Journald fix flush when restarting (#4190)
2016-10-20 00:10:08 +02:00
Lucas Werkmeister 4cf13011fe man: document dependencies implied by Sockets= (#4412)
Fixes #4410. Also includes two minor improvements to the previous
sentence.
2016-10-19 23:21:26 +02:00
Lennart Poettering 0afc6d4920 Merge pull request #4378 from evverx/nspawn-smoke-test
tests: add smoke test for systemd-nspawn
2016-10-19 21:35:39 +02:00
Lennart Poettering e6fa8681dc Merge pull request #4390 from keszybz/install-specifiers
Various install-related tweaks
2016-10-19 21:33:32 +02:00
Evgeny Vereshchagin 88a00ac517 bootctl: don't try to remove esp_path (#4407)
This is a follow-up for 9ee051b9c7
2016-10-19 21:15:20 +02:00
Yu Watanabe 9ee051b9c7 boot: fix bootctl install segfault (#4404) 2016-10-19 14:50:47 +03:00
Franck Bui 57f443a6d9 journal: rename determine_space_for() into cache_space_refresh()
Now that determine_space_for() only deals with storage space (cached) values,
rename it so it reflects the fact that only the cached storage space values are
updated.
2016-10-19 09:53:07 +02:00
Franck Bui 3a19f2150d journal: introduce patch_min_use() helper
Updating min_use is rather an unusual operation that is limited when we first
open the journal files, therefore extracts it from determine_space_for() and
create a function of its own and call this new function when needed.

determine_space_for() is now dealing with storage space (cached) values only.

There should be no functional changes.
2016-10-19 09:53:07 +02:00
Franck Bui a0edc477bd journal: introduce cache_space_invalidate()
Introduce a dedicated helper in order to reset the storage space cache.
2016-10-19 09:53:07 +02:00
Franck Bui 23aba34349 journal: cache used vfs stats as well
The set of storage space values we cache are calculated according to a couple
of filesystem statistics (free blocks, block size).

This patch caches the vfs stats we're interested in so these values are
available later and coherent with the rest of the space cached values.
2016-10-19 09:53:07 +02:00
Franck Bui 18e758bf25 journal: don't emit space usage message when opening the journal (#4190)
This patch makes system_journal_open() stop emitting the space usage
message. The caller is now free to emit this message when appropriate.

When restarting the journal, we can now emit the message *after*
flushing the journal (if required) so that all flushed log entries are
written in the persistent journal *before* the status message.

This is required since the status message is always younger than the
flushed entries.

Fixes #4190.
2016-10-19 09:53:07 +02:00
Franck Bui cba5629e87 journal: introduce server_space_usage_message()
This commit simply extracts from determine_space_for() the code which emits the
storage usage message and put it into a function of its own so it can be reused
by others paths later.

No functional changes.
2016-10-19 09:53:07 +02:00