Commit Graph

54681 Commits

Author SHA1 Message Date
Jan Janssen
c462e63eea test: Use TEST macro in more cases
This converts to TEST macro in less trivial cases. This is mostly
due to having an intro or outro before/after the actual tests.

Some notable changes:
 - add a "test" to make sure the hashmap and ordered_hashmap tests
   from different compilation units are actually run in test-hashmap.c
 - make root arg a global var in test-install-root.c
 - slightly rework an EFI specific test in test-proc-cmdline.c
 - usage of saved_argv/saved_argc in test-process-util.c
 - splitting test-rlimit-util.c into several tests
 - moving the hwdb open check into intro in test-sd-hwdb.c
 - condense several "tests" into one in test-udev-util.c
2021-11-25 15:03:10 +01:00
Jan Janssen
4f7452a8eb test: Use TEST macro
This converts to TEST macro where it is trivial.

Some additional notable changes:
 - simplify HAVE_LIBIDN #ifdef in test-dns-domain.c
 - use saved_argc/saved_argv in test-copy.c, test-path-util.c,
   test-tmpfiles.c and test-unit-file.c
2021-11-25 15:03:06 +01:00
Jan Janssen
4d5ad9d951 test-time-util: Properly restore TZ variable
The test fails to call tzset() after unsetting TZ variable, which
could break other tests. Also, let's be nicer and actually restore
the TZ to its original value.
2021-11-25 14:56:33 +01:00
Jan Janssen
a40b728e11 test: Slightly rework DEFINE_TEST_MAIN macros
- A lot of tests want a different log level
- Provides saved_argc/saved_argv to tests
- Separate intro/outro is more flexible
2021-11-25 14:56:33 +01:00
Daan De Meyer
9df247da28 journal: Add more information to --verify error messages 2021-11-25 14:22:56 +01:00
Lennart Poettering
0cdf6b14a5 json: add new JSON_BUILD_CONST_STRING() macro
This macro is like JSON_BUILD_STRING() but uses our json library's
ability to use literal strings directly as JsonVariant objects.

The changes all our codebase to use this new macro whenever we build
JSON objects from literal strings.

