1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-10-28 03:25:27 +03:00
Commit Graph

31064 Commits

Author SHA1 Message Date
Lennart Poettering
8fe9c8d920 test: add a simple script that runs all our integration tests one after the other 2017-12-05 13:49:13 +01:00
Lennart Poettering
9b45c2bf02 tests: don't use "netcat" for testing TEST-10-ISSUE-2467
Apparently there are a myriad of netcat implementations around, and they
all behave slightly differently. The one I have on my Fedora 27
installation will cause a failure when invoked as "nc -U" on an AF_UNIX
socket whose connections are immediately disconnected, thus causing the
test to fail.

Let's avoid all ambiguities in this regard, and drop usage of netcat
altoegther. Instead let's use a FIFO in the file system, which we can
connect to with only shell commands, and is hence much simpler and
more reliable to test with.

The actual test is supposed to validate that PID 1 doesn't hang when
activation of a socket-activated service fails, hence which transport
mechanism is used ultimately doesn't matter, as long as we activate the
service, and we do here...
2017-12-05 13:49:13 +01:00
Lennart Poettering
f2d566b728 tests: make TEST-10-ISSUE-2467 also run in nspawn
No reason not to run it in nspawn, and it's easier to debug than the
qemu version.
2017-12-05 13:49:13 +01:00
Lennart Poettering
de54e02d5e nspawn: when in hybrid mode, chown() both the legacy and the unified hierarchy to the root in the container
If user namespacing is used, let's make sure that the root user in the
container gets access to both /sys/fs/cgroup/systemd and
/sys/fs/cgroup/unified.

This matches similar logic in cg_set_access().
2017-12-05 13:49:13 +01:00
Lennart Poettering
2d3a5a73e0 nspawn: make sure images containing an ESP are compatible with userns -U mode
In -U mode we might need to re-chown() all files and directories to
match the UID shift we want for the image. That's problematic on fat
partitions, such as the ESP (and which is generated by mkosi's
--bootable switch), because fat of course knows no UID/GID file
ownership natively.

With this change we take benefit of the uid= and gid= mount options FAT
knows: instead of chown()ing all files and directories we can just
specify the right UID/GID to use at mount time.

This beefs up the image dissection logic in two ways:

1. First of all support for mounting relevant file systems with
   uid=/gid= is added: when a UID is specified during mount it is used for
   all applicable file systems.

2. Secondly, two new mount flags are added:
   DISSECT_IMAGE_MOUNT_ROOT_ONLY and DISSECT_IMAGE_MOUNT_NON_ROOT_ONLY.
   If one is specified the mount routine will either only mount the root
   partition of an image, or all partitions except the root partition.
   This is used by nspawn: first the root partition is mounted, so that
   we can determine the UID shift in use so far, based on ownership of
   the image's root directory. Then, we mount the remaining partitions
   in a second go, this time with the right UID/GID information.
2017-12-05 13:49:12 +01:00
Lennart Poettering
bb8ad9eaca string-util: rework strextend() to optionally inset separators between each appended string
This adds a new flavour of strextend(), called
strextend_with_separator(), which takes an optional separator string. If
specified, the separator is inserted between each appended string, as
well as before the first one, but only if the original string was
non-empty.

This new call is particularly useful when appending new options to mount
option strings and suchlike, which need to be comma-separated, and
initially start out from an empty string.
2017-12-05 13:49:12 +01:00
Lennart Poettering
1cfdbe293f cgroup: also include "cgroups.threads" in the list of files to chown
Also, add "cgroups.stat". It's read-only anyway, hence its UID/GID
ownership matters little, but it's probably a good idea to keep it
ownership in sync with the other read-only files such as
"cgroups.controllers".

Also, order the list of files alphabetically.
2017-12-05 13:49:12 +01:00
Lennart Poettering
8199d554c1 nspawn: figure out cgroup mode *after* mounting image
If we operate on a disk image (i.e. --image=) then it's pointless to
look into the mount directory before it is actually mounted to see which
systemd version is running inside...

