Commit Graph

318 Commits

Author SHA1 Message Date
Alin Popa ad5555b42e systemd: Fix busctl crash on aarch64 when setting output table format
The enum used for column names is integer type while table_set_display() is parsing
arguments on size_t alignment which may result in assert in table_set_display() if
the size between types missmatch. This patch cast the enums to size_t.
It also fixes all other occurences for table_set_display() and
table_set_sort().
2020-02-16 02:09:26 +09:00
Kevin Kuehler 9f37272a19 analyze: Add ProtectClock= to analyze-security 2020-01-26 12:44:47 -08:00
Wieland Hoffmann 287cf2d802 typo: "May modify to" -> "May modify" 2020-01-18 10:08:27 +01:00
Yu Watanabe 222a6aace7
Merge pull request #14547 from keszybz/networkctl-matching
networkctl: return error or warning when interfaces are not matched
2020-01-15 11:56:01 +09:00
Zbigniew Jędrzejewski-Szmek 191a3f1634 basic/strv: drop flags argument from strv_fnmatch() 2020-01-14 13:10:29 +01:00
Yu Watanabe 9c46b437fc analyze: optimize table creation by using table_add_many() 2020-01-10 18:28:09 +09:00
Topi Miettinen d909b40fda
analyze: badness if neither of RootImage and RootDirectory exists
Instead of requiring both RootImage and RootDirectory directives, give badness
points if neither is present. Fixes conversion in d737b451f.
2019-12-18 20:38:04 +02:00
Zbigniew Jędrzejewski-Szmek 26e1e97345 analyze: deprecate the commands moved to systemctl
This just removes the commands from --help and the man pages, everything works
as before.
2019-11-18 16:28:38 +01:00
Zbigniew Jędrzejewski-Szmek 6ab863190d systemctl: add service-watchdogs command
The rationale is the same as for log-level/log-target: this controls the behaviour
of the manager, and belongs in systemctl.
2019-11-18 16:28:38 +01:00
Zbigniew Jędrzejewski-Szmek 6962cf2e2a analyze: adjust the description of the default verb 2019-11-18 16:27:15 +01:00
Lennart Poettering 353b2baa20 tree-wide: clean up --help texts a bit
This cleans up and unifies the outut of --help texts a bit:

1. Highlight the human friendly description string, not the command
   line via ANSI sequences. Previously both this description string and
   the brief command line summary was marked with the same ANSI
   highlight sequence, but given we auto-page to less and less does not
   honour multi-line highlights only the command line summary was
   affectively highlighted. Rationale: for highlighting the description
   instead of the command line: the command line summary is relatively
   boring, and mostly the same for out tools, the description on the
   other hand is pregnant, important and captions the whole thing and
   hence deserves highlighting.

2. Always suffix "Options" with ":" in the help text

3. Rename "Flags" →  "Options" in one case

4. Move commands to the top in a few cases

5. add coloring to many more help pages

6. Unify on COMMAND instead of {COMMAND} in the command line summary.
   Some tools did it one way, others the other way. I am not sure what
   precisely {} is supposed to mean, that uppercasing doesn't, hence
   let's simplify and stick to the {}-less syntax

And minor other tweaks.
2019-11-18 15:14:43 +01:00
Lennart Poettering 8af381679d
Merge pull request #13940 from keur/protect_kernel_logs
Add ProtectKernelLogs to systemd.exec
2019-11-15 16:26:10 +01:00
Kevin Kuehler 82dce83b19 systemd-analyze: Add ProtectKernelLogs to security 2019-11-15 00:59:54 -08:00
HATAYAMA Daisuke fc9de36a3b verify: fix segmentation fault
systemd-analyze verify command now results in segmentation fault if two
consecutive non-existent unit file names are given:

    # ./build/systemd-analyze a.service b.service
    ...<snip irrelevant part>...
    Unit a.service not found.
    Unit b.service not found.
    Segmentation fault (core dumped)

The cause of this is a wrong handling of return value of
manager_load_startable_unit_or_warn() in verify_units() in failure case.

