Commit graph

33053 commits

Author SHA1 Message Date
Ryan Gonzalez c5896b6a8c coredumpctl: Add debug as a gdb alias, and add lldb support (closes #8722) (#8744) 2018-04-18 21:32:17 +02:00
Lennart Poettering edd1dcd091 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
2018-04-18 18:50:06 +02:00
Lennart Poettering 7aab22308e
Merge pull request #8708 from poettering/namespace-repeat
pid1 namespacing fixes
2018-04-18 18:46:44 +02:00
Franck Bui 80359410c4 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
2018-04-18 18:32:21 +02:00
Lennart Poettering 613bddf7d1
Merge pull request #8709 from poettering/format-table
generic table formatter
2018-04-18 16:20:13 +02:00
Lennart Poettering d2bcd0ba75
path-lookup: properly chase paths when reducing with root dir (#8750)
Let's make this correct.
2018-04-18 16:19:46 +02:00
Lennart Poettering 57ea45e11a 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
2018-04-18 14:20:49 +02:00
Lennart Poettering 088696fe29 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.)
2018-04-18 14:17:50 +02:00
Lennart Poettering e871786273 namespace: improve logging when creating mount source nodes 2018-04-18 14:15:48 +02:00
Lennart Poettering f8b64b5723 namespace: split out calls to normalize mount entry list into new function 2018-04-18 14:15:48 +02:00
Lennart Poettering c9ef8573be namespace: don't consider raw image read-only if /home in it is writable 2018-04-18 14:15:48 +02:00
Lennart Poettering f10f4215b5 fs-util: export how many iterations chase_symlinks() executes at max 2018-04-18 14:15:48 +02:00
Lennart Poettering 49eb36596b 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.
2018-04-18 14:15:48 +02:00
Lennart Poettering 5da19043f1 update TODO 2018-04-18 12:52:20 +02:00
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