Unfortunately we only mount the disk image in the child process, but the
parent needs to know the cgroup mode, hence add some IPC for this
purpose and communicate the cgroup mode determined from the image back
to the parent.
2017-12-05 13:49:12 +01:00
Lennart Poettering
28faeda47f path-util: when checking systemd versions, check both lib and lib64
We need to check both to be compatible with multilib images.
2017-12-05 13:44:34 +01:00
Zbigniew Jędrzejewski-Szmek
3aa6a55904
Merge pull request #7542 from yuwata/build-cleanup
several build cleanups
2017-12-05 12:13:17 +01:00
Zbigniew Jędrzejewski-Szmek
ea55e886a8
Merge pull request #7476 from jhxie/ycm-meson-backend
ycm: add initial support for the meson build system
2017-12-05 10:59:24 +01:00
Zbigniew Jędrzejewski-Szmek
98b518628f
Merge pull request #7512 from yuwata/mount-create-dir
fixes related to systemd-mount and chase_symlinks()
2017-12-05 10:49:25 +01:00
Yu Watanabe
49b5b3b403 dissect-image: remove unused variable when built without libcryptsetup (#7538) 2017-12-05 10:34:46 +01:00
Boucman
bd07d3d0b4 Print the time to reach default.target in systemd-analyze time (#7383)
Example output (last line is new):
$ systemd-analyze time
Startup finished in 12.879s (firmware) + 36.999s (loader) + 1.313s (kernel) + 22.672s (initrd) + 3min 1.755s (userspace) = 4min 15.619s
graphical.target reached after 1min 39.377s in userspace
2017-12-05 10:20:40 +01:00
Yu Watanabe
a28b956732 test: increase timeout for test-async
The test calls sync(). So, on the heavy io system, the 30s default
can be easily exceeded.
2017-12-05 16:21:16 +09:00
Yu Watanabe
7f59dd3566 execute: define the variable mac_selinux_contex_net only when build with SELinux 2017-12-05 14:08:09 +09:00
Yu Watanabe
92b423b9b4 execute: define setup_smack() only if SMACK is enabled
This suppresses the following warning
```
execute.c:2149:12: warning: ‘setup_smack’ defined but not used [-Wunused-function]
 static int setup_smack(
            ^~~~~~~~~~~
```
2017-12-05 14:04:15 +09:00
Yu Watanabe
4e066f7fed bootspec: use blkid only if HAVE_BLKID is defined 2017-12-05 14:03:11 +09:00
Yu Watanabe
d6806870a2 meson: fix indentation 2017-12-05 14:01:39 +09:00
Yu Watanabe
fc11a1a204
Merge pull request #7534 from marcusfolkesson/helptext
Fix help textes for components
2017-12-04 10:34:25 +09:00
asavah
80088c7eff growfs: fix building without libcrypsetup (#7535) 2017-12-04 10:31:04 +09:00
Lennart Poettering
081f36d82d util-lib,tests: rework unbase64 so that we skip over whitespace automatically (#7522)
Let's optimize things a bit, and instead of having to strip whitespace
first before decoding base64, let's do that implicitly while doing so.
Given that base64 was designed the way it was designed specifically to
be tolerant to whitespace changes, it's a good idea to do this
automatically and implicitly.
2017-12-04 04:57:24 +09:00
Marcus Folkesson
e53fa8051d busctl: list all short options in help text
Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
2017-12-03 18:40:13 +01:00
Marcus Folkesson
672a008b48 journal-upload: remove duplication of --help and --version in help text
Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
2017-12-03 18:40:13 +01:00
Marcus Folkesson
0e5cba4d8d stio-bridge: list all short options in help text
Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
2017-12-03 18:40:13 +01:00
Marcus Folkesson
a04a902706 udevadm-control: list all short options in help text
Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
2017-12-03 18:40:13 +01:00
Marcus Folkesson
73527992c1 udevadm-info: list all short options in help text
Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
2017-12-03 18:40:07 +01:00
Marcus Folkesson
2d19c17e8e udevd: list all short options in help text
Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
2017-12-03 18:39:32 +01:00
Ikey Doherty
84786b8e32 sysusers: Provide meson argument to set gid for 'users' group (#7533)
To allow better integration with distributions requiring an explicitly
set gid for the `users` group, provide the new `-Dusers-gid` option to
set to a new numeric value.

In the absence of a specified gid, we'll fallback to the default existing
behaviour of `-` as the gid value, to automatically assign the next available
gid on the system.
2017-12-03 13:28:23 +01:00
Lennart Poettering
01a7e0a14d mount-util: do not use the official MAX_HANDLE_SZ (#7523)
If we'd use the system header's version of MAX_HANDLE_SZ then our code
would break on older kernels as soon as the value is increased, as old
kernels refuse larger buffers with EINVAL.
2017-12-03 12:18:33 +01:00
Yu Watanabe
5bc9f949a4 mount: use chase_symlinks() 2017-12-03 00:29:07 +09:00
Yu Watanabe
f4938c2ea5 mount: do not require that the specified directory exists
If the specified direcotry does not exist, then systemd creates it
when the mount unit starts. So, it is not necessary to check the
existence in the client tool.
2017-12-03 00:29:03 +09:00
Yu Watanabe
6442c2109c mount: ignore error when stop non-existing automount unit
The command `systemd-mount -u` tries to stop both mount and automount
units. If the corresponding mount unit does not exist, then it is
user's fault, that is, the specified path is not a mount point.
However, not all mount units have corresponding autmount units.
Thus, the error about non-existing automount unit is not user's falut,
and showing the error may confuse users.
So, let's ignore the error of such case.
2017-12-03 00:28:59 +09:00
Yu Watanabe
95f35cccf0 test-fs-util: add more tests for chase_symlinks() 2017-12-03 00:28:50 +09:00
Yu Watanabe
cd76d4c2fe test-fs-util: save current directory name 2017-12-03 00:25:06 +09:00
Yu Watanabe
46e92680e0 fs-util: remove comment about non-existing function 2017-12-03 00:25:00 +09:00
Yu Watanabe
a1904a4663 fs-util: chase_symlinks(): remove unnecessary slash at the head
Before this, chase_symlinks("/../../foo/bar",...) returns //foo/bar.
This removes the unnecessary slash at the head.
2017-12-03 00:24:52 +09:00
Vito Caputo
1ff8b31d9b
Merge pull request #7529 from vcaputo/trivial-style-fixups
*: fix some inconsistent control statement style
2017-12-01 16:53:38 -08:00
Vito Caputo
508f63b411 *: fix some inconsistent control statement style 2017-12-01 16:49:52 -08:00
Vito Caputo
4da47778e5
Merge pull request #7528 from vcaputo/localectl-fix-indent
localectl: fix list_vconsole_keymaps() indentation
2017-12-01 15:08:16 -08:00
Vito Caputo
a017112b3f localectl: fix list_vconsole_keymaps() indentation 2017-12-01 14:41:31 -08:00
Lukáš Nykrýn
dfeec916b5 shared/dropin: ignore ENAMETOOLONG when checking drop-in directories (#7525)
This usually happens for device units with long
path in /sys. But users can't even create such drop-ins,
so lets just ignore the error here.

Fixes #6867
2017-12-01 20:34:49 +01:00
Lennart Poettering
1a2d4d7084
Merge pull request #7237 from keszybz/growfs
Create and grow filesystems
2017-12-01 17:58:58 +01:00
Zbigniew Jędrzejewski-Szmek
89780840a2 NEWS: update the text a bit (#7524)
This fixes various typos, removes some duplications, and adds a bit more
detail in the few places which are potential pitfalls for users.
Also change the way the paragraphs about new options begin, because having
a paragraph saying "Two new options have been added", and then bit lower
again "Two new options have been added" is confusing.
2017-12-01 16:25:19 +01:00
Michael Biebl
35ccaf9332
Merge pull request #7481 from poettering/bpf-test-fix
bpf-firewall: actually invoke BPF_PROG_ATTACH to check whether cgroup/bpf is available
2017-12-01 13:52:32 +01:00
Lennart Poettering
976c047841 mount-util: tape over name_to_handle_at() flakiness (#7517)
Apparently, the kernel returns EINVAL on NFS4 sometimes, even if we do
everything right, let's fallback in that case and find a different
approach to determine if something's a mount point.

See discussion at:

https://github.com/systemd/systemd/issues/7082#issuecomment-348001289
2017-12-01 12:59:16 +01:00
Lennart Poettering
41f23fe856 sd-bus: validate the message type (#7520)
Now that sd_bus_message_new() is public API, we should insist on valid
message types.
2017-12-01 11:59:42 +01:00
Lennart Poettering
a081b9cea0 systemctl: don't use get_process_comm() on non-local PIDs (#7518)
Let's not use local process data for remote processes, that can only
show nonsense.

Maybe one day we should add a bus API to query the comm field of a
process remotely, but for now, let's not bother, the information is
redundant anyway, as the cgroup data shows it too (and the cgroup tree
is show as part of status as well, and is requested from remote through
dbus, without local kernel calls).

Fixes: #7516
2017-12-01 11:21:58 +01:00
Zbigniew Jędrzejewski-Szmek
6ae3fccb7d
Merge pull request #7521 from yuwata/news-236
NEWS update
2017-12-01 08:31:20 +01:00
Zbigniew Jędrzejewski-Szmek
69f9ccf140 util-lib: handle empty string in last_path_component
Now the function returns an empty string when given an empty string.
Not sure if this is the best option (maybe this should be an error?),
but at least the behaviour is well defined.
2017-11-30 20:54:31 +01:00