It looks that the current logic wants to assign the first error status
throughout verify_units() into variable r and count up variable count only when
a given unit file exists.

However, due to the wrong handling of the return value of
manager_load_startable_unit_or_warn() in verify_units(), the variable count is
unexpectedly incremented even when there is no such unit file because the
variable r already contains non-zero value in the 2nd failure, set by the 1st
failure, and then the condition k < 0 && r == 0 evaluates to false.

This commit fixes the wrong handling of return value of
manager_load_startable_unit_or_warn() in verify_units().
2019-11-13 22:20:01 +01:00
Lennart Poettering d816a5fcea analyze: drop spurious newline 2019-11-13 12:58:15 +01:00
Lennart Poettering 985c18802d analyze: add --base-time= to specify base time for 'calendar' verb 2019-11-13 12:57:17 +01:00
Yu Watanabe a969d60645 tree-wide: drop locale.h when locale-util.h is included 2019-11-04 00:30:32 +09:00
Yu Watanabe f5947a5e92 tree-wide: drop missing.h 2019-10-31 17:57:03 +09:00
Lennart Poettering 81610e9609 analyze: fix minor memleak 2019-10-30 15:50:37 +01:00
Lennart Poettering ea334dc328 analyze: sort list of unknown syscalls kernel implements 2019-10-30 15:50:06 +01:00
Zbigniew Jędrzejewski-Szmek df7c4eb62a various tools: be more explicit when a glob is passed when not supported
See https://bugzilla.redhat.com/show_bug.cgi?id=1763488: when we say that
'foo@*.service' is not a valid unit name, this is not clear enough. Let's
include the name of the operation that does not support globbing in the
error message:

