]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
6 years agoMerge pull request #8199 from keszybz/small-things
Lennart Poettering [Mon, 19 Feb 2018 15:55:10 +0000 (16:55 +0100)] 
Merge pull request #8199 from keszybz/small-things

Sundry small cleanups

6 years agotests: add a simple test for utf8_n_codepoints() 8199/head
Zbigniew Jędrzejewski-Szmek [Fri, 16 Feb 2018 09:34:00 +0000 (10:34 +0100)] 
tests: add a simple test for utf8_n_codepoints()

6 years agoSome comment adjustments
Zbigniew Jędrzejewski-Szmek [Fri, 16 Feb 2018 09:27:47 +0000 (10:27 +0100)] 
Some comment adjustments

Follow up for review of #8184.

6 years agocore: drop obsolete comment
Zbigniew Jędrzejewski-Szmek [Fri, 16 Feb 2018 09:23:16 +0000 (10:23 +0100)] 
core: drop obsolete comment

https://github.com/systemd/systemd/pull/8125#pullrequestreview-96894581

6 years agopid1: do not initialize join_controllers by default
Zbigniew Jędrzejewski-Szmek [Fri, 16 Feb 2018 09:17:46 +0000 (10:17 +0100)] 
pid1: do not initialize join_controllers by default

We're moving towards unified cgroup hierarchy where this is not necessary.
This makes main.c a bit simpler.

6 years agoMove config_parse_join_controllers to shared, add test
Zbigniew Jędrzejewski-Szmek [Fri, 16 Feb 2018 08:56:29 +0000 (09:56 +0100)] 
Move config_parse_join_controllers to shared, add test

config_parse_join_controllers would free the destination argument on failure,
which is contrary to our normal style, where failed parsing has no effect.
Moving it to shared also allows a test to be added.

6 years agoshared/conf-parser: define a macro for the repeating argument set
Zbigniew Jędrzejewski-Szmek [Fri, 16 Feb 2018 08:29:57 +0000 (09:29 +0100)] 
shared/conf-parser: define a macro for the repeating argument set

The arguments have to be indentical everywhere, so let's use a macro to
make things more readable. But only in the headers, in the .c files let's
keep them verbose so that it's easy to see the argument list.

6 years agotest-process-util: one more (void)
Zbigniew Jędrzejewski-Szmek [Fri, 16 Feb 2018 06:03:13 +0000 (07:03 +0100)] 
test-process-util: one more (void)

6 years agoAdd some handling to remaining unlinkat calls
Zbigniew Jędrzejewski-Szmek [Fri, 16 Feb 2018 06:00:22 +0000 (07:00 +0100)] 
Add some handling to remaining unlinkat calls

