]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
6 years agoMerge pull request #8765 from poettering/test-fixes
Lennart Poettering [Thu, 19 Apr 2018 14:18:46 +0000 (16:18 +0200)] 
Merge pull request #8765 from poettering/test-fixes

some short fixes for the tests

6 years agoMerge pull request #8623 from yuwata/resolvectl
Zbigniew Jędrzejewski-Szmek [Thu, 19 Apr 2018 10:33:05 +0000 (12:33 +0200)] 
Merge pull request #8623 from yuwata/resolvectl

resolvectl: rename systemd-resolve to resolvectl

6 years agotree-wide: drop spurious newlines (#8764)
Lennart Poettering [Thu, 19 Apr 2018 10:13:23 +0000 (12:13 +0200)] 
tree-wide: drop spurious newlines (#8764)

Double newlines (i.e. one empty lines) are great to structure code. But
let's avoid triple newlines (i.e. two empty lines), quadruple newlines,
quintuple newlines, …, that's just spurious whitespace.

It's an easy way to drop 121 lines of code, and keeps the coding style
of our sources a bit tigther.

6 years agouser-util: trivial coding style fixes 8765/head
Lennart Poettering [Thu, 19 Apr 2018 09:40:48 +0000 (11:40 +0200)] 
user-util: trivial coding style fixes

Use C's downgrade-to-bool feature when comparing pointers against NULL,
as we usually do.

6 years agomkosi: drop dumping all test output to console again
Lennart Poettering [Thu, 19 Apr 2018 09:16:04 +0000 (11:16 +0200)] 
mkosi: drop dumping all test output to console again

As it appears meson's test cases nowadays (?) show useful logs for
failing tests anyway, hence there's no need to show them unconditionally
in full every time anymore. Let's hence simplify and drop this.

6 years agotests: compare with correct shell
Lennart Poettering [Thu, 19 Apr 2018 08:35:36 +0000 (10:35 +0200)] 
tests: compare with correct shell

We synthesize the passwd record for UID 0, hence we need to compare with
our synthesized data and not with the data stored in /etc/passwd

6 years agocore: don't export per-unit metadata files in test mode
Lennart Poettering [Thu, 19 Apr 2018 08:34:58 +0000 (10:34 +0200)] 
core: don't export per-unit metadata files in test mode

We shouldn't clobber the host's /run directories with metadata we export
for our units when we run in test mode.

6 years agomkosi: ensure the 'hostname' tool is available in the build environment
Lennart Poettering [Thu, 19 Apr 2018 08:33:57 +0000 (10:33 +0200)] 
mkosi: ensure the 'hostname' tool is available in the build environment

Our test-execute test uses 'hostname' to validate specifiers, hence it
should be available in our mkosi build too, so that the test can pass.

6 years agoMerge pull request #8758 from keszybz/improved-slice-checks
Lennart Poettering [Thu, 19 Apr 2018 09:28:05 +0000 (11:28 +0200)] 
Merge pull request #8758 from keszybz/improved-slice-checks

Improved slice checks

6 years agocoredumpctl: Add debug as a gdb alias, and add lldb support (closes #8722) (#8744)
Ryan Gonzalez [Wed, 18 Apr 2018 19:32:17 +0000 (14:32 -0500)] 
coredumpctl: Add debug as a gdb alias, and add lldb support (closes #8722) (#8744)

6 years agobash-completion: add completion for resolvectl 8623/head
Yu Watanabe [Wed, 18 Apr 2018 18:26:54 +0000 (03:26 +0900)] 
bash-completion: add completion for resolvectl

6 years agoman: create man page for resolvectl
Yu Watanabe [Wed, 18 Apr 2018 18:25:25 +0000 (03:25 +0900)] 
man: create man page for resolvectl

6 years agoresolvectl: change syntax to use verb_dispatch()
Yu Watanabe [Wed, 11 Apr 2018 01:44:51 +0000 (10:44 +0900)] 
resolvectl: change syntax to use verb_dispatch()

This makes `resolvectl` use the verb style command line, e.g.,
`resolvectl status` or `resolvectl tlsa tcp fedoraproject.org:443`.
For compatibility, if the invocation name is `systemd-resolve`,
then it accepts the old syntax, e.g. `systemd-resolve --status`.

6 years agoresolvectl: rename systemd-resolve to resolvectl
Yu Watanabe [Wed, 18 Apr 2018 18:24:23 +0000 (03:24 +0900)] 
resolvectl: rename systemd-resolve to resolvectl

For the compatibility, `systemd-resolve` will be created as a symbolic
link to `resolvectl`.

6 years agocore: do not allow Delegate= on unsupported unit types 8758/head
Zbigniew Jędrzejewski-Szmek [Wed, 18 Apr 2018 18:06:56 +0000 (20:06 +0200)] 
core: do not allow Delegate= on unsupported unit types

6 years agocore: fix resetting of Delegate= and properly ignore invalid assignment
Zbigniew Jędrzejewski-Szmek [Wed, 18 Apr 2018 17:50:07 +0000 (19:50 +0200)] 
core: fix resetting of Delegate= and properly ignore invalid assignment

The default is false not true. If we say "ignoring" we must return 0.

6 years agoman: don't place nginx socket in /tmp (#8757)
Lennart Poettering [Wed, 18 Apr 2018 16:50:06 +0000 (18:50 +0200)] 
man: don't place nginx socket in /tmp (#8757)

First of all, it's frickin' ugly and wrong, as IPC sockets should be
placed in /run and definitely not under a guessable name under
world-writable /tmp. Secondly, it can't even work as we set
PrivateTmp=yes on the service.

Hence, let's clean up the example, and simply use a socket in /run
instead.

Fixes: #8419
6 years agoMerge pull request #8708 from poettering/namespace-repeat
Lennart Poettering [Wed, 18 Apr 2018 16:46:44 +0000 (18:46 +0200)] 
Merge pull request #8708 from poettering/namespace-repeat

pid1 namespacing fixes

6 years agosysusers: make sure to reset the returned value when EOF is reached in fget*ent_sane...
Franck Bui [Wed, 18 Apr 2018 16:32:21 +0000 (18:32 +0200)] 
sysusers: make sure to reset the returned value when EOF is reached in fget*ent_sane() wrappers (#8737)

To indicate that the there're no more entries, these wrappers return false but
did leave the passed pointed unmodified.

However EOF is not an error and is a very common case so initialize the output
argument to NULL even in this case so callers don't need to do that.

Fixes: #8721
6 years agoMerge pull request #8709 from poettering/format-table
Lennart Poettering [Wed, 18 Apr 2018 14:20:13 +0000 (16:20 +0200)] 
Merge pull request #8709 from poettering/format-table

generic table formatter

6 years agopath-lookup: properly chase paths when reducing with root dir (#8750)
Lennart Poettering [Wed, 18 Apr 2018 14:19:46 +0000 (16:19 +0200)] 
path-lookup: properly chase paths when reducing with root dir (#8750)

Let's make this correct.

6 years agoutil-lib: introduce new empty_or_root() helper (#8746)
Lennart Poettering [Wed, 18 Apr 2018 12:20:49 +0000 (14:20 +0200)] 
util-lib: introduce new empty_or_root() helper (#8746)

We check the same condition at various places. Let's add a trivial,
common helper for this, and use it everywhere.

It's not going to make things much faster or much shorter, but I think a
lot more readable

6 years agonamespace: rework how we resolve symlinks in mount points 8708/head
Lennart Poettering [Wed, 4 Apr 2018 08:14:43 +0000 (10:14 +0200)] 
namespace: rework how we resolve symlinks in mount points

Before this patch we'd resolve all symlinks of bind mounts and other
mount points to establish for a service in advance, and only then start
mounting them. This is problematic, if symlink chains jump around
between directories in a namespace tree, so that to resolve a specific
symlink chain we need to establish another mount already. A typical case
where this happens is if /etc/resolv.conf is a symlink to some file in
/run: in that case we'd normally resolve and mount /etc/resolv.conf
early on, but that's broken, as to do this properly we'd need to resolve
/etc/resolv.conf first, then figure out that /run needs to be mounted
before we can proceed, and thus reorder the order in which we apply
mounts dynamically.

With this change, whenever we are about to apply a mount, we'll do a
single step of the symlink normalization process, patch the mount entry
accordingly, and then sort the list of mounts to establish again, taking
the new path into account. This means that we can correctly deal with
the example above: we might start with wanting to mount /etc/resolv.conf
early, but after resolving it to the path in /run/ we'd push it to the
end of the list, ensuring that /run is mounted first.

(Note that this also fixes another bug: we were following symlinks on
the bind mount source relative to the root directory of the service,
rather than of the host. That's wrong though as we explicitly document
tha the source of bind mounts is always on the host.)

6 years agonamespace: improve logging when creating mount source nodes
Lennart Poettering [Wed, 4 Apr 2018 09:12:49 +0000 (11:12 +0200)] 
namespace: improve logging when creating mount source nodes

6 years agonamespace: split out calls to normalize mount entry list into new function
Lennart Poettering [Wed, 4 Apr 2018 09:03:21 +0000 (11:03 +0200)] 
namespace: split out calls to normalize mount entry list into new function

6 years agonamespace: don't consider raw image read-only if /home in it is writable
Lennart Poettering [Wed, 4 Apr 2018 08:14:25 +0000 (10:14 +0200)] 
namespace: don't consider raw image read-only if /home in it is writable

6 years agofs-util: export how many iterations chase_symlinks() executes at max
Lennart Poettering [Wed, 4 Apr 2018 15:06:12 +0000 (17:06 +0200)] 
fs-util: export how many iterations chase_symlinks() executes at max

6 years agofs-util: add new CHASE_STEP flag to chase_symlinks()
Lennart Poettering [Wed, 4 Apr 2018 15:03:45 +0000 (17:03 +0200)] 
fs-util: add new CHASE_STEP flag to chase_symlinks()

If the flag is set only a single step of the normalization is executed,
and the resulting path is returned.

This allows callers to normalize piecemeal, taking into account every
single intermediary path of the normalization.

6 years agoupdate TODO 8709/head
Lennart Poettering [Wed, 18 Apr 2018 10:42:22 +0000 (12:42 +0200)] 
update TODO

6 years agotest-locale-util: show special glyphs
Zbigniew Jędrzejewski-Szmek [Wed, 18 Apr 2018 08:53:25 +0000 (10:53 +0200)] 
test-locale-util: show special glyphs

This is mostly useful as a sanity check.

6 years agotest-utf8: add a smoke test for utf8_console_width()
Zbigniew Jędrzejewski-Szmek [Wed, 18 Apr 2018 08:57:01 +0000 (10:57 +0200)] 
test-utf8: add a smoke test for utf8_console_width()

6 years agologinctl: port loginctl to format-table.[ch]
Lennart Poettering [Wed, 11 Apr 2018 19:37:38 +0000 (21:37 +0200)] 
loginctl: port loginctl to format-table.[ch]

6 years agomachinectl: port machinectl to format-table.[ch]
Lennart Poettering [Wed, 11 Apr 2018 18:12:52 +0000 (20:12 +0200)] 
machinectl: port machinectl to format-table.[ch]

6 years agobasic: add minimalistic table formatter
Lennart Poettering [Wed, 11 Apr 2018 18:03:39 +0000 (20:03 +0200)] 
basic: add minimalistic table formatter

We have plenty of code in our codebase that outputs tables to the
console, and all is homegrown and awful. Let's replace it with a generic
implementation that can do automatically what the old implementations
did manually.

Features:

1. Ellipsation (for fields overly long) and alignment (for
   fields overly short)

2. Sorting of rows

3. automatically copies formatting from the same cell in the row above

4. Heavy use of varargs to make putting together tables easy

5. can expand and compress tables, with weights

6. Has a minimal understanding of unicode wide characters in order to
   match unicode strings to character cell terminals.

7. Columns can be reordered and individually turned off.

8. pretty printing for various data types

And more.

6 years agopager: move pager.[ch] src/shared/ → src/basic/
Lennart Poettering [Wed, 11 Apr 2018 17:57:56 +0000 (19:57 +0200)] 
pager: move pager.[ch] src/shared/ → src/basic/

pager.[ch] doesn't use any APIs from src/libsystemd/ or src/shared/
hence there's no reason for it to be in src/shared/, let's move it to
src/basic/ instead.

This enables us to use pager.[ch] APIs from other code in src/basic/,
for example pager_have() and suchlike.

6 years agostring-util: tweak ellipsation a bit
Lennart Poettering [Wed, 11 Apr 2018 17:52:25 +0000 (19:52 +0200)] 
string-util: tweak ellipsation a bit

This primarily changes to things:

1. Ellipsation to 0, 1 or 2 characters is now supported. Previously we'd
   hit an assert if the new lengths was < 3, this is now permitted. The
   result strings won't show too much info still of course, but the code
   becomes a bit more generic and robust to use.

2. If a UTF-8 mode is disabled and the input string is pure ASCII, then
   "..." is used for ellipsation, otherwise (as before) "…". This means
   on a pure-ASCII system we should remain pure-ASCII, matching
   behaviour otherwise exposed with special_glyph() and friends. Note
   that we'll use "…" for ellipsiation as soon as either the locale
   settings indicate an UTF-8 mode or the input string already contains
   non-ASCII unicode characters.

Testing for these special cases is improved.

6 years agoutil: add qsort_r_safe(), similar to qsort_safe()
Lennart Poettering [Wed, 11 Apr 2018 17:51:39 +0000 (19:51 +0200)] 
util: add qsort_r_safe(), similar to qsort_safe()

6 years agoutf8: add helper call for counting display width of strings
Lennart Poettering [Wed, 11 Apr 2018 17:50:53 +0000 (19:50 +0200)] 
utf8: add helper call for counting display width of strings

6 years agolocale: add ellipsis as special glyph
Lennart Poettering [Wed, 11 Apr 2018 17:49:50 +0000 (19:49 +0200)] 
locale: add ellipsis as special glyph

6 years agoMerge pull request #8417 from brauner/2018-03-09/add_bind_mount_fallback_to_private_d...
Lennart Poettering [Wed, 18 Apr 2018 09:56:56 +0000 (11:56 +0200)] 
Merge pull request #8417 from brauner/2018-03-09/add_bind_mount_fallback_to_private_devices

core: fall back to bind-mounts for PrivateDevices= execution environments

6 years agoMerge pull request #8735 from keszybz/small-docs-updates
Lennart Poettering [Wed, 18 Apr 2018 09:50:56 +0000 (11:50 +0200)] 
Merge pull request #8735 from keszybz/small-docs-updates

Small docs updates

6 years agoMerge pull request #8741 from poettering/assorted-stuff2
Zbigniew Jędrzejewski-Szmek [Wed, 18 Apr 2018 08:31:58 +0000 (10:31 +0200)] 
Merge pull request #8741 from poettering/assorted-stuff2

four smaller machinectl/nspawn/machined clean-ups/improvements

6 years agoman: merge two sections into two subsections of one section 8735/head
Zbigniew Jędrzejewski-Szmek [Mon, 16 Apr 2018 16:00:33 +0000 (18:00 +0200)] 
man: merge two sections into two subsections of one section

Those are very close subjects that are a good fit for one section.

6 years agoman: describe unit templating explicitly
Zbigniew Jędrzejewski-Szmek [Mon, 16 Apr 2018 15:57:37 +0000 (17:57 +0200)] 
man: describe unit templating explicitly

This patch is heavily based on the text suggested by
archenemies in #3791.

Fixes #3791.

6 years agoman: briefly document Following=
Zbigniew Jędrzejewski-Szmek [Mon, 16 Apr 2018 15:42:10 +0000 (17:42 +0200)] 
man: briefly document Following=

Fixes #1914.

6 years agoman: use --option= in more places
Zbigniew Jędrzejewski-Szmek [Wed, 18 Apr 2018 07:15:28 +0000 (09:15 +0200)] 
man: use --option= in more places

6 years agoman: be more explicit about sd-journal-upload input format
Zbigniew Jędrzejewski-Szmek [Mon, 16 Apr 2018 15:20:23 +0000 (17:20 +0200)] 
man: be more explicit about sd-journal-upload input format

Fixes #3857.

6 years agoman: add a new page with a general description of common syntax
Zbigniew Jędrzejewski-Szmek [Mon, 16 Apr 2018 15:09:58 +0000 (17:09 +0200)] 
man: add a new page with a general description of common syntax

We have a common parser, but for the user it might be
completely unobvious that the same general rules apply
to all those files. Let's add a page about the basic syntax
so that the more specific pages don't have to repeat those
details.

6 years agomeson: fix indentation for systemd-time-sync-wait(5) entries
Zbigniew Jędrzejewski-Szmek [Mon, 16 Apr 2018 15:08:21 +0000 (17:08 +0200)] 
meson: fix indentation for systemd-time-sync-wait(5) entries

Those files should not be updated manually, because then automatic updates
contain spurious "changes".

6 years agopath-util: Finish DEFAULT_PATH_NULSTR with an extra NUL (#8745)
Filipe Brandenburger [Wed, 18 Apr 2018 05:46:03 +0000 (22:46 -0700)] 
path-util: Finish DEFAULT_PATH_NULSTR with an extra NUL (#8745)

The NULSTR_FOREACH iterator needs to see an empty string at the end, so
we need to insert an extra NUL explicitly.

Also update PATH0_BIN_SBIN(x) to include an extra NUL terminator, rename
it to PATH_BIN_SBIN_NULSTR(x), which is more consistent with the similar
CONF_PATHS_NULSTR(x) macro.

Fixes: 5008da1ec1cf2cf8c15b702c4052e3a49583095d
6 years agotimesync: establish connection when network become online and the manager is not...
Yu Watanabe [Tue, 17 Apr 2018 18:56:12 +0000 (03:56 +0900)] 
timesync: establish connection when network become online and the manager is not connected yet (#8727)

This also introduces `manager_is_connected()` helper function, which
returns true when the manager is sending a request, resolving a server
name, or in a poll interval.

Follow-up for 3e85ec072180b6fbec82d715186985536859a29d.
Fixes #8719.

6 years agoMerge pull request #8739 from yuwata/add-description
Lennart Poettering [Tue, 17 Apr 2018 18:33:50 +0000 (20:33 +0200)] 
Merge pull request #8739 from yuwata/add-description

bus-util: introduce bus_open_system_watch_bind_with_description()

6 years agomeson: install nspawn tmpfiles snippet only when machined is turned on 8741/head
Lennart Poettering [Mon, 16 Apr 2018 19:40:26 +0000 (21:40 +0200)] 
meson: install nspawn tmpfiles snippet only when machined is turned on

6 years agopolkit: normalize exit values of polkit_agent_open_if_enabled()
Lennart Poettering [Mon, 16 Apr 2018 19:37:12 +0000 (21:37 +0200)] 
polkit: normalize exit values of polkit_agent_open_if_enabled()

It's strange eating up the errors here, hence don't. Let's leave this
to the caller.

6 years agoman: minor machinectl updates
Lennart Poettering [Tue, 17 Apr 2018 15:40:10 +0000 (17:40 +0200)] 
man: minor machinectl updates

6 years agomachined: some modernizations
Lennart Poettering [Thu, 5 Apr 2018 10:38:25 +0000 (12:38 +0200)] 
machined: some modernizations

A couple of minor modernizations:

1. Don't unnecessarily export functions we don't call outside of
   machined.c

2. Use cleanup logic for the manager object.

3. Propagate errors properly from manager_new(). So far if
   sd_event_new() returns EMFILE/ENFILE for some reason we would have
   logged that as log_oom(), which isn#t right, really.

4. Handle SIGTERM/SIGINT cleanly. It's easy, and prettier then letting
   the kernel just abort us. It also makes it possible to valgrind
   machined properly.

6 years agounit,meson: drop .in suffix if no substitution is required (#8740)
Yu Watanabe [Tue, 17 Apr 2018 17:49:10 +0000 (02:49 +0900)] 
unit,meson: drop .in suffix if no substitution is required (#8740)

6 years agoMerge pull request #8716 from keszybz/two-nitpicks
Lennart Poettering [Tue, 17 Apr 2018 17:34:27 +0000 (19:34 +0200)] 
Merge pull request #8716 from keszybz/two-nitpicks

Two nitpicks

6 years agonetworkd: fix dhcp4 link without routes not being considered ready (#8728)
Anssi Hannula [Tue, 17 Apr 2018 15:12:00 +0000 (18:12 +0300)] 
networkd: fix dhcp4 link without routes not being considered ready (#8728)

The dhcp4 code sets link->dhcp4_configured when dhcp4_route_handler()
has processed the last message.

However, in case UseRoutes=no has been set in the [DHCP] section, or
in case the DHCP server simply sends no routes, link_set_dhcp_routes()
will not send any netlink messages and dhcp4_route_handler() will
therefore never be called.

This causes the link to never reach LINK_STATE_CONFIGURED, and e.g.
systemd-networkd-wait-online will not consider the link as ready.

Fix that by setting link->dhcp4_configured = true and calling
link_check_ready() in dhcp4_address_handler() in case
link_set_dhcp_routes() sent no netlink messages (dhcp4_messages is
zero).

6 years agobasic/copy: fix awkward sentence 8716/head
Zbigniew Jędrzejewski-Szmek [Fri, 13 Apr 2018 10:40:11 +0000 (12:40 +0200)] 
basic/copy: fix awkward sentence

6 years agobasic/unit-name: remove duplicate check
Zbigniew Jędrzejewski-Szmek [Fri, 13 Apr 2018 10:38:11 +0000 (12:38 +0200)] 
basic/unit-name: remove duplicate check

The check that was right below already covers this case.

6 years agoresolve: set description to bus 8739/head
Yu Watanabe [Tue, 17 Apr 2018 14:56:17 +0000 (23:56 +0900)] 
resolve: set description to bus

6 years agonetwork: set description to bus
Yu Watanabe [Tue, 17 Apr 2018 14:55:27 +0000 (23:55 +0900)] 
network: set description to bus

6 years agonetworkd: fix crash if fails to get network file (#8714)
Susant Sahani [Tue, 17 Apr 2018 14:55:04 +0000 (20:25 +0530)] 
networkd: fix crash if fails to get network file (#8714)

In some situation if networkd fails to get the network file
then networkd crashes becasse the link->network is not initalized;

```
veth99: Failed to get network dhcp-client-ipv4-only: No such file or directory
Segmentation fault

gdb) r
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /home/sus/tt/systemd/build/systemd-networkd
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
warning: Loadable section ".note.gnu.property" outside of ELF segments
warning: Loadable section ".note.gnu.property" outside of ELF segments
warning: Loadable section ".note.gnu.property" outside of ELF segments

Program received signal SIGSEGV, Segmentation fault.
link_load (link=0x55555582ccd0) at ../src/network/networkd-link.c:2973
2973                 r = sd_dhcp_client_new(&link->dhcp_client, link->network->dhcp_anonymize);
(gdb) bt
(gdb) p link->network
$1 = (Network *) 0x0
(gdb) list
2968                 if (r < 0) {
2969                         log_link_debug_errno(link, r, "Failed to parse DHCPv4 address %s: %m", dhcp4_address);
2970                         goto dhcp4_address_fail;
2971                 }
2972
2973                 r = sd_dhcp_client_new(&link->dhcp_client, link->network->dhcp_anonymize);
2974                 if (r < 0)
2975                         return log_link_error_errno(link, r, "Failed to create DHCPv4 client: %m");
2976
2977                 r = sd_dhcp_client_set_request_address(link->dhcp_client, &address.in);
(gdb) r
```

6 years agohwdb: Add a 2nd accelerometer orientation quirk for the Lenovo Ideapad Miix 320 ...
Hans de Goede [Tue, 17 Apr 2018 14:51:33 +0000 (16:51 +0200)] 
hwdb: Add a 2nd accelerometer orientation quirk for the Lenovo Ideapad Miix 320 (#8734)

Different batches of the Lenovo Ideapad Miix 320 use a different sensor
it seems. Add a quirk for the model which uses the SMO8840 (ST) sensor.

6 years agologind: enable limiting of user session scopes using pam context objects (#8397)
Jan Synacek [Tue, 17 Apr 2018 14:42:44 +0000 (16:42 +0200)] 
logind: enable limiting of user session scopes using pam context objects (#8397)

6 years agobus-util: introduce bus_open_system_watch_bind_with_description()
Yu Watanabe [Tue, 17 Apr 2018 14:37:52 +0000 (23:37 +0900)] 
bus-util: introduce bus_open_system_watch_bind_with_description()

Similar to 56fbd7187a5af44a90c258fbeb1f17114f226bb3, this adds
bus_open_system_watch_bind_with_description() to set description
for busses.

6 years agoMerge pull request #8575 from keszybz/non-absolute-paths
Lennart Poettering [Tue, 17 Apr 2018 13:54:10 +0000 (15:54 +0200)] 
Merge pull request #8575 from keszybz/non-absolute-paths

Do not require absolute paths in ExecStart and friends

6 years agonetwork,resolve: remove unused variables (#8738)
Yu Watanabe [Tue, 17 Apr 2018 10:40:45 +0000 (19:40 +0900)] 
network,resolve: remove unused variables (#8738)

Follow-up for d7afd945b5aad5b262a3de97614f486d63d94612.

6 years agoMerge pull request #8696 from pabigot/issue/8683
Zbigniew Jędrzejewski-Szmek [Tue, 17 Apr 2018 09:55:12 +0000 (11:55 +0200)] 
Merge pull request #8696 from pabigot/issue/8683

Use /run/clock/synchronized to notify when clock has been synchronized

6 years agotest-execute: make find invocation a bit more efficent, increase timeout 8575/head
Zbigniew Jędrzejewski-Szmek [Wed, 11 Apr 2018 14:50:48 +0000 (16:50 +0200)] 
test-execute: make find invocation a bit more efficent, increase timeout

We go through the whole file system, so this test can take arbitrary time.  But
this test is still quite useful, so let's at least try to make it more efficent
by not descending at all into the directories we would filter out later on
anyway.

Also increase the timeout, in case the previous step doesn't help enough.

6 years agosystemd-path: allow the default search path to be queried
Zbigniew Jędrzejewski-Szmek [Mon, 26 Mar 2018 07:51:12 +0000 (09:51 +0200)] 
systemd-path: allow the default search path to be queried

6 years agotest: drop the use of /bin/sh in various test services
Zbigniew Jędrzejewski-Szmek [Sun, 25 Mar 2018 19:10:50 +0000 (21:10 +0200)] 
test: drop the use of /bin/sh in various test services

This is not meant to be comprehensive, just the few cases where the /bin/sh -c wrapper
is obviously superfluous.

6 years agosystemd: do not require absolute paths in ExecStart
Zbigniew Jędrzejewski-Szmek [Sun, 25 Mar 2018 18:50:15 +0000 (20:50 +0200)] 
systemd: do not require absolute paths in ExecStart

Absolute paths make everything simple and quick, but sometimes this requirement
can be annoying. A good example is calling 'test', which will be located in
/usr/bin/ or /bin depending on the distro. The need the provide the full path
makes it harder a portable unit file in such cases.

This patch uses a fixed search path (DEFAULT_PATH which was already used as the
default value of $PATH), and if a non-absolute file name is found, it is
immediately resolved to a full path using this search path when the unit is
loaded. After that, everything behaves as if an absolute path was specified. In
particular, the executable must exist when the unit is loaded.

6 years agoverify: use manager_load_startable_unit_or_warn() to load units for verification
Zbigniew Jędrzejewski-Szmek [Thu, 12 Apr 2018 13:58:45 +0000 (15:58 +0200)] 
verify: use manager_load_startable_unit_or_warn() to load units for verification

This doesn't change the outcome:
(before)
/home/zbyszek/src/systemd/test/test-execute/exec-basic.service:6: Executable path specifies a directory: /usr/bin/test/
exec-basic.service: Failed to create exec-basic.service/start: Unit exec-basic.service is not loaded properly: Exec format error.
(after)
/home/zbyszek/src/systemd/test/test-execute/exec-basic.service:6: Executable path specifies a directory: /usr/bin/test/
Failed to load file /home/zbyszek/src/systemd/test/test-execute/exec-basic.service: Exec format error

(before)
masked.service: Failed to create masked.service/start: Unit masked.service is masked.
(after)
File /home/zbyszek/src/systemd/test/test-execute/masked.service is masked.

but the failure is immediate and the error messages are more direct.

6 years agotests: use manager_load_startable_unit_or_warn() to load units
Zbigniew Jędrzejewski-Szmek [Thu, 12 Apr 2018 13:51:39 +0000 (15:51 +0200)] 
tests: use manager_load_startable_unit_or_warn() to load units

Doing manager_load_unit() followed by UNIT_VTABLE(unit)->start(unit) would
result in an assertion failure in ->start() if the unit failed to load
properly. Something like this is okey-ish is tests, since the test units are
not expected to fail to load, but the reason for failure is clearer if we
fail immediately.

6 years agocore/manager: split out function to verify that unit is loaded and not masked
Zbigniew Jędrzejewski-Szmek [Thu, 12 Apr 2018 13:13:14 +0000 (15:13 +0200)] 
core/manager: split out function to verify that unit is loaded and not masked

No functional change.

6 years agofuzz-unit-file: skip BOM (#8723)
Zbigniew Jędrzejewski-Szmek [Mon, 16 Apr 2018 08:59:41 +0000 (10:59 +0200)] 
fuzz-unit-file: skip BOM (#8723)

Yet another false positive from ListenNetlink,
https://oss-fuzz.com/v2/testcase-detail/4908210742886400/7694.

6 years agoSupport for Dell Inspiron 5378/5379 WLAN key (#8715)
dmig [Sun, 15 Apr 2018 08:43:58 +0000 (15:43 +0700)] 
Support for Dell Inspiron 5378/5379 WLAN key (#8715)

6 years agotime-wait-sync: use watchfile to coordinate with timesyncd 8696/head
Peter A. Bigot [Mon, 9 Apr 2018 18:39:16 +0000 (13:39 -0500)] 
time-wait-sync: use watchfile to coordinate with timesyncd

Systems that have an accurate real-time clock may have an initial
unsynchronized time that is close enough to the synchronized time that
the final adjustment doesn't trigger a waking "clock set" event.  Have
timesyncd touch a file in its runtime directory as a secondary signal
for synchronization.  Continue to support the timerfd-based trigger as a
sufficient condition when the watchfile is not present.

Closes issue #8683

6 years agounits: leave systemd-time-wait-sync disabled by default
Peter A. Bigot [Tue, 10 Apr 2018 16:05:25 +0000 (11:05 -0500)] 
units: leave systemd-time-wait-sync disabled by default

Also mark its presence conditional on ENABLE_TIMESYNCD.

6 years agofix url for binfmt documentation (#8720)
guixxx [Sat, 14 Apr 2018 13:15:19 +0000 (10:15 -0300)] 
fix url for binfmt documentation (#8720)

this file went unnoticed in PR #6223

6 years agosrc/core/dbus-cgroup.c: fix typo contoller -> controller (#8717)
Giuseppe Scrivano [Sat, 14 Apr 2018 09:06:11 +0000 (11:06 +0200)] 
src/core/dbus-cgroup.c: fix typo contoller -> controller (#8717)

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
6 years agoMerge pull request #8271 from poettering/unit-prefix-search
Zbigniew Jędrzejewski-Szmek [Fri, 13 Apr 2018 12:45:51 +0000 (14:45 +0200)] 
Merge pull request #8271 from poettering/unit-prefix-search

Search unit .d/ drop-in files also in all "dash prefixes" of a unit

6 years agoMerge pull request #8707 from poettering/copy-tweaks
Zbigniew Jędrzejewski-Szmek [Fri, 13 Apr 2018 10:10:17 +0000 (12:10 +0200)] 
Merge pull request #8707 from poettering/copy-tweaks

tweaks to fd copying code

6 years agoman: document the new dash truncation drop-in directories 8271/head
Lennart Poettering [Fri, 23 Feb 2018 19:42:57 +0000 (20:42 +0100)] 
man: document the new dash truncation drop-in directories

6 years agotest: add test for prefix unit loading
Lennart Poettering [Wed, 21 Mar 2018 18:55:54 +0000 (19:55 +0100)] 
test: add test for prefix unit loading

6 years agodropin: when looking for dropins for a unit, also look within "-" prefix unit dirs
Lennart Poettering [Fri, 23 Feb 2018 11:32:23 +0000 (12:32 +0100)] 
dropin: when looking for dropins for a unit, also look within "-" prefix unit dirs

This extends the logic by which we look for drop-ins for unit files when
loading them. Previously for a unit "foo-quux-bar.service" we'd look in
a directory "foo-quux-bar.service.d" accompanying it for extension
dropins. With this change we'll additionally look in:
"foo-quux-.service.d" and "foo-.service.d", i.e. we'll truncate the unit
name after every dash.

This is an alternative to templating for many services, as it permits
configuring defaults for sets of units that all use the same prefix in
the unit name. This is particularly useful in slice, mount and
automount units which reflect a hierarchy of concepts, as it permits
setting defaults for specific subsets of the tree. For example, in order
to provide every user with a memory of 1G it's now possible to do:

    # mkdir -p /etc/systemd/system/user-.slice.d
    # cat > /etc/systemd/system/user-.slice.d/50-memory.conf << EOF
    [Slice]
    MemoryMax=1G
    EOF
    # systemctl daemon-reload

This makes use of the fact that every user gets his own slice unit when
logging in, named "user-$UID.slice".

This doesn't precisely provide what is requested in #2556, but it does
provide equivalent functionality.

Fixes: #2556
See: #3504 #7599

6 years agosystemctl: fix indentation in output of "systemcl status" if there are multiple drop...
Lennart Poettering [Fri, 23 Feb 2018 11:31:30 +0000 (12:31 +0100)] 
systemctl: fix indentation in output of "systemcl status" if there are multiple drop-in dirs

We were a few whitespace off. Let's fix that.

6 years agocore: minor coding style changes
Lennart Poettering [Fri, 23 Feb 2018 11:30:14 +0000 (12:30 +0100)] 
core: minor coding style changes

6 years agodropin: don't fully suppress logging about ENAMETOOLONG. Just downgrade to LOG_DEBUG
Lennart Poettering [Wed, 21 Mar 2018 18:08:46 +0000 (19:08 +0100)] 
dropin: don't fully suppress logging about ENAMETOOLONG. Just downgrade to LOG_DEBUG

6 years agoload-dropin: rename variable
Lennart Poettering [Fri, 23 Feb 2018 11:20:14 +0000 (12:20 +0100)] 
load-dropin: rename variable

We are converting the unit name into its template, hence name the
variable that way, instead of the misleading 'prefix'.

6 years agounit-name: add new unit_name_build_from_type() helper
Lennart Poettering [Thu, 22 Feb 2018 17:24:57 +0000 (18:24 +0100)] 
unit-name: add new unit_name_build_from_type() helper

The new helper is much like unit_name_build() but expects a UnitType
value instead of a suffix.

6 years agocopy: rearrange flags field definition 8707/head
Lennart Poettering [Fri, 23 Mar 2018 17:27:31 +0000 (18:27 +0100)] 
copy: rearrange flags field definition

Let's use the usual 1U << 0,1,2,3,4 spelling for definiting flags enums.

6 years agocopy: reduce number of checks
Lennart Poettering [Fri, 23 Mar 2018 17:26:58 +0000 (18:26 +0100)] 
copy: reduce number of checks

We check max_bytes twice here, let's simplify that, and reduce one level
of indentation.

6 years agocopy: drop _unlikely_() that isn't obviously the case
Lennart Poettering [Fri, 23 Mar 2018 17:24:07 +0000 (18:24 +0100)] 
copy: drop _unlikely_() that isn't obviously the case

If a tool only invokes copy_bytes() a single time the _unlikely_() will always be
wrong, and is hence not useful. Let's drop it and let the compiler
figure our what to do, instead of misleading it.

Also, some coding style imprvoements.

6 years agocopy: hide in copy_bytes() the strange way splice() handles O_NONBLOCK
Lennart Poettering [Fri, 23 Mar 2018 16:44:15 +0000 (17:44 +0100)] 
copy: hide in copy_bytes() the strange way splice() handles O_NONBLOCK

splice() ignores O_NONBLOCK on pipes but not on other fds. Let's handle
that properly, and query O_ONBLOCK manually in that case, ensuring
systematic behaviour in either case.

6 years agocopy: extend copy_bytes() a bit
Lennart Poettering [Fri, 23 Mar 2018 15:41:42 +0000 (16:41 +0100)] 
copy: extend copy_bytes() a bit

Optionally, when we copy between fds with simple read/write, let's
return any remaining data we already read into the buffer if write
fails. This is useful to allow callers to use the read data otherwise,
perhaps implementing a different fallback for copying.

6 years agocopy: tweak reflink logic in copy_bytes() a bit
Lennart Poettering [Fri, 23 Mar 2018 15:36:56 +0000 (16:36 +0100)] 
copy: tweak reflink logic in copy_bytes() a bit

Let's use btrfs_clone_range() if partial copies are desired. And use
btrfs_reflink() only for full-file reflinks.

6 years agocopy: add brief comment to copy_bytes() explaining its return values
Lennart Poettering [Fri, 9 Mar 2018 21:44:47 +0000 (22:44 +0100)] 
copy: add brief comment to copy_bytes() explaining its return values