$ build/systemctl enable 'foo@*.service'
Glob pattern passed to enable, but globs are not supported for this.
Invalid unit name "foo@*.service" escaped as "foo@\x2a.service".
...
2019-10-25 13:41:49 +09:00
Johannes Christ 7f024cb211 Fix typo in `analyze-security.c`. 2019-08-11 06:08:42 +09:00
Jan Synacek 28a06f5abe analyze-security: move assert above first use of the variable (#13238) 2019-07-31 16:13:35 +02:00
Mike Gilbert 417b82e1c3 analyze: declare dump_exit_status outside of HAVE_SECCOMP block
Fixes: 76ed04d936
Closes: https://github.com/systemd/systemd/issues/13230
2019-07-31 09:43:03 +09:00
Lennart Poettering 5756bff6f1
Merge pull request #13119 from keszybz/unit-loading-2
Rework unit loading to take into account all aliases
2019-07-30 17:55:37 +02:00
Zbigniew Jędrzejewski-Szmek 91e0ee5f16 pid1: drop unit caches only based on mtime
v2:
- do not watch mtime of transient and generated dirs

  We'd reload the map after every transient unit we created, which we don't
  need to do, since we create those units ourselves and know their fragment
  path.
2019-07-30 14:01:46 +02:00
Zbigniew Jędrzejewski-Szmek e67cd21d7d analyze: add "unit-files" to dump the unit fragment map
I'm not convinced that this is useful enough to be included... But it is
certainly nice when debugging.
2019-07-30 14:01:46 +02:00
Lennart Poettering d68d0366dc analyze: clarify that 'exit-status' optionally takes arguments 2019-07-29 19:44:24 +02:00
Lennart Poettering d8e17e7356 analyze: right-align exit status column 2019-07-29 19:22:34 +02:00
Lennart Poettering 5238d9a83a analyze: rename "exit-codes" to "exit-status"
waitid(2) and the libc function signature calls this "exit status", and
uses "exit code" for something different. Let's stick to the same
nomenclature hence.
2019-07-29 19:22:22 +02:00
Lennart Poettering 563067ad26 analyze: always use "int" to display exit status values
That's what it actually is, hence let's use that and cast when the type
is bigger.
2019-07-29 19:14:09 +02:00
Lennart Poettering 1d7458fbb1
Merge pull request #13207 from keszybz/symbolic-exit-code-names
Symbolic exit code names
2019-07-29 18:58:06 +02:00
Lennart Poettering 49139a5d92 analyze: dot(1) man page link should be urlified
I mean, let's not miss out on this excellent opportunity to use
hyperlinks on terminals.

(Unfortunately not see unless you invoke 'systemd-analyze --no-pager
--help', because 'less' is so much stuck in the past :-(.)
2019-07-29 16:08:18 +02:00
Zbigniew Jędrzejewski-Szmek 76ed04d936 analyze: add exit-codes verb 2019-07-29 15:54:53 +02:00
Zbigniew Jędrzejewski-Szmek 3151b668c2
Merge pull request #13076 from keszybz/pr/13062
Timer formatting fixes
2019-07-16 20:02:26 +02:00
Lennart Poettering c1b71f3a61
Merge pull request #13074 from poettering/format-tree-many
table_add_many() improvements
2019-07-16 16:03:54 +02:00
Zbigniew Jędrzejewski-Szmek 4252171a94 tree-wide: use lowercase table headers
https://github.com/systemd/systemd/pull/13062#discussion_r303847484
> the formatter uppercases them anyway, and this way the JSON output of the
> formatter is nicer as it uses the table header fields 1:1 for the json
> output.
2019-07-16 14:29:04 +02:00
Lennart Poettering 2cb434cfc1 analyze: port over one part of systemd-analyze to use new table_add_many() concepts 2019-07-16 12:45:38 +02:00
Zbigniew Jędrzejewski-Szmek 08f105df24 analyze: fix formatting of timestamps with 0 µs
There is a rule that "%.0d" formats 0 as "". There is no such rule for
"%0d" and 0 :(. The output had an extra 0 if usec was 0.
2019-07-15 19:11:16 +02:00
Yu Watanabe af2d6d477c analyze: format output of 'systemd-analyze timestamp' by using Table 2019-07-16 01:14:20 +09:00
Yu Watanabe 7503c6e80e analyze: format output of 'systemd-analyze timespan' by using Table 2019-07-16 01:07:31 +09:00
Yu Watanabe 9c712cf285 analyze: format output of 'systemd-analyze calendar' by using Table 2019-07-16 00:46:10 +09:00
Yu Watanabe d8bfdbe1fa analyze: format output of 'systemd-analyze blame' by using Table 2019-07-16 00:19:59 +09:00
Zbigniew Jędrzejewski-Szmek 1f65fd4926 basic/time-util: add helper function to check if timestamp is set
No functional change.
2019-07-04 19:12:47 +02:00
Zbigniew Jędrzejewski-Szmek edfea9fe0d analyze: add 'condition' verb
We didn't have a straightforward way to parse and evaluate those strings.
Prompted by #12881.
2019-06-27 10:54:37 +02:00
Kai Lüke fab347489f bpf-firewall: custom BPF programs through IP(Ingress|Egress)FilterPath=
Takes a single /sys/fs/bpf/pinned_prog string as argument, but may be
specified multiple times. An empty assignment resets all previous filters.

Closes https://github.com/systemd/systemd/issues/10227
2019-06-25 09:56:16 +02:00
Zbigniew Jędrzejewski-Szmek ea62aa24ae analyze: also print unix time in "timestamp" 2019-05-21 09:56:41 +02:00
Zbigniew Jędrzejewski-Szmek c269607f9b analyze: give a hint about calendar/timestamp/timespan use
This should help clear up the confusion in
https://bugzilla.redhat.com/show_bug.cgi?id=1711065.
2019-05-21 09:56:41 +02:00
Zbigniew Jędrzejewski-Szmek 2cae4711f3 analyze: add 'timestamp' verb
We had 'calendar' and 'timespan', but the third one was missing.
Also consistently order the verbs as calendar/timestamp/timespan in help.

The output from 'timespan' is highlighted more.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1711065.
2019-05-17 10:09:32 +02:00
Zbigniew Jędrzejewski-Szmek b99f4d484b analyze: drop redundant call to calendar_spec_normalize()
calendar_spec_from_string() already does that.
2019-05-16 23:14:41 +02:00