Commit graph

29446 commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 7f7ab22892 NEWS: say that libidn2 is experimental (#6335)
Handling of "_" and some other details requires more thought:
https://gitlab.com/libidn/libidn2/issues/30

Let's switch the default back to libidn and add a note in NEWS.
2017-07-12 09:25:59 +02:00
Lennart Poettering 36ed963c6b Merge pull request #6337 from poettering/more-new-v234
Let's try to release v234 tomorrow
2017-07-12 09:25:09 +02:00
Lennart Poettering fca1b90ee8 hwdb: update hwdb again for v234 2017-07-11 19:26:10 +02:00
Lennart Poettering ac172e52d3 update NEWS file, let's try to release this tomorrow 2017-07-11 19:17:58 +02:00
Yu Watanabe 68bdd2d2d3 time-util: make parse_timestamp() return -EINVAL if the input is very old date (#6327)
This reverts 7635ab8e74 and makes parse_timestamp()
return -EINVAL if the input is older than 1970-01-01.

Fixes #6290.
2017-07-11 19:12:48 +02:00
Colin Walters 634735b56b fstab-generator: Chase symlinks where possible (#6293)
This has a long history; see see 5261ba9018
which originally introduced the behavior.  Unfortunately that commit
doesn't include any rationale, but IIRC the basic issue is that
systemd wants to model the real mount state as units, and symlinks
make canonicalization much more difficult.

At the same time, on a RHEL6 system (upstart), one can make e.g. `/home` a
symlink, and things work as well as they always did; but one doesn't have
access to the sophistication of mount units (dependencies, introspection, etc.)
Supporting symlinks here will hence make it easier for people to do upgrades to
RHEL7 and beyond.

The `/home` as symlink case also appears prominently for OSTree; see
https://ostree.readthedocs.io/en/latest/manual/adapting-existing/

Further work has landed in the nspawn case for this; see e.g.
d944dc9553

A basic limitation with doing this in the fstab generator (and that I hit while
doing some testing) is that we obviously can't chase symlinks into mounts,
since the generator runs early before mounts. Or at least - doing so would
require multiple passes over the fstab data (as well as looking at existing
mount units), and potentially doing multi-phase generation. I'm not sure it's
worth doing that without a real world use case. For now, this will fix at least
the OSTree + `/home` <https://bugzilla.redhat.com/show_bug.cgi?id=1382873> case
mentioned above, and in general anyone who for whatever reason has symlinks in
their `/etc/fstab`.
2017-07-11 18:48:57 +02:00
Yu Watanabe cd2d4c7f68 bootctl: allow non-root user to run bootctl status (#5964) 2017-07-11 11:30:29 -04:00
Zbigniew Jędrzejewski-Szmek 3616ca15f0 Merge pull request #6329 from poettering/random-mini-fixes
random-util.c mini fixes
2017-07-11 11:25:26 -04:00
Zbigniew Jędrzejewski-Szmek 13ddc3fc2b systemd: do not stop units bound to inactive units while coldplugging (#6316)
When running systemd-analyze verify I would get a random subset of warnings
(sometimes none, sometimes one or two):

dev-mapper-luks\x2d8db85dcf\x2d6230\x2d4e88\x2d940d\x2dba176d062b31.swap: Unit is bound to inactive unit dev-mapper-luks\x2d8db85dcf\x2d6230\x2d4e88\x2d940d\x2dba176d062b31.device. Stopping, too.
home.mount: Unit is bound to inactive unit dev-disk-by\x2duuid-75751556\x2d6e31\x2d438b\x2d99c9\x2dd626330d9a1b.device. Stopping, too.
boot.mount: Unit is bound to inactive unit dev-disk-by\x2duuid-56c56bfd\x2d93f0\x2d48fb\x2dbc4b\x2d90aa67144ea5.device. Stopping, too.

When running with debug on, it's pretty obvious what is happening:

home.mount: Changed dead -> mounted
home.mount: Unit is bound to inactive unit dev-disk-by\x2duuid-75751556\x2d6e31\x2d438b\x2d99c9\x2dd626330d9a1b.device. Stopping, too.
home.mount: Trying to enqueue job home.mount/stop/fail
home.mount: Installed new job home.mount/stop as 27
home.mount: Enqueued job home.mount/stop as 27
...
dev-disk-by\x2duuid-75751556\x2d6e31\x2d438b\x2d99c9\x2dd626330d9a1b.device: Installed new job dev-disk-by\x2duuid-75751556\x2d6e31\x2d438b\x2d99c9\x2dd626330d9a1b.device/start as 47
dev-disk-by\x2duuid-75751556\x2d6e31\x2d438b\x2d99c9\x2dd626330d9a1b.device: Changed dead -> plugged
dev-disk-by\x2duuid-75751556\x2d6e31\x2d438b\x2d99c9\x2dd626330d9a1b.device: Job dev-disk-by\x2duuid-75751556\x2d6e31\x2d438b\x2d99c9\x2dd626330d9a1b.device/start finished, result=done

Fixes #2206, https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=808151.
2017-07-11 10:45:03 +02:00
Zbigniew Jędrzejewski-Szmek ad1f3fe6a8 resolved: allow resolution of names which libidn2 considers invalid (#6315)
https://tools.ietf.org/html/rfc5891#section-4.2.3.1 says that
> The Unicode string MUST NOT contain "--" (two consecutive hyphens) in the third
> and fourth character positions and MUST NOT start or end with a "-" (hyphen).
This means that libidn2 refuses to encode such names.
Let's just resolve them without trying to use IDN.
2017-07-11 10:42:21 +02:00
Zbigniew Jędrzejewski-Szmek e3e42fc2b5 Add comments to log_functions which shouldn't be called from library code (#6326) 2017-07-11 10:40:11 +02:00
Lennart Poettering b5fa4c7706 random-util: we are fine if ints are 16 bytes actually
Not that it matters IRL, but let's make this less surprising to read...
2017-07-11 10:37:40 +02:00
Lennart Poettering 7b54715d19 random-util: always cast from smaller to bigger type when comparing
When we compare two size values, let's make sure we cast from the
smaller to the bigger type first, if both types differ, rather than the
reverse in order to not run into overflows.
2017-07-11 10:37:40 +02:00
Lennart Poettering f3b57eaf45 Merge pull request #6325 from keszybz/make-delta-boring-again
Make delta output repeatable
2017-07-11 10:00:21 +02:00
Zbigniew Jędrzejewski-Szmek 3f7a2973a5 Merge pull request #6322 from poettering/mount-mini-fixes
a bunch of mini fixes for mount-tool.c
2017-07-10 19:25:27 -04:00
Vito Caputo be7cdd8ec9 journal: explicitly add fds to mmap-cache (#6307)
This way we have a MMapFileDescriptor reference external to the cache,
and can supply the handle directly to mmap_cache_get(), eliminating
hashmap lookups entirely from the hot path.
2017-07-10 19:24:56 -04:00
Alex Lu 0d94d1e628 hwdb: add axis range corrections for Lenovo X1 Carbon 5th gen (over (#6320)
rmi4).
2017-07-11 06:34:40 +10:00
Lennart Poettering 514368adfb mount: add missing validation error message
We really should generate exactly one log message for each error, hence
let's do that in this one case too.
2017-07-10 21:42:39 +02:00
Zbigniew Jędrzejewski-Szmek 9f5ebb8ac9 delta: sort files and dirs before processing
This should make output deterministic, and independent of the directory
layout on disk. Just using ordered hashmaps would be enough to make
the output deterministic on a specific machine, but to make it
identical on different machines with the same set of files and
directories, names are sorted after being use.

Fixes #6157.
2017-07-10 15:41:28 -04:00
Lennart Poettering aa46fa6420 mount: change find_loop_device() error code when no loop device is found to ENXIO
ENOENT is a bit too likely to be returned for various reasons, for
example if /sys or /proc are not mounted and hence the files we need not
around. Hence, let's use ENXIO instead, which is equally fitting for the
purpose but has the benefit that the underlying calls won't generate
this error on their own, hence any ambiguity is removed.
2017-07-10 21:41:14 +02:00
Lennart Poettering a53dceb709 mount: add debug logging for the case when we knowingly ignore an error 2017-07-10 21:41:02 +02:00
Zbigniew Jędrzejewski-Szmek f6d703c395 basic/strv: use existing qsort_safe() helper
strv_sort() predates qsort_safe(), but we can convert it to it to
save a few lines.
2017-07-10 15:40:47 -04:00
Lennart Poettering 5c6803f5bd mount: rework find_loop_device() to log about no errors
We should either log about all errors in a function, or about none (and
then leave the logging about it to the caller who we propagate the error
to). Given that the callers of find_loop_device() already log about the
returned errors let's hence suppress the log messages in
find_loop_device() itself.
2017-07-10 21:39:23 +02:00
Lennart Poettering 290843c385 mount: fix potential bad memory access when /proc/self/mountinfo is empty
It's unlikely this can ever be triggered, but let's be safe rather than
sorry, and handle the case where the list of mount points is zero, and
the "l" array thus NULL. let's ensure we allocate at least one entry.
2017-07-10 21:38:36 +02:00
Lennart Poettering 565dab8ef4 man: briefly document permitted user/group name syntax for User=/Group= and syusers.d (#6321)
As discussed here:

https://lists.freedesktop.org/archives/systemd-devel/2017-July/039237.html
2017-07-10 13:44:06 -04:00
Lennart Poettering d73b607d0f update TODO 2017-07-10 18:25:58 +02:00
Boucman decd79829a expand path of systemctl link argument (#6186)
systemctl link is the only systemctl verb that takes a filename (and not
a unit name) as argument

use path_strv_make_absolute_cwd to expand the provided filename in order
to make it easier to use from the command line

keep the absolute pathname requirement when --root is used

[zj: add explicit error messages for the cases of --root and plain filename
instead of skipping normalization and just relying on systemd to refuse
to link non-absolute arguments. This allows us to make the error message
more informative.]
2017-07-09 19:52:25 -04:00
Djalal Harouni e1bc3004ab Merge pull request #6287 from keszybz/wsign-compare
build-sys: use -Wextra if available
2017-07-10 00:23:57 +02:00
Djalal Harouni 09b4922aff Merge pull request #6289 from keszybz/config-tweaks
Config parsing tweaks
2017-07-10 00:19:44 +02:00
Alex Lu 41b2478d52 hwdb: add axis range corrections for Lenovo X1 Carbon 5th gen. (#6312) 2017-07-10 08:08:25 +10:00
Djalal Harouni df6d1a29b8 Merge pull request #6311 from keszybz/memleak
Fix trivial memleak in sd-login code
2017-07-09 17:58:52 +02:00
Nikolai Kondrashov db6aedab92 units: Tell login to preserve environment (#6023)
Make agetty started by *getty* units pass '-p' option to "login", so it
doesn't clear the environment and passes whatever was setup by systemd
to shells. This is needed especially for programs which are specified as
user shells, but won't read locale settings from anywhere but
environment.

[zj: cherry-pick just the second patch from the series, see discussion
on the pull request.]
2017-07-09 10:53:31 -04:00
Yu, Li-Yu 4c4bc54697 sd_uid_get_state: do not return -ENOENT if state is "offline" (#6302) 2017-07-08 18:59:29 -04:00
Zbigniew Jędrzejewski-Szmek 964806347b sd-login: fix memleak when output argument is NULL 2017-07-08 18:04:44 -04:00
Zbigniew Jędrzejewski-Szmek c1db1a8058 networkd: trivial style cleanup 2017-07-08 17:58:44 -04:00
Yu Watanabe 7635ab8e74 time-util: make parse_timestamp() set 0 if the input is very old date (#6297)
If the input is older than "1970-01-01 UTC", then `parse_timestamp()`
fails and returns -EINVAL. However, if the input is e.g. `-100years`,
then the function succeeds and sets `usec = 0`.
This commit makes the function also succeed for old dates and set
`usec = 0`.

Fixes #6290.
2017-07-08 15:59:07 -04:00
Vito Caputo b1aa5ced45 shared: leave output_journal() output in buffer (#6304)
e268b81e moved an fflush() from output_json() to the generic
output_journal(), when it probably should have deleted all fflush()
calls from logs-show.c altogether.

The caller supplies the FILE * to these functions, and should be in
charge of flushing as needed.  The current implementation essentially
defeats any buffering stdio was bringing to the table, resulting in
extraneous tiny write() calls in commands like `journalctl -b`.

This commit removes the fflush() call from output_journal(), and adds
them to journalctl before waiting for more entries and at completion.
This way in the hot path when journalctl loops on entries stdio can
combine multiple entries into bulkier write() calls.
2017-07-07 14:32:21 -04:00
tblume 85393d8f31 tests: adapt test-functions to run tests on SUSE (#6270) 2017-07-06 14:30:14 -04:00
Benjamin Robin 46a5859673 resolve: Try to remove the ambiguity about the mtu parameter of dns_packet_new (#6285)
Actually the caller of dns_packet_new() pass 0 or the data size of the UDP message.
So try to reflect that, so rename the `mtu` parameter to `min_alloc_dsize`.

In fact `mtu` is the size of the whole UDP message, including the UDP header,
and here we just need to pass the size of data (without header). This was confusing.

Also add a check on the requested allocated size, since some caller do not check what is really allocated.
Indeed the function do not allocate more than DNS_PACKET_SIZE_MAX whatever the value of the `mtu` parameter.
2017-07-05 22:56:17 -04:00
NeilBrown 86086fce66 fstab-generator: fix new NULL dereference. (#6296)
fstype can be NULL, particularly when called from add_sysroot_mount(),
so we need to use STRPTR_IN_SET().
2017-07-05 22:53:41 -04:00
Zbigniew Jędrzejewski-Szmek 0d5e394c01 Merge pull request #6236 from yuwata/mount-loop
systemd-mount: support discovery of loop backing file
2017-07-05 10:27:58 -04:00
Yu Watanabe afde5b1630 systemd-mount: support relative paths 2017-07-05 21:55:50 +09:00
Yu Watanabe 3747daa2e5 systemd-mount: support unmounting devices on remote host
The commit 9017f5d88d prohibits
to unmount devices on remote host. This makes reenable such feature.
2017-07-05 21:55:39 +09:00
Yu Watanabe f0aac575fc systemd-mount: support discovery of loop backing file
```
$ suro systemd-mount /path/to/disk.img
Started unit run-media-system-disk.img.mount for mount point: /run/media/system/disk.img
```

Closes #6226.
2017-07-05 21:54:40 +09:00
Zbigniew Jędrzejewski-Szmek a99e002cc8 basic/log: use getenv instead of secure_getenv
secure_getenv does not work when the process has a nonempty permitted
capability set, which means that it's unduly hard to configure logging in
systemd-logind, systemd-resolved, and others.

secure_getenv is useful for code in libraries which might get called from a
setuid application. log_parse_environment() is never called from our library
code, but directly form various top-level executables. None of them are
installed suid, and none are prepared to be used this way, since many
additional changes would be required to make that safe. We may just as well
drop the check and allow SYSTEMD_LOG_* to properly parsed.

Fixes #4900.
2017-07-05 00:16:50 -04:00
Zbigniew Jędrzejewski-Szmek 5ce497b59a resolved: treat failure to parse config as non-fatal
Fixes #6014.
2017-07-05 00:16:50 -04:00
Mike Gilbert 496c486f12 test-fs-util: re-order test_readlink_and_make_absolute and test_get_files_in_directory (#6288)
test_readlink_and_make_absolute switches to a temp directory, and then
removes it.

test_get_files_in_directory calls opendir(".") from a directory that has
been removed from the filesystem.

This call sequence triggers a bug in Gentoo's sandbox library. This
library attempts to resolve the "." to an absolute path, and aborts when
it ultimately fails to do so.

Re-ordering the calls works around the issue until the sandbox library
can be fixed to more gracefully deal with this.

Bug: https://bugs.gentoo.org/590084
2017-07-04 23:22:47 -04:00
Zbigniew Jędrzejewski-Szmek 75cf1d66b0 meson: use -Wextra if available
-Wextra was not added to CFLAGS under meson by default, as it is
done by the autotools build.

C.f. 218f467111.
2017-07-04 18:26:01 -04:00
Giedrius Statkevičius 601b08420d systemctl: print next timer trigger time with the status verb (#6242)
It is useful to know when a timer will trigger next when looking at a
timer status message so calculate and print that information.

Closes #5738.

Example output:
$ systemctl status dnf-makecache.timer
● dnf-makecache.timer - dnf makecache timer
   Loaded: loaded (/usr/lib/systemd/system/dnf-makecache.timer; enabled; vendor preset: enabled)
   Active: active (waiting) since Tue 2017-07-04 17:24:02 EDT; 24min ago
  Trigger: Tue 2017-07-04 18:15:56 EDT; 27min left
2017-07-04 17:51:02 -04:00
Benjamin Robin 218f467111 basic: Fix build warning in random-util (#6284) 2017-07-04 17:42:20 -04:00