Commit Graph

33007 Commits

Author SHA1 Message Date
Yu Watanabe edac2c4716 unit,meson: drop .in suffix if no substitution is required (#8740) 2018-04-17 19:49:10 +02:00
Lennart Poettering 2341b24344
Merge pull request #8716 from keszybz/two-nitpicks
Two nitpicks
2018-04-17 19:34:27 +02:00
Anssi Hannula 223932c786 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).
2018-04-17 17:12:00 +02:00
Zbigniew Jędrzejewski-Szmek 4436e5a703 basic/copy: fix awkward sentence 2018-04-17 16:58:02 +02:00
Zbigniew Jędrzejewski-Szmek 47f7d61ad0 basic/unit-name: remove duplicate check
The check that was right below already covers this case.
2018-04-17 16:57:17 +02:00
Susant Sahani b1c626f67f 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
```
2018-04-17 16:55:04 +02:00
Hans de Goede 34ee310264 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.
2018-04-17 16:51:33 +02:00
Jan Synacek 22f9331412 logind: enable limiting of user session scopes using pam context objects (#8397) 2018-04-17 16:42:44 +02:00
Lennart Poettering 2cb36f7c1e
Merge pull request #8575 from keszybz/non-absolute-paths
Do not require absolute paths in ExecStart and friends
2018-04-17 15:54:10 +02:00
Yu Watanabe 79a4beb39f network,resolve: remove unused variables (#8738)
Follow-up for d7afd945b5.
2018-04-17 12:40:45 +02:00
Zbigniew Jędrzejewski-Szmek d84af41418
Merge pull request #8696 from pabigot/issue/8683
Use /run/clock/synchronized to notify when clock has been synchronized
2018-04-17 11:55:12 +02:00
Zbigniew Jędrzejewski-Szmek 7e4a49b42b 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.
2018-04-16 16:09:46 +02:00
Zbigniew Jędrzejewski-Szmek e12d446b66 systemd-path: allow the default search path to be queried 2018-04-16 16:09:46 +02:00
Zbigniew Jędrzejewski-Szmek 42345b178d 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.
2018-04-16 16:09:46 +02:00
Zbigniew Jędrzejewski-Szmek 5008da1ec1 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.
2018-04-16 16:09:46 +02:00
Zbigniew Jędrzejewski-Szmek f79cd1a9b2 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.
2018-04-16 16:09:27 +02:00
Zbigniew Jędrzejewski-Szmek ba412430a9 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.
2018-04-16 16:08:52 +02:00
Zbigniew Jędrzejewski-Szmek 4109ede778 core/manager: split out function to verify that unit is loaded and not masked
No functional change.
2018-04-16 16:07:27 +02:00
Zbigniew Jędrzejewski-Szmek d6ea3b78a6 fuzz-unit-file: skip BOM (#8723)
Yet another false positive from ListenNetlink,
https://oss-fuzz.com/v2/testcase-detail/4908210742886400/7694.
2018-04-16 10:59:41 +02:00
dmig 20f978643f Support for Dell Inspiron 5378/5379 WLAN key (#8715) 2018-04-15 10:43:58 +02:00
Peter A. Bigot 2dd79846dd 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
2018-04-14 09:52:40 -05:00
Peter A. Bigot 006ffa6421 units: leave systemd-time-wait-sync disabled by default
Also mark its presence conditional on ENABLE_TIMESYNCD.
2018-04-14 09:52:40 -05:00
guixxx de03b29512 fix url for binfmt documentation (#8720)
this file went unnoticed in PR #6223
2018-04-14 15:15:19 +02:00
Giuseppe Scrivano ef42f561fc src/core/dbus-cgroup.c: fix typo contoller -> controller (#8717)
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-04-14 11:06:11 +02:00
Zbigniew Jędrzejewski-Szmek b037141d1b
Merge pull request #8271 from poettering/unit-prefix-search
Search unit .d/ drop-in files also in all "dash prefixes" of a unit
2018-04-13 14:45:51 +02:00
Zbigniew Jędrzejewski-Szmek 2c8a17d097
Merge pull request #8707 from poettering/copy-tweaks
tweaks to fd copying code
2018-04-13 12:10:17 +02:00
Lennart Poettering 6c0a77953c man: document the new dash truncation drop-in directories 2018-04-13 11:34:48 +02:00
Lennart Poettering 7ce49e656b test: add test for prefix unit loading 2018-04-13 11:34:48 +02:00
Lennart Poettering 5396624506 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
2018-04-13 11:34:48 +02:00
Lennart Poettering eb2c3192dc 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.
2018-04-13 11:34:48 +02:00
Lennart Poettering b119facd27 core: minor coding style changes 2018-04-13 11:34:48 +02:00
Lennart Poettering 952713b07a dropin: don't fully suppress logging about ENAMETOOLONG. Just downgrade to LOG_DEBUG 2018-04-13 11:34:48 +02:00
Lennart Poettering 77cc47d8b4 load-dropin: rename variable
We are converting the unit name into its template, hence name the
variable that way, instead of the misleading 'prefix'.
2018-04-13 11:34:48 +02:00
Lennart Poettering 72406c2f7d 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.
2018-04-13 11:34:48 +02:00
Lennart Poettering 39c3905646 copy: rearrange flags field definition
Let's use the usual 1U << 0,1,2,3,4 spelling for definiting flags enums.
2018-04-13 11:32:46 +02:00
Lennart Poettering dd641ad1b8 copy: reduce number of checks
We check max_bytes twice here, let's simplify that, and reduce one level
of indentation.
2018-04-13 11:32:46 +02:00
Lennart Poettering 75036dce94 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.
2018-04-13 11:32:46 +02:00
Lennart Poettering e0c5c7d8fa 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.
2018-04-13 11:32:46 +02:00
Lennart Poettering 7a23c7fdfe 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.
2018-04-13 11:32:46 +02:00
Lennart Poettering 5de6e11673 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.
2018-04-13 11:32:46 +02:00
Lennart Poettering 78ba8cf770 copy: add brief comment to copy_bytes() explaining its return values 2018-04-13 11:32:46 +02:00
Zbigniew Jędrzejewski-Szmek 812724c14b
Merge pull request #8710 from poettering/triviailities-yeah-yeah
some trivial additions and fixes
2018-04-12 22:21:15 +02:00
Leonard d579a56c39 ISO-C compatibility: Remove empty initializer (#8713)
ISO-C doesn't allow empty initializers, so replace it by explicitly
initializing to zero.

Also add braces because x is a union and we initialize a subobject, so
a compiler might warn about suggesting braces.  Shut that up.
2018-04-12 21:31:19 +02:00
Zbigniew Jędrzejewski-Szmek c0af656c52 test-execute/exec-specifier.service: fix quoting
The lines would cause the whole service to fail to be loaded.
2018-04-12 16:20:02 +02:00
Lennart Poettering ce2090ab72 macro: don't rely on C's downgrade-to-bool feature for numeric comparisons 2018-04-12 11:02:47 +02:00
Lennart Poettering 42ce5f75bf install: minor enum beautifications 2018-04-12 11:02:47 +02:00
Lennart Poettering 7bc756ff00 update TODO 2018-04-12 11:02:47 +02:00
Lennart Poettering fe4377faa5 importd: ensure we don't mishandle a NULL string 2018-04-12 11:02:47 +02:00
Lennart Poettering 8460289f35 path-util: document a few other special cases for last_path_component() 2018-04-12 11:02:47 +02:00
Lennart Poettering 342f6f80f5 process-util: add TAKE_PID(), similar to TAKE_PTR/TAKE_FD, but for child process PIDs 2018-04-11 22:30:04 +02:00