(I tried to make this automatic, i.e. to detect in JSON_BUILD_STRING()
whether something is a literal string nicely and thus do this stuff
automatically, but I couldn't find a way.)

This should reduce memory usage of our JSON code a bit. Constant strings
we use very often will now be shared and mapped directly from the ELF
image.
2021-11-25 14:22:31 +01:00
Lennart Poettering
e2c7efd329 json: don't assert() if we add a NULL element via json_variant_set_field()
The rest of our JSON code tries hard to magically convert NULL inputs
into "null" JSON objects, let's make sure this also works with
json_variant_set_field().
2021-11-25 14:21:54 +01:00
Hugo Carvalho
fb0321029c Update LINGUAS (#21499) 2021-11-25 20:24:00 +09:00
Lennart Poettering
4dc07c3a9a repart,homed: split out disk cleanup macros into generic header 2021-11-25 12:10:34 +01:00
Lennart Poettering
55cb63bf6e list: add LIST_POP() helper that pops the first item off a linked list 2021-11-25 12:10:03 +01:00
Lennart Poettering
2a703778e9 man: "-j", not "-J" is the shortcut for JSON mode in homectl
The code and --help text got this right, hence fix the man page
2021-11-25 12:09:46 +01:00
Yu Watanabe
c8e16339f1 Merge pull request #21503 from poettering/ioprio-fix
work around linux 5.15 ioprio API breakage
2021-11-25 14:23:02 +09:00
Yu Watanabe
9eeaa94fd0 Merge pull request #21492 from andch-nn/add-micmute-dell-machine
Add micmute for dell machine
2021-11-25 13:52:26 +09:00
Yu Watanabe
030e2a7734 Merge pull request #21506 from poettering/homed-uidmap-fixes
homed uidmap (and other) fixes
2021-11-25 13:37:46 +09:00
Yu Watanabe
a83161d08b Merge pull request #21508 from poettering/conn-count-fix
pid1: fix connection counting
2021-11-25 13:33:13 +09:00
Dominique Martinet
7a8288f6ed build: fix build without seccomp
- execute.c: bpf functions were in the middle of an #if HAVE_SECCOMP
  block for no reason
- test-fd-util.c: make seccomp-util.h includable without depending on
  <seccomp.h>, and make is_seccomp_available() hardcoded to returning
  false in this case.
  Also fix a stray DEFINED() -- HAVE_SECCOMP is defined as 0, so normal
  #if should be used like everywhere else.
2021-11-25 13:22:32 +09:00
dependabot[bot]
68181cf8a7 build(deps): bump github/codeql-action from 1.0.23 to 1.0.24
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 1.0.23 to 1.0.24.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](a627e9fa50...e095058bfa)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-25 05:13:11 +03:00
Lennart Poettering
c91d2b4352 man: suggest usage of CollectMode= in Accept=yes services 2021-11-25 00:11:31 +01:00
Lennart Poettering
000b61b980 socket: various modernizations 2021-11-25 00:05:03 +01:00
Lennart Poettering
3fabebf45e socket: always pass socket, fd and SocketPeer ownership to service together
Per-connection socket instances we currently maintain three fields
related to the socket: a reference to the Socket unit, the connection fd,
and a reference to the SocketPeer object that counts socket peers.

Let's synchronize their lifetime, i.e. always set them all three
together or unset them together, so that their reference counters stay
synchronous.

THis will in particuar ensure that we'll drop the SocketPeer reference
whenever we leave an active state of the service unit, i.e. at the same
time we close the fd for it.

Fixes: #20685
2021-11-25 00:05:03 +01:00
Daan De Meyer
bc6b326d48 journal: Don't allow creating invalid objects
Let's not allow creating empty entry or data objects. Let's also
not allow creating data objects from data without an embedded '='
character.
2021-11-24 22:14:36 +01:00
Lennart Poettering
f7e910733c Merge pull request #21502 from keszybz/os-release-debugging
Additional debugging info to make release-extension easier to introspect
2021-11-24 22:00:02 +01:00
Dominique Martinet
3da361064b unit_is_bound_by_inactive: fix return pointer check
*ret_culprit should be set if ret_culprit has been passed a non-null value,
checking the previous *ret_culprit value does not make sense.

This would cause the culprit to not properly be assigned, leading to
pid1 crash when a unit could not be stopped.

Fixes: #21476
2021-11-24 18:42:37 +01:00
Lennart Poettering
6c68d5ad73 homework: add debug log message whenever we applied a uidmap to a mount 2021-11-24 18:42:08 +01:00
Lennart Poettering
b05f4495bd homework: fix a bad error propagation 2021-11-24 18:42:08 +01:00
Lennart Poettering
a8be098403 homework: also apply uid shifting when changing passwords/resizing/updating home areas
This adds uidmap shifting also when resizing/updating/changing
passwords. Prviously I thought we didn't have to, because the user is
not going to access the uidmap if we only quickly activate the home
area. But this thinking is wrong, because the three operations will
result in an update ~/.identity fie to be written, and we should do that
with uidmap applied, so that its ownership maps down to nobody below as
intended.

Fixes: #21441
2021-11-24 18:41:54 +01:00
Lennart Poettering
6f2c813667 homework: don't try to shift uidmap for already activated home areas
When we want to operate on an already activated home area we so far
tried to reapply the uidmapping logic. We shouldn't do that, it's
already applied after all.

We only want to apply this for newly activated home areas. Hence check
for the right HomeSetupFlags flag for it HOME_SETUP_ALREADY_ACTIVATED.

The patch is actually in theory a two-liner. Except that so far we don#t
pass the HomeSetupFlags flags down all necessary functions where the
uidmap stuff will eventually run. Hence this larger than intended
commit.
2021-11-24 18:31:51 +01:00
Lennart Poettering
eae3a68144 homework: fix message typo 2021-11-24 18:29:52 +01:00
Lennart Poettering
6b356f4498 homectl: also acquire "cheap" passwords for homectl update/passwd
In 57bb9bcba5 support was added to read
"cheap" passwords from env vars and stuff before issuing the first
operation, instead of waiting for it until the first operation failed.

This was added for most verbs of "homectl", but two were left out:
update + passwd. Add it there too.
2021-11-24 18:26:28 +01:00
Zbigniew Jędrzejewski-Szmek
f6048e5e56 dissect-image: always say "file of image" when reporting about the image
We give a path, but the path is only meaningful inside of the image.
Some messages made it clear that it's a path in the image, let's make
them all do that.
2021-11-24 17:43:01 +01:00
Zbigniew Jędrzejewski-Szmek
ed15f8bceb Add debug logs of extension-release scanning 2021-11-24 17:43:01 +01:00
Zbigniew Jędrzejewski-Szmek
48084df6ed dissect-image: provide a more useful message when ENOMEDIUM is returned 2021-11-24 17:43:01 +01:00
Zbigniew Jędrzejewski-Szmek
2284750820 dissect-image: do not enable "verification" when trying to acquire metadata
The whole point of acquiring metadata is quite often to figure out why the
image does not pass verification. Refusing to provide metadata is just being
hostile to the user.

When called from other places (e.g. image_read_metadata()), verification is
still performed.
2021-11-24 17:42:19 +01:00
Lennart Poettering
d9b8771108 test: make test-execute pass on Linux 5.15
Linux 5.15 broke kernel API:

e70344c059

Previously setting IOPRIO_CLASS_NONE for a process would then report
IOPRIO_CLASS_NONE back. But since 5.15 it reports IOPRIO_CLASS_BE
instead. Since IOPRIO_CLASS_NONE is an alias for a special setting of
IOPRIO_CLASS_BE this makes some sense, but it's also a kernel API
breakage that our testsuite trips up on.

(I made some minimal effort to inform the kernel people about this API
breakage during the 5.15 rc phase, but noone was interested.)

Either way let's hadle this gracefully in our test suite and accept
"best-effort" too when "none" was set.

(This is only triggable if the tests are run on 5.15 with full privs)
2021-11-24 16:15:14 +01:00
Lennart Poettering
8880b2bab8 man: don't mention IOSchedulingClass=none anymore in the docs
Let's not mention a redundant setting of "none". Let's instead only
mention "best-effort", which is the same. Also mention the default
settings properly.

(Also, while we are at it, don#t document the numeric alias, that's
totally redundant and harder to use, so no need to push people towards
it.)
2021-11-24 16:14:51 +01:00
Lennart Poettering
543497fa34 test: add test for ioprio normalization 2021-11-24 16:12:15 +01:00
Lennart Poettering
8b330d7d75 core: normalize ioprio values we acquire from kernel
Linux 5.15 broke API in ioprio_get(): instead of returning
IOPRIO_CLASS_NONE when that's set it now returns IOPRIO_CLASS_BE, which
is what this actually is (the former is just an alias for the latter
with a priority value of 4).

Let's hide the differences between old and new kernels here, and always
normalize to what the new kernels do.
2021-11-24 16:12:15 +01:00
Lennart Poettering
ba7772fee4 ioprio: normalize io priority values in configuration
Let's always say IOPRIO_CLASS_BE when IOPRIO_CALSS_NONE is set.
2021-11-24 16:12:15 +01:00
Lennart Poettering
0692548c73 ioprio-util: add macro for default ioprio settings
IOPRIO_CLASS_NONE with any priority value actually is an alias for
IOPRIO_CLASS_BE with priority value 4 – which is the default ioprio for
all processes.

We got this right at one place, but wrong at three others (where we
assumed the default value was 0, not 4). Let's add a
macro that encodes this properly, and use it everywhere.
2021-11-24 16:12:15 +01:00
Lennart Poettering
032b3afbf4 shared: split out ioprio related stuff into ioprio-util.[ch]
No actual code changes, just some splitting out.
2021-11-24 16:12:15 +01:00
Zbigniew Jędrzejewski-Szmek
03ae68f419 dissect-image: reuse common exit path 2021-11-24 15:55:58 +01:00
Zbigniew Jędrzejewski-Szmek
73c2c5255d shared/format-table: drop unnecessary _cleanup_ 2021-11-24 15:55:58 +01:00
Zbigniew Jędrzejewski-Szmek
9fa94e0753 test-pretty-print: spelling nitpick
The antonym of "nay" is usually spelled as "yea" (and pronouced as yā, so it
rhymes with "nay"), see e.g. https://www.cop.senate.gov/general/Features/votes.htm
2021-11-24 15:55:58 +01:00
Zbigniew Jędrzejewski-Szmek
989db9b399 shell-completion: add journalctl --facility
Fixes #21484.
2021-11-24 12:44:34 +00:00
Zbigniew Jędrzejewski-Szmek
91ee7c5ebd basic/architectures: sort by name and remove duplicates
C.f. 086df29f35.
2021-11-24 10:05:28 +01:00
Julia Kartseva
7ab3c86d63 bpf: fix memleak in restrict_fs_bpf
Memory allocated in bpf skeleton is not freed. Wrap ptr in _cleanup_.

Fixes: #21471
2021-11-24 09:37:33 +01:00
Lennart Poettering
e18dadca24 Merge pull request #21448 from poettering/disk-image-purpose
encode disk image purpose in extension-release.d + os-release
2021-11-24 09:37:04 +01:00
Lennart Poettering
aa3cc58a9f recurse-dir: give callers of recurse_dir_at() control over path prefix
One of the niceties of recurse_dir()/recurse_dir_at() is that the path
argument is decoration, it's not used for actually accessing the fs in
anyway. That's very handy in environments where chroots and relative
paths are used, as we can path in any path we like and the recursion
function will suffix with whatever it discovers but will not try to make
sense of the prefix you pass.

This works great, except that the recurse_dir_at() wrapper broke that:
it adjusted the path if NULL to "." simply for the sake of making
openat() on the top work. Let's make this adjustment more local and do
it only for the openat() itself, and otherwise pass the path through the
way we got it. This means: if a caller really wants the paths that are
concatenated to start with a "." it can just pass that. This way the
caller gets full control back of the path prefix. Win!

Note that all current users of recurse_dir_at() don't pass NULL as
second arg, hence this check is without any real effect for now. It's
preparation for future uses however.
2021-11-24 09:34:10 +01:00
Lennart Poettering
f5ba8115e0 update TODO 2021-11-23 22:55:49 +01:00
Lennart Poettering
9ead418413 test: test new SYSEXT_SCOPE=/PORTABLE_PREFIXES= fields in TEST-29 2021-11-23 22:55:49 +01:00