Commit Graph

30114 Commits

Author SHA1 Message Date
Lennart Poettering 81f84b33da update TODO 2017-09-26 18:00:38 +02:00
Lennart Poettering 40a80078d2 execute: let's close glibc syslog channels too
Just in case something opened them, let's make sure glibc invalidates
them too.

Thankfully so far no library opened log channels behind our back, at
least as far as I know, hence this is actually a NOP, but let's better
be safe than sorry.
2017-09-26 17:52:25 +02:00
Lennart Poettering 12145637e9 execute: normalize logging in execute.c
Now that logging can implicitly reopen the log streams when needed we
can log errors without any special magic, hence let's normalize things,
and log the same way we do everywhere else.
2017-09-26 17:51:22 +02:00
Lennart Poettering 86ffb32560 execute: drop explicit log_open()/log_close() now that it is unnecessary 2017-09-26 17:46:34 +02:00
Lennart Poettering 2c027c62dd execute: make use of the new logging mode in execute.c 2017-09-26 17:46:34 +02:00
Lennart Poettering 16e4fd87c5 log: add a mode where we open the log fds for every single log message
This we can then make use in execute.c to make error logging a bit less
special when preparing for process execution, as we can still log but
don't have any fds open continously.
2017-09-26 17:46:33 +02:00
Lennart Poettering 7558e10c98 log: let's make use of the fact that our functions return the negative error code for log_oom() too 2017-09-26 17:46:33 +02:00
Lennart Poettering 82677ae4c7 execute: downgrade a log message ERR → WARNING, since we proceed ignoring its result 2017-09-26 17:46:33 +02:00
Lennart Poettering 8002fb9747 execute: rework logging in setup_keyring() to include unit info
Let's use log_unit_error() instead of log_error() everywhere (and
friends).
2017-09-26 17:46:33 +02:00
Jan Synacek 0cde65e263 test-cpu-set-util.c: fix typo in comment (#6916) 2017-09-26 16:07:34 +02:00
Zbigniew Jędrzejewski-Szmek 4005677730 basic/log: fix return value from log_struct_iovec_internal()
This returned value so far wasn't used anywhere, so there's no change
in behaviour.
2017-09-26 16:04:33 +02:00
Lennart Poettering 2ebc688fc1 Merge pull request #6917 from keszybz/restore-some-tests
Restore some tests
2017-09-26 16:00:28 +02:00
Jan Synacek efd0802231 test-cpu-set-util.c: fix typo in comment (#6916) 2017-09-26 13:50:31 +02:00
Zbigniew Jędrzejewski-Szmek fdf666bc76 meson: hook up hwdb-test.sh again
The motivation for the ./systemd-hwdb is the same as in the grandparent
for systemd-sysv-generator.
2017-09-26 13:44:38 +02:00
Zbigniew Jędrzejewski-Szmek b7191b2a9b meson: hook up udev-test.pl again
Seems it was dropped along with the automake rules in
72cdb3e783.
2017-09-26 13:44:38 +02:00
Zbigniew Jędrzejewski-Szmek 73e406e140 sysv-generator-test: do not query $builddir
This variable is not set by meson, so let's not try to use it.

We could use some more elaborate scheme (e.g. based on $MESON_BUILD_ROOT and
$MESON_SUBDIR) to find the path to systemd-sysv-generator, but it seems
that plain ./systemd-sysv-generator works just as well and has the advantage
that it's easy to invoke the test by hand (as long as one cd's to the
meson build dir).
2017-09-26 13:44:38 +02:00
Zbigniew Jędrzejewski-Szmek a4b57b322e sysv-generator-test: drop python2 work-around
We require python3 for meson anyway, so support python2 doesn't seem
useful anymore.
2017-09-26 13:44:38 +02:00
Lennart Poettering f39c13e093 journal-verfiy: add a couple of missing le64toh() calls (#6888)
Apparently BE users don't verify their journals...

Noticed as result of #6887
2017-09-25 22:26:10 +02:00
Jonathan Lebon 35207e259e string-util: use size_t for strjoina macro (#6914)
`strlen` returns a `size_t` and `alloca` expects a `size_t`.
2017-09-25 21:56:57 +02:00
Zbigniew Jędrzejewski-Szmek 3594f80144 install: drop left-over debug message (#6913) 2017-09-25 19:59:49 +02:00
Zbigniew Jędrzejewski-Szmek efaa3176ad Merge pull request #6893 from poettering/cgroup-delegate-yay
cgroup delegation fixes, as well as socket unit slice assignment
2017-09-24 20:53:04 +02:00
Zbigniew Jędrzejewski-Szmek a2deeb41f6 Merge pull request #6891 from poettering/read-line
add read_line() helper as bounded getline() and make use of it at some places
2017-09-24 20:51:01 +02:00
Lennart Poettering cddaa1f034 Merge pull request #6887 from rantala/6447
journal: add object sanity check to journal_file_move_to_object() (#6447)
2017-09-24 19:52:07 +02:00
Zbigniew Jędrzejewski-Szmek 2e33df93de fileio: return 0 from read_one_line_file on success
Fixup for f4b51a2d09. Suggested by Evgeny Vereshchagin.
2017-09-24 14:27:21 +02:00
Tommi Rantala 10e8445bcc journal: add missing le64toh() calls in journal_file_check_object()
Lennart Poettering noticed missing le64toh() calls.
2017-09-24 11:56:52 +03:00
Zbigniew Jędrzejewski-Szmek 2c9de13912 test-fileio: also test read_line() with actual files
Just in case the real FILE and the one from fmemopen weren't exactly
the same.
2017-09-24 10:50:27 +02:00
Zbigniew Jędrzejewski-Szmek 9707d55213 test-fileio: close two leaked file handles 2017-09-24 10:50:27 +02:00
Zbigniew Jędrzejewski-Szmek 1b7ac91f94 man: add missing verb in timedatectl(1) (#6896)
As noted by Michael Biebl.
2017-09-23 16:51:41 +02:00
Zbigniew Jędrzejewski-Szmek b6e386ca1c Merge pull request #6894 from poettering/read-full-file-optimize
fileio: various fixes
2017-09-23 13:31:02 +02:00
Lennart Poettering b887cfa652 Merge pull request #6892 from keszybz/enablement-work
Fix various issues with enabled/disabled units
2017-09-23 12:44:49 +02:00
Zbigniew Jędrzejewski-Szmek 8f313f4feb test-conf-parser: add tests for the new long lines, including overflow handling 2017-09-23 11:08:57 +02:00
Zbigniew Jędrzejewski-Szmek a12807aaea test-conf-parser: use _cleanup_ 2017-09-23 11:08:57 +02:00
Zbigniew Jędrzejewski-Szmek f858e5148e fileio: use _cleanup_ for FILE unlocking 2017-09-23 11:08:57 +02:00
Lennart Poettering 620218fbd9 update TODO 2017-09-23 11:08:57 +02:00
Lennart Poettering e6dde451a5 conf-parse: remove 4K line length limit
Let's use read_line() to solve our long line limitation.

Fixes #3302.
2017-09-23 11:08:57 +02:00
Zbigniew Jędrzejewski-Szmek e3f46367f5 test-conf-parser: add some basic tests for config_parse()
This function is pretty important, but we weren't calling it directly
even once in tests.

v2: add a few tests for escaping and line continuations
2017-09-23 11:08:57 +02:00
Lennart Poettering 5a89faf0e0 fileio: initialize errno to zero before we do fread()
if there was something in the read buffer already errno might not be set
on error, let's detect that case.
2017-09-22 21:05:03 +02:00
Lennart Poettering ff0e7e05c9 fileio: try to read one byte too much in read_full_stream()
Let's read one byte more than the file size we read from stat() on the
first fread() invocation. That way, the first read() will already be
short and indicate eof to fread().

This is a minor optimization, and replaces #3908.
2017-09-22 21:03:33 +02:00
Lennart Poettering 9dd1b1e869 fileio: move fsync() logic into write_string_stream_ts()
That way, write_string_stream_ts() becomes more powerful, and we can
remove duplicate code from  write_string_file_atomic() and
write_string_file_ts().
2017-09-22 20:59:39 +02:00
Lennart Poettering b183713383 fileio: make write_string_stream() accept flags parameter
Let's make write_string_stream() and write_string_file() more alike, and
pass the same flag set so that we can remove a number of boolean
parameters.
2017-09-22 20:55:34 +02:00
Lennart Poettering 2eabcc772b fileio: support writing atomic files with timestamp
Let's make sure "ts" is taken into account when writing atomic files,
too.
2017-09-22 20:45:06 +02:00
Lennart Poettering 2351e44d3e cgroup-util: replace one use of fgets() by read_line() 2017-09-22 20:34:15 +02:00
Lennart Poettering f4b51a2d09 fileio: rework read_one_line_file() on top of read_line() 2017-09-22 20:34:15 +02:00
Lennart Poettering 189912440f def: add new constant LONG_LINE_MAX
LONG_LINE_MAX is much like LINE_MAX, but longer.

As it turns out LINE_MAX at 4096 is too short for many usecases. Since
the general concept of having a common maximum line length limit makes
sense let's add our own, and make it larger (1MB for now).
2017-09-22 20:34:15 +02:00
Lennart Poettering 4f9a66a32d fileio: add new helper call read_line() as bounded getline() replacement
read_line() is much like getline(), and returns a line read from a
FILE*, of arbitrary sizes. In contrast to gets() it will grow the buffer
dynamically, and in contrast to getline() it will place a user-specified
boundary on the line.
2017-09-22 20:34:15 +02:00
Lennart Poettering 88af31f922 socket: assign socket units to a default slice unconditionally
Due to the chown() logic socket units might end up with processes even
if no explicit command is defined for them, hence let's make sure these
processes are in the right cgroup, and that means within a slice.

Mount, swap and service units unconditionally are assigned to a slice
already, let's do the same here, too.

(This becomes more important as soon as the ebpf/firewall stuff is
merged, as there'll be another reason to fork off processes then)
2017-09-22 20:09:21 +02:00
Lennart Poettering 7960b0c704 cgroup: make use of unit_cgroup_delegate() where useful
It's an easy-to-use wrapper, so let's take benefit of it.
2017-09-22 20:02:23 +02:00
Lennart Poettering 40853aa53f cgroup: rework which files we chown() on delegation
On cgroupsv2 we should also chown()/chmod() the subtree_control file,
so that children can use controllers the way they like.

On cgroupsv1 we should also chown()/chmod() cgroups.clone_children, as
not setting this for new cgroups makes little sense, and hence delegated
clients should be able to write to it.

Note that error handling for both cases is different. subtree_control
matters so we check for errors, but the clone_children/tasks stuff
doesn't really, as it's legacy stuff. Hence we only log errors and
proceed.

Fixes: #6216
2017-09-22 20:00:53 +02:00
Lennart Poettering 5beac75e44 cgroup-util: downgrade log messages from library code to LOG_DEBUG
These errors don't really matter, that's why we log and proceed in the
current code. However, we currently log at LOG_WARNING, but we really
shouldn't given that this is library code. Hence downgrade this to
LOG_DEBUG.
2017-09-22 19:57:07 +02:00
John Lin a195dd8e5a man: Requires= needs After= to deactivate "this unit" (#6869)
Fixes: #6856
2017-09-22 19:15:28 +02:00