Commit Graph

33039 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek e206fcc164 test-locale-util: show special glyphs
This is mostly useful as a sanity check.
2018-04-18 12:51:15 +02:00
Zbigniew Jędrzejewski-Szmek 7c6c2e07fc test-utf8: add a smoke test for utf8_console_width() 2018-04-18 12:51:15 +02:00
Lennart Poettering 99f1229d76 loginctl: port loginctl to format-table.[ch] 2018-04-18 12:51:15 +02:00
Lennart Poettering 930a08dabc machinectl: port machinectl to format-table.[ch] 2018-04-18 12:51:15 +02:00
Lennart Poettering 1960e73611 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.
2018-04-18 12:51:15 +02:00
Lennart Poettering a89e30ecb4 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.
2018-04-18 12:35:45 +02:00
Lennart Poettering c30a49b2d0 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.
2018-04-18 12:35:45 +02:00
Lennart Poettering adea407d11 util: add qsort_r_safe(), similar to qsort_safe() 2018-04-18 12:35:45 +02:00
Lennart Poettering 3f536d5bae utf8: add helper call for counting display width of strings 2018-04-18 12:35:45 +02:00
Lennart Poettering b77f5e2773 locale: add ellipsis as special glyph 2018-04-18 12:35:45 +02:00
Lennart Poettering 12777909c9
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
2018-04-18 11:56:56 +02:00
Lennart Poettering d28e92c3fc
Merge pull request #8735 from keszybz/small-docs-updates
Small docs updates
2018-04-18 11:50:56 +02:00
Zbigniew Jędrzejewski-Szmek 715a445d6d
Merge pull request #8741 from poettering/assorted-stuff2
four smaller machinectl/nspawn/machined clean-ups/improvements
2018-04-18 10:31:58 +02:00
Zbigniew Jędrzejewski-Szmek aed5cb03db man: merge two sections into two subsections of one section
Those are very close subjects that are a good fit for one section.
2018-04-18 10:04:10 +02:00
Zbigniew Jędrzejewski-Szmek 75695fb798 man: describe unit templating explicitly
This patch is heavily based on the text suggested by
archenemies in #3791.

Fixes #3791.
2018-04-18 10:04:10 +02:00
Zbigniew Jędrzejewski-Szmek 2116134b04 man: briefly document Following=
Fixes #1914.
2018-04-18 09:16:17 +02:00
Zbigniew Jędrzejewski-Szmek 492cb5095b man: use --option= in more places 2018-04-18 09:15:28 +02:00
Zbigniew Jędrzejewski-Szmek c643653e25 man: be more explicit about sd-journal-upload input format
Fixes #3857.
2018-04-18 09:11:01 +02:00
Zbigniew Jędrzejewski-Szmek 0f943ae4ea 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.
2018-04-18 09:11:01 +02:00
Zbigniew Jędrzejewski-Szmek 4298e26176 meson: fix indentation for systemd-time-sync-wait(5) entries
Those files should not be updated manually, because then automatic updates
contain spurious "changes".
2018-04-18 09:11:02 +02:00
Filipe Brandenburger 2259e8fbbc 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: 5008da1ec1
2018-04-18 07:46:03 +02:00
Yu Watanabe 0630eb1bcc 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 3e85ec0721.
Fixes #8719.
2018-04-17 20:56:12 +02:00
Lennart Poettering 3ac2e8fe17
Merge pull request #8739 from yuwata/add-description
bus-util: introduce bus_open_system_watch_bind_with_description()
2018-04-17 20:33:50 +02:00
Lennart Poettering 32b8157f88 meson: install nspawn tmpfiles snippet only when machined is turned on 2018-04-17 19:51:43 +02:00
Lennart Poettering 3b402966b9 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.
2018-04-17 19:51:43 +02:00
Lennart Poettering d47410f3fb man: minor machinectl updates 2018-04-17 19:51:43 +02:00
Lennart Poettering 730fa7ce1f 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.
2018-04-17 19:51:43 +02:00
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
Yu Watanabe 8c6afb7763 resolve: set description to bus 2018-04-17 23:56:17 +09:00
Yu Watanabe 621e450980 network: set description to bus 2018-04-17 23:55:27 +09: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
Yu Watanabe 0ddf50ffcb bus-util: introduce bus_open_system_watch_bind_with_description()
Similar to 56fbd7187a, this adds
bus_open_system_watch_bind_with_description() to set description
for busses.
2018-04-17 23:37:52 +09: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