Coverity now started warning about this ("Calling unlinkat without checking
return value (as is done elsewhere 12 out of 15 times).", and it is right:
most of the time we should at list print a log message so people can figure
out something is wrong when this happens.

v2:
- use warning level in journald too (this is unlikely to happen ever, so it
  should be safe to something that is visible by default).

6 years agobootspec: accept tab as the separataor in sd-boot config (#8165)
Yu Watanabe [Mon, 19 Feb 2018 13:26:01 +0000 (22:26 +0900)] 
bootspec: accept tab as the separataor in sd-boot config (#8165)

In the parse logic `line_get_key_value()` in sd-boot treats spaces
and tabs are valid spacing between key and value in the line.
So, let's use the same logic for `bootctl` and the others which read
sd-boot configs.

Fixes #8154.

6 years agomeson: apply defaults if /etc/login.defs doesn't exist
Caio Marcelo de Oliveira Filho [Mon, 19 Feb 2018 02:33:16 +0000 (18:33 -0800)] 
meson: apply defaults if /etc/login.defs doesn't exist

Apply defaults for system_{uid,gid}_max even if the /etc/login.defs file
doesn't exist (e.g. in Clear Linux with no changes).

awk returns an empty string in case the file doesn't exist, causing meson to
fail in to_int(). So set the default if output is empty. This makes the BEGIN{}
blocks unnecessary, so remove them.

6 years agojob: truncate unit description
Iago López Galeiras [Fri, 16 Feb 2018 13:32:44 +0000 (14:32 +0100)] 
job: truncate unit description

The comment above says we're truncating the string but that's not true,
an assert will fail in xsprintf if the description is longer than
LINE_MAX.

Let's use snprintf instead of xsprintf to make sure it's truncated.
We'll cast its result to void to tell static checkers we're fine with
truncation.

6 years agopo: update Serbian translation
Марко М. Костић (Marko M. Kostić) [Sun, 18 Feb 2018 21:04:22 +0000 (22:04 +0100)] 
po: update Serbian translation

6 years agomeson: use multiline string syntax (#8214)
Caio Marcelo de Oliveira Filho [Mon, 19 Feb 2018 09:37:19 +0000 (01:37 -0800)] 
meson: use multiline string syntax (#8214)

The single quote working with multiple lines is likely to be unintended. With
current versions of meson, it also causes error messages after it to report the
wrong line number. Use the documented syntax instead.

6 years agoMerge pull request #8202 from keszybz/avoid-msgmerge
Michael Biebl [Sun, 18 Feb 2018 18:56:50 +0000 (19:56 +0100)] 
Merge pull request #8202 from keszybz/avoid-msgmerge

Replace msgmerge use by gettext-domain= references

6 years agomeson: fix systemd-pot target when polkit-devel is not installed 8202/head
Zbigniew Jędrzejewski-Szmek [Sun, 18 Feb 2018 16:39:08 +0000 (17:39 +0100)] 
meson: fix systemd-pot target when polkit-devel is not installed

To successfully extract strings from our .policy files, gettext needs
polkit.{its,loc} files provided by policykit-devel. When that package is not
installed, systemd-pot would fail to extract strings:

[0/1] Running external command systemd-pot.
xgettext: warning: file 'src/core/org.freedesktop.systemd1.policy.in.in' extension 'policy' is unknown; will try C
xgettext: warning: file 'src/hostname/org.freedesktop.hostname1.policy.in' extension 'policy' is unknown; will try C
...

We now don't need the .its and .loc files for normal building, but they are
still useful when generating the .pot file, because that way we avoid the
dependency on sufficiently new polkit. We just need to tell i18n to pass their
location to xgettext.

6 years agol10n: Update POTFILES.in and POTFILES.skip
Michael Biebl [Fri, 16 Feb 2018 13:25:32 +0000 (14:25 +0100)] 
l10n: Update POTFILES.in and POTFILES.skip

We no longer use .in suffixes for .policy files.

Follow-up for commit 9b3cff199dd3827a9f2df9a7f5874d6ef18880f2 and
70886abbde59a45cfabe0769c0cdb3af1e5f7790.

6 years agotests: reset _found at the end of each iteration (#8195)
Evgeny Vereshchagin [Fri, 16 Feb 2018 13:26:26 +0000 (16:26 +0300)] 
tests: reset _found at the end of each iteration (#8195)

This makes `inst_rules` really print all rules it skips.

6 years agomkosi: remove intltool from deps
Zbigniew Jędrzejewski-Szmek [Thu, 15 Feb 2018 20:38:15 +0000 (21:38 +0100)] 
mkosi: remove intltool from deps

intltool is unnecessary since c81217920effddc93fb780cf8f9eb699d6fe1319.
But we still need gettext, because we use msgformat to generate .mo files.
(I tried to make meson depend on it, at least in Fedora:
 https://bugzilla.redhat.com/show_bug.cgi?id=1545926, but that didn't fly,
 and in Debian at least meson also has no dependency on the tools used by
 its i18n module, so we need to add our own dependency anyway.)

Closes #8192.

6 years agomeson: drop unnecessary "transformation" of policy files
Zbigniew Jędrzejewski-Szmek [Fri, 16 Feb 2018 11:48:55 +0000 (12:48 +0100)] 
meson: drop unnecessary "transformation" of policy files

Those files don't contain any @variables@, so the configuration step was just
copying them to build/. Let's avoid that, and fix their suffixes while at it.

6 years agomeson: drop double .in suffix for o.fd.systemd1.policy file
Zbigniew Jędrzejewski-Szmek [Fri, 16 Feb 2018 11:37:42 +0000 (12:37 +0100)] 
meson: drop double .in suffix for o.fd.systemd1.policy file

This file is now undergoing just one transformation, so drop the unnecessary
suffix.

6 years agoGettextize policy files
Gunnar Hjalmarsson [Thu, 15 Feb 2018 20:21:58 +0000 (21:21 +0100)] 
Gettextize policy files

* Don't merge translations into the files
* Add gettext-domain="systemd" to description and message

Closes #8162, replaces #8118.

6 years agologin,user-sessions: always warn when we fail to remove nologin file
Zbigniew Jędrzejewski-Szmek [Fri, 16 Feb 2018 05:58:33 +0000 (06:58 +0100)] 
login,user-sessions: always warn when we fail to remove nologin file

This usually is very annoying to users who then cannot log in, so
make sure we always warn if that happens (selinux, or whatever other reason).

This reverts a790812cb349c5cef95d1b4a20fc80ca08d3a145.

6 years agotest/test-functions: Debian/Ubuntu, now ship 95-dm-notify.rules, copy it
Dimitri John Ledkov [Wed, 14 Feb 2018 20:34:55 +0000 (20:34 +0000)] 
test/test-functions: Debian/Ubuntu, now ship 95-dm-notify.rules, copy it

This fixes cryptsetup tests on recent Ubuntu/Debian systems (current
development series).

Bug-Launchpad: https://launchpad.net/bugs/1749432

6 years agoMerge pull request #8175 from keszybz/gc-cleanup
Lennart Poettering [Thu, 15 Feb 2018 16:47:37 +0000 (17:47 +0100)] 
Merge pull request #8175 from keszybz/gc-cleanup

Garbage collection cleanup

6 years agoMerge pull request #8188 from keszybz/coverity-fixes
Lennart Poettering [Thu, 15 Feb 2018 16:23:03 +0000 (17:23 +0100)] 
Merge pull request #8188 from keszybz/coverity-fixes

Coverity fixes

6 years agoMerge pull request #8150 from poettering/memory-accounting-by-default
Lennart Poettering [Thu, 15 Feb 2018 16:22:36 +0000 (17:22 +0100)] 
Merge pull request #8150 from poettering/memory-accounting-by-default

pid1: turn memory accounting on by default now

6 years agoMerge pull request #8184 from poettering/color-ask-pw
Zbigniew Jędrzejewski-Szmek [Thu, 15 Feb 2018 16:14:59 +0000 (17:14 +0100)] 
Merge pull request #8184 from poettering/color-ask-pw

Trivial merge conflict resolved locally.

6 years agoMerge pull request #8125 from poettering/cgroups-migrate
Zbigniew Jędrzejewski-Szmek [Thu, 15 Feb 2018 15:15:45 +0000 (16:15 +0100)] 
Merge pull request #8125 from poettering/cgroups-migrate

Trivial merge conflict resolved locally.

6 years agomachined: change check_gc to may_gc everywhere 8175/head
Zbigniew Jędrzejewski-Szmek [Thu, 15 Feb 2018 12:15:45 +0000 (13:15 +0100)] 
machined: change check_gc to may_gc everywhere

6 years agologind: change check_gc to may_gc everywhere
Zbigniew Jędrzejewski-Szmek [Thu, 15 Feb 2018 12:14:35 +0000 (13:14 +0100)] 
logind: change check_gc to may_gc everywhere

6 years agopid1: also show gc status for jobs like we do for units
Zbigniew Jędrzejewski-Szmek [Tue, 13 Feb 2018 23:52:21 +0000 (00:52 +0100)] 
pid1: also show gc status for jobs like we do for units

6 years agopid1: rename job_check_gc to job_may_gc
Zbigniew Jędrzejewski-Szmek [Tue, 13 Feb 2018 23:39:06 +0000 (00:39 +0100)] 
pid1: rename job_check_gc to job_may_gc

The reasoning is the same as for unit_can_gc.

v2:
- rename can_gc to may_gc

6 years agopid1: properly remove references to the unit from gc queue during final cleanup
Zbigniew Jędrzejewski-Szmek [Tue, 13 Feb 2018 22:57:43 +0000 (23:57 +0100)] 
pid1: properly remove references to the unit from gc queue during final cleanup

When various references to the unit were dropped during cleanup in unit_free(),
add_to_gc_queue() could be called on this unit. If the unit was previously in
the gc queue (at the time when unit_free() was called on it), this wouldn't
matter, because it'd have in_gc_queue still set even though it was already
removed from the queue. But if it wasn't set, then the unit could be added to
the queue. Then after unit_free() would deallocate the unit, we would be left
with a dangling pointer in gc_queue.

A unit could be added to the gc queue in two places called from unit_free():
in the job_install calls, and in unit_ref_unset(). The first was OK, because
it was above the LIST_REMOVE(gc_queue,...) call, but the second was not, because
it was after that. Move the all LIST_REMOVE() calls down.

6 years agopid1: free basic unit information at the very end, before freeing the unit
Zbigniew Jędrzejewski-Szmek [Tue, 13 Feb 2018 23:01:05 +0000 (00:01 +0100)] 
pid1: free basic unit information at the very end, before freeing the unit

We would free stuff like the names of the unit first, and then recurse
into other structures to remove the unit from there. Technically this
was OK, since the code did not access the name, but this makes debugging
harder. And if any log messages are added in any of those functions, they
are likely to access u->id and such other basic information about the unit.
So let's move the removal of this "basic" information towards the end
of unit_free().

6 years agopid1: fix collection of cycles of units which reference one another
Zbigniew Jędrzejewski-Szmek [Tue, 13 Feb 2018 13:37:11 +0000 (14:37 +0100)] 
pid1: fix collection of cycles of units which reference one another

A .socket will reference a .service unit, by registering a UnitRef with the
.service unit. If this .service unit has the .socket unit listed in Wants or
Sockets or such, a cycle will be created. We would not free this cycle
properly, because we treated any unit with non-empty refs as uncollectable. To
solve this issue, treats refs with UnitRef in u->refs_by_target similarly to
the refs in u->dependencies, and check if the "other" unit is known to be
needed. If it is not needed, do not treat the reference from it as preventing
the unit we are looking at from being freed.

6 years agopid1: include the source unit in UnitRef
Zbigniew Jędrzejewski-Szmek [Tue, 13 Feb 2018 12:12:43 +0000 (13:12 +0100)] 
pid1: include the source unit in UnitRef

No functional change.

The source unit manages the reference. It allocates the UnitRef structure and
registers it in the target unit, and then the reference must be destroyed
before the source unit is destroyed. Thus, is should be OK to include the
pointer to the source unit, it should be live as long as the reference exists.

v2:
- rename refs to refs_by_target

6 years agopid1: rename unit_check_gc to unit_may_gc
Zbigniew Jędrzejewski-Szmek [Tue, 13 Feb 2018 09:50:13 +0000 (10:50 +0100)] 
pid1: rename unit_check_gc to unit_may_gc

"check" is unclear: what is true, what is false? Let's rename to "can_gc" and
revert the return value ("positive" values are easier to grok).

v2:
- rename from unit_can_gc to unit_may_gc

6 years agocoredump: accept hostname on command line (#8033)
Jakub Filak [Thu, 15 Feb 2018 11:12:46 +0000 (12:12 +0100)] 
coredump: accept hostname on command line (#8033)

This commint adds a new command line parameter to sytemd-coredump. The
parameter should be mappend to core_pattern's placeholder %h - hostname.

The field _HOSTNAME holds the name from the kernel's namespaces which might be
different then the one comming from process' namespaces.

It is true that the real hostname is usually available in the field
COREDUMP_ENVIRON (environment variables) but I believe it is more reliable to
use the value passed by kernel.

----

The length of iovec is no longer static and hence I corrected the declarations
of the functions set_iovec_field and set_iovec_field_free.

Thank you @yuwata and @poettering!

6 years agomeson: add -Dmemory-accounting-default=true|false 8150/head
Zbigniew Jędrzejewski-Szmek [Thu, 15 Feb 2018 10:43:08 +0000 (11:43 +0100)] 
meson: add -Dmemory-accounting-default=true|false

This makes it easy to set the default for distributions and users which want to
default to off because they primarily use older kernels.

6 years agoudevadm: fix fd leak on oom 8188/head
Zbigniew Jędrzejewski-Szmek [Thu, 15 Feb 2018 09:30:46 +0000 (10:30 +0100)] 
udevadm: fix fd leak on oom

Unlikely, but let's be correct.

CID #1386003.

6 years agodhcp6: fix uninitialized variable in returning from client_parse_message() (#8187)
Thomas Haller [Thu, 15 Feb 2018 09:49:55 +0000 (10:49 +0100)] 
dhcp6: fix uninitialized variable in returning from client_parse_message() (#8187)

Compiler warns about this with -Werror=maybe-uninitialized.

Fixes: 3bc424a3cc0bacc688ec2f4f93a5560fb4ca393b
6 years agonspawn: make sure we don't leak the fd in chase_symlinks_and_update
Zbigniew Jędrzejewski-Szmek [Thu, 15 Feb 2018 09:18:25 +0000 (10:18 +0100)] 
nspawn: make sure we don't leak the fd in chase_symlinks_and_update

No callers use CHASE_OPEN right now, but let's be defensive.

6 years agocore: move very long argument to a separate statement
Zbigniew Jędrzejewski-Szmek [Thu, 15 Feb 2018 09:10:01 +0000 (10:10 +0100)] 
core: move very long argument to a separate statement

I like compact, but this was a bit too much.

6 years agosd-dhcp6: fix check if serverid is set
Zbigniew Jędrzejewski-Szmek [Thu, 15 Feb 2018 08:37:44 +0000 (09:37 +0100)] 
sd-dhcp6: fix check if serverid is set

Ever since the initial implementation in 631bbe71298ec892f77f44f94feb612646fe6853,
client_parse_message() was supposed to check that the message contains exactly
one serverid. The check that no more than one is given was implemented
correctly, but the check that at least one is given was not. Simplify the whole
thing by making dhcp6_lease_get_serverid() return an error if the id is not
set, and do not require the arguments to be present if the contents of the id
are not needed.

6 years agolibsystemd-network: unitialized return value
Zbigniew Jędrzejewski-Szmek [Thu, 15 Feb 2018 08:20:36 +0000 (09:20 +0100)] 
libsystemd-network: unitialized return value

r will *usually* be set, but for some packets it might not.

CID #1385308.

6 years agomkosi: add pcre2 to our build deps, as we can now link to it 8184/head
Lennart Poettering [Wed, 14 Feb 2018 18:56:24 +0000 (19:56 +0100)] 
mkosi: add pcre2 to our build deps, as we can now link to it

6 years agoask-password-api: many fixes to ask_password_tty()
Lennart Poettering [Wed, 14 Feb 2018 17:41:37 +0000 (18:41 +0100)] 
ask-password-api: many fixes to ask_password_tty()

A couple of fixes:

1. always bzero_explicit() away what we remove from the passphrase
   buffer. The UTF-8 code assumes the string remains NUL-terminated, and
   we hence should enforce that. memzero() would do too here, but let's
   be paranoid after all this is key material.

2. when clearing '*' characters from string, do so counting UTF-8
   codepoints properly. We already have code in place to count UTF-8
   codepoints when generating '*' characters, hence we should take the
   same care when clearing them again.

3. Treat NUL on input as an alternative terminator to newline or EOF.

4. When removing characters from the password always also reset the
   "codepoint" index properly.

6 years agoutf8: add utf8_n_codepoints() for counting complete utf8 codepoints in a string
Lennart Poettering [Wed, 14 Feb 2018 17:41:03 +0000 (18:41 +0100)] 
utf8: add utf8_n_codepoints() for counting complete utf8 codepoints in a string

6 years agoterminal-util: make resolve_dev_console() less weird
Lennart Poettering [Wed, 14 Feb 2018 16:30:37 +0000 (17:30 +0100)] 
terminal-util: make resolve_dev_console() less weird

Let's normalize the behaviour: return a negative errno style error code,
and return the resolved string directly as argument.

6 years agoterminal-util: modernize get_kernel_consoles() a bit
Lennart Poettering [Wed, 14 Feb 2018 13:56:17 +0000 (14:56 +0100)] 
terminal-util: modernize get_kernel_consoles() a bit

Also, make sure when we run in a container, we don't use the data from
/sys at all, but immediately fall back to /dev/console itself.

6 years agotty-ask-password-agent: reenable color for boot-time password prompt
Lennart Poettering [Wed, 14 Feb 2018 13:30:30 +0000 (14:30 +0100)] 
tty-ask-password-agent: reenable color for boot-time password prompt

The password prompt used to be highlighted, and that was a good thing.
Let's fix things to make the prompt highlighted again.

Fixes: #3853
6 years agoterminal-util: add some explanatory comments
Lennart Poettering [Wed, 14 Feb 2018 13:28:17 +0000 (14:28 +0100)] 
terminal-util: add some explanatory comments

6 years agoupdate TODO
Lennart Poettering [Wed, 14 Feb 2018 13:28:00 +0000 (14:28 +0100)] 
update TODO

6 years agoprocess: shortcut getenv_for_pid() for our own process
Lennart Poettering [Wed, 14 Feb 2018 13:27:31 +0000 (14:27 +0100)] 
process: shortcut getenv_for_pid() for our own process

6 years agoman: make systemd-socket-activate point to systemd-run (#8151)
Lucas Werkmeister [Wed, 14 Feb 2018 13:11:24 +0000 (14:11 +0100)] 
man: make systemd-socket-activate point to systemd-run (#8151)

Now that systemd-run also supports socket units, it makes sense to link
to that command from the systemd-socket-activate manpage.

6 years agoAllow timers to trigger timers (#8043)
Boucman [Wed, 14 Feb 2018 13:10:07 +0000 (14:10 +0100)] 
Allow timers to trigger timers (#8043)

Unlike any other unit type, it makes sense for a timer to start another
timer. It is an easy way to crate logical "and" between time conditions

for instance, every day but no less than 5' after boot can easily be
implemented by a OnBootSec triggering an OnCalendar.

This is particulary usefull with Persistant timers which tend to all fire
together at startup

6 years agomeson: factor out daemon/event/id128 sources into variables (#8170)
Davide Cavalca [Wed, 14 Feb 2018 13:08:50 +0000 (05:08 -0800)] 
meson: factor out daemon/event/id128 sources into variables (#8170)

6 years agopo: update Polish translation (#8169)
Piotr Drąg [Wed, 14 Feb 2018 13:06:14 +0000 (14:06 +0100)] 
po: update Polish translation (#8169)

6 years agoMerge pull request #8144 from poettering/journal-inotify-fixes
Zbigniew Jędrzejewski-Szmek [Wed, 14 Feb 2018 12:52:17 +0000 (13:52 +0100)] 
Merge pull request #8144 from poettering/journal-inotify-fixes

various journal fixes

6 years agoman: link latest FHS spec in file-hierarchy(7) (#8178)
Jan Synacek [Wed, 14 Feb 2018 10:34:47 +0000 (11:34 +0100)] 
man: link latest FHS spec in file-hierarchy(7) (#8178)

6 years agopo: update French translation
Sylvain Plantefève [Tue, 13 Feb 2018 19:45:54 +0000 (20:45 +0100)] 
po: update French translation

6 years agomailmap: one more person
Zbigniew Jędrzejewski-Szmek [Wed, 14 Feb 2018 08:34:46 +0000 (09:34 +0100)] 
mailmap: one more person

For a083b4875e8dec5ce5379d8bc437d750cd338c37.

6 years agoask-password: pretty flags enum definition a bit
Lennart Poettering [Tue, 13 Feb 2018 23:13:26 +0000 (00:13 +0100)] 
ask-password: pretty flags enum definition a bit

6 years agotty-ask-password-agent: don't open terminal multiple times
Lennart Poettering [Tue, 13 Feb 2018 23:10:00 +0000 (00:10 +0100)] 
tty-ask-password-agent: don't open terminal multiple times

We already have the terminal open, hence pass the fd we got to
ask_password_tty(), so that it doesn't have to reopen it a second time.

This is mostly an optimization, but it has the nice benefit of making us
independent from RLIMIT_NOFILE issues and so on, as we don't need to
allocate another fd needlessly.

6 years agoask-password: derive pollfd array from enum
Lennart Poettering [Tue, 13 Feb 2018 23:02:23 +0000 (00:02 +0100)] 
ask-password: derive pollfd array from enum

It's prettier that way!

6 years agoask-password: round up when determining sleep time
Lennart Poettering [Tue, 13 Feb 2018 22:57:57 +0000 (23:57 +0100)] 
ask-password: round up when determining sleep time

We should rather sleep to much than too little. This otherwise might
result in a busy loop, because we slept too little and then recheck
again coming to the conclusion we need to go to sleep again, and so on.

6 years agoask-password: let's use structure initialization properly
Lennart Poettering [Tue, 13 Feb 2018 22:57:40 +0000 (23:57 +0100)] 
ask-password: let's use structure initialization properly

6 years agoask-password: let's (void) cast where appropriate
Lennart Poettering [Tue, 13 Feb 2018 22:57:13 +0000 (23:57 +0100)] 
ask-password: let's (void) cast where appropriate

6 years agoask-password: bypass clean-up if we don't need it
Lennart Poettering [Tue, 13 Feb 2018 22:56:57 +0000 (23:56 +0100)] 
ask-password: bypass clean-up if we don't need it

6 years agoask-password: don't use ttyfd if it is not set
Lennart Poettering [Tue, 13 Feb 2018 22:55:58 +0000 (23:55 +0100)] 
ask-password: don't use ttyfd if it is not set

6 years agotty-ask-password-agent: show right TTY path in error message
Lennart Poettering [Tue, 13 Feb 2018 22:55:19 +0000 (23:55 +0100)] 
tty-ask-password-agent: show right TTY path in error message

6 years agotty-ask-password-agent: assing sendto() result to a ssize_t variable, not an int
Lennart Poettering [Tue, 13 Feb 2018 22:53:59 +0000 (23:53 +0100)] 
tty-ask-password-agent: assing sendto() result to a ssize_t variable, not an int

We should be careful with these types, and if we do convert between
"int" and "ssize_t" we should do so explicitly rather than implicitly.
Otherwise this just looks like a bug.

6 years agoterminal-util: minor, trivial fixes and improvements
Lennart Poettering [Tue, 13 Feb 2018 22:53:34 +0000 (23:53 +0100)] 
terminal-util: minor, trivial fixes and improvements

6 years agoterminal-util: when making /dev/null or the console stdio, forget cached terminal...
Lennart Poettering [Tue, 13 Feb 2018 22:50:26 +0000 (23:50 +0100)] 
terminal-util: when making /dev/null or the console stdio, forget cached terminal features

Let's forget all relevant terminal features we learnt when we make a
console or /dev/null stdin/stdout/stderr.

Also, while we are at it, let's drop the various _unlikely_ and
_likely_ annotiations around the terminal feature caches. In many cases
we call the relevant functions only once in which cases the annotations
are likely to do just harm and no good. After all we can't know if the
specific code will call us just once or many times...

6 years agoterminal-util: rework acquire_terminal()
Lennart Poettering [Tue, 13 Feb 2018 20:24:37 +0000 (21:24 +0100)] 
terminal-util: rework acquire_terminal()

This modernizes acquire_terminal() in a couple of ways:

1. The three boolean arguments are replaced by a flags parameter, that
   should be more descriptive in what it does.

2. We now properly handle inotify queue overruns

3. We use _cleanup_ for closing the fds now, to shorten the code quite a
   bit.

Behaviour should not be altered by this.

6 years agotty-ask-password-agent: make code a tiny bit shorter
Lennart Poettering [Tue, 13 Feb 2018 18:17:17 +0000 (19:17 +0100)] 
tty-ask-password-agent: make code a tiny bit shorter

6 years agomanager: avoid infinite loop for unexpected waitid() error (#8168)
Alan Jenkins [Tue, 13 Feb 2018 18:04:31 +0000 (18:04 +0000)] 
manager: avoid infinite loop for unexpected waitid() error (#8168)

I think if we log the error as being _ignored_, we should also consider
the event as handled and clear it.  This was the behaviour prior to
575b300b (PR #7968).

I don't think we particularly wanted to change behaviour and keep retrying.
Sometimes that's useful, other times you cause more problems by filling the
logs.

Plus a nearby typo fix.

6 years agoanalyze: fix typo in error message
Zbigniew Jędrzejewski-Szmek [Tue, 13 Feb 2018 09:03:09 +0000 (10:03 +0100)] 
analyze: fix typo in error message

6 years agotest-strv: add a simple test for strv_free_free()
Zbigniew Jędrzejewski-Szmek [Tue, 13 Feb 2018 07:57:31 +0000 (08:57 +0100)] 
test-strv: add a simple test for strv_free_free()

6 years agol10n: update POTFILES.in (#8163)
AsciiWolf [Tue, 13 Feb 2018 03:05:22 +0000 (04:05 +0100)] 
l10n: update POTFILES.in (#8163)

6 years agotmpfiles: age root-owned read-only files, by default (#7917)
itsbill [Mon, 12 Feb 2018 14:47:08 +0000 (09:47 -0500)] 
tmpfiles: age root-owned read-only files, by default (#7917)

[zj: The note in NEWS was added in 82c8e3e6503a40684cf265842bb1c26a8f7681b5
and released as part of systemd-237.]

6 years agoupdate TODO 8125/head
Lennart Poettering [Wed, 7 Feb 2018 22:03:13 +0000 (23:03 +0100)] 
update TODO

6 years agocore: add new new bus call for migrating foreign processes to scope/service units
Lennart Poettering [Wed, 7 Feb 2018 21:52:52 +0000 (22:52 +0100)] 
core: add new new bus call for migrating foreign processes to scope/service units

This adds a new bus call to service and scope units called
AttachProcesses() that moves arbitrary processes into the cgroup of the
unit. The primary user for this new API is systemd itself: the systemd
--user instance uses this call of the systemd --system instance to
migrate processes if itself gets the request to migrate processes and
the kernel refuses this due to access restrictions.

The primary use-case of this is to make "systemd-run --scope --user …"
invoked from user session scopes work correctly on pure cgroupsv2
environments. There, the kernel refuses to migrate processes between two
unprivileged-owned cgroups unless the requestor as well as the ownership
of the closest parent cgroup all match. This however is not the case
between the session-XYZ.scope unit of a login session and the
user@ABC.service of the systemd --user instance.

The new logic always tries to move the processes on its own, but if
that doesn't work when being the user manager, then the system manager
is asked to do it instead.

The new operation is relatively restrictive: it will only allow to move
the processes like this if the caller is root, or the UID of the target
unit, caller and process all match. Note that this means that
unprivileged users cannot attach processes to scope units, as those do
not have "owning" users (i.e. they have now User= field).

Fixes: #3388
6 years agocore: in bus_init_system() make sure we setup the system bus even if we inherit the...
Lennart Poettering [Wed, 7 Feb 2018 21:47:26 +0000 (22:47 +0100)] 
core: in bus_init_system() make sure we setup the system bus even if we inherit the API bus

This corrects the control flow: when we reuse the API bus as system bus,
let's definitely invoke bus_init_system() too, so that it is called
regardless how we acquired the bus object.

(Note that this doesn't actually change anything, as we only inherit the
bus like this in system mode, and bus_init_system() doesn't do anything
in system bus, besides writing a log message)

6 years agobus: in bus_foreach_bus() don't bother with api_bus if it is NULL
Lennart Poettering [Wed, 7 Feb 2018 21:44:18 +0000 (22:44 +0100)] 
bus: in bus_foreach_bus() don't bother with api_bus if it is NULL

Let's better be safe than sorry, and validate that api_bus is not NULL
before we send messages to it. Of course, strictly speaking this
shouldn't actually be necessary, as the tracker object should not exist
without the bus, but let's be extra sure.

6 years agobus: when destroying a bus, also destroy per-unit bus track objects associated with it
Lennart Poettering [Wed, 7 Feb 2018 21:40:41 +0000 (22:40 +0100)] 
bus: when destroying a bus, also destroy per-unit bus track objects associated with it

Let's not keep the old bus object pinned this way, let's destroy all
relevant trackers for units, the way we already destroy them for jobs.

6 years agocore: delay bus name synchronization after reload/reexec into a later event loop...
Lennart Poettering [Wed, 7 Feb 2018 21:36:51 +0000 (22:36 +0100)] 
core: delay bus name synchronization after reload/reexec into a later event loop iteration

Previously, we'd synchronize bus names immediately when we succeeded
connecting to the bus, potentially even before coldplugging the units.
This was problematic, as synchronizing bus names meant invoking the
per-unit name change handler function which might change the unit's
state — which will result in consistency when done before we coldplug
things.

With this change we instead enqueue a job for the event loop to resync
the names in a later loop iteration, i.e. at a point where we know
coldplugging has finished.

6 years agocore: set a description on private bus connections
Lennart Poettering [Wed, 7 Feb 2018 21:30:17 +0000 (22:30 +0100)] 
core: set a description on private bus connections

Let's make things easier to debug

6 years agosd-bus: synthesize a description for user/system bus if otherwise unset
Lennart Poettering [Wed, 7 Feb 2018 21:28:42 +0000 (22:28 +0100)] 
sd-bus: synthesize a description for user/system bus if otherwise unset

Let's make debugging easier, by synthesizing a name when we have some
indication what kind of bus this is.

6 years agocore: generalize how we acquire the Unit objects for unit names in bus calls
Lennart Poettering [Wed, 7 Feb 2018 17:13:31 +0000 (18:13 +0100)] 
core: generalize how we acquire the Unit objects for unit names in bus calls

This splits out the code that translates a unit name into a Unit* object
from method_get_unit(), and reuses it all other functions that operate
similar to it. This effectively means all those calls now optionally
take an empty unit string which now means the same as the client's unit.
This useful behaviour of the GetUnit() bus call is thus extended to all
other matching bus calls.

Similar, the same logic from method_load_unit() is also generalized and
reused wherever appropriate.

6 years agouser-util: also consider /bin/false and /bin/true as non-shell
Lennart Poettering [Wed, 7 Feb 2018 17:11:18 +0000 (18:11 +0100)] 
user-util: also consider /bin/false and /bin/true as non-shell

6 years agocore: update dbus policy file
Lennart Poettering [Wed, 7 Feb 2018 15:30:11 +0000 (16:30 +0100)] 
core: update dbus policy file

This patch does four things:

1. Adds more comments that clarify the order in which things appear in
   the file

2. All entries are placed in the order in which their SD_BUS_METHOD()
   macros appear in the C vtables.

3. A couple of missing entries are added that should be open to all or
   do polkit

4. Corrects the interface name for the GetProcesses() calls. They belong
   to the per-unit interface, not to Unit

6 years agocore: simplify manager_recheck_journal() a bit
Lennart Poettering [Wed, 7 Feb 2018 14:08:18 +0000 (15:08 +0100)] 
core: simplify manager_recheck_journal() a bit

No need for an if check if we just pass along a bool anyway.

6 years agocore: tweak manager_journal_is_running() a bit more
Lennart Poettering [Wed, 7 Feb 2018 14:07:00 +0000 (15:07 +0100)] 
core: tweak manager_journal_is_running() a bit more

Let's also use the journal if it is currently reloading. In that state
it should also be able to process our requests. Moreover, we might
otherwise end up disconnecting/reconnecting from the journal without
really any need to hence, relax the check accordingly.

6 years agomanager: tweak manager_journal_is_running() a bit regarding test mode
Lennart Poettering [Wed, 7 Feb 2018 14:06:15 +0000 (15:06 +0100)] 
manager: tweak manager_journal_is_running() a bit regarding test mode

In test mode, let's not consider the journal to be up ever: we want all
output to go to stderr.

6 years agocore: rework how we connect to the bus
Lennart Poettering [Wed, 7 Feb 2018 13:52:22 +0000 (14:52 +0100)] 
core: rework how we connect to the bus

This removes the current bus_init() call, as it had multiple problems:
it munged  handling of the three bus connections we care about (private,
"api" and system) into one, even though the conditions when which was
ready are very different. It also added redundant logging, as the
individual calls it called all logged on their own anyway.

The three calls bus_init_api(), bus_init_private() and bus_init_system()
are now made public. A new call manager_dbus_is_running() is added that
works much like manager_journal_is_running() and is a lot more careful
when checking whether dbus is around. Optionally it checks the unit's
deserialized_state rather than state, in order to accomodate for cases
where we cant to connect to the bus before deserializing the
"subscribed" list, before coldplugging the units.

manager_recheck_dbus() is added, that works a lot like
manager_recheck_journal() and is invoked in unit_notify(), i.e. when
units change state.

All in all this should make handling a bit more alike to journal
handling, and it also fixes one major bug: when running in user mode
we'll now connect to the system bus early on, without conditionalizing
this in anyway.

6 years agodbus: split up bus_done() into seperate functions
Lennart Poettering [Wed, 7 Feb 2018 14:00:32 +0000 (15:00 +0100)] 
dbus: split up bus_done() into seperate functions

No functional changes, but let's make this a bit more finegrained.

(The individual functions are exported, which is used in a later commit)

6 years agobpf-firewall: fix warning text
Lennart Poettering [Wed, 7 Feb 2018 09:39:56 +0000 (10:39 +0100)] 
bpf-firewall: fix warning text

I figure saying "systemd" here was a typo, and it should have been
"system". (Yes, it becomes very hard after a while typing "system"
correctly if you type "systemd" so often.) That said, "systemd" in some
ways is actually more correct, since BPF might be available for the
system instance but not in the user instance.

Either way, talking of "this systemd" is weird, let's reword this to be
"this manager", to emphasize that it's the local instance of systemd
where BPF is not available, but that it might be available otherwise.

6 years agomkosi: update to fedora 27, it's released since a while
Lennart Poettering [Wed, 7 Feb 2018 09:39:49 +0000 (10:39 +0100)] 
mkosi: update to fedora 27, it's released since a while