Commit Graph

39728 Commits

Author SHA1 Message Date
Frantisek Sumsal 33af88cf70 coccinelle: ignore macro transformations in the macros themselves
For example, the following transformation:

- sizeof(s)-1
+ STRLEN(s)

would replace sizeof by STRLEN even in the STRLEN macro definition
itself, which generates following nonsensical patch:

--- src/basic/macro.h
+++ /tmp/cocci-output-8753-b50773-macro.h
@@ -182,7 +182,7 @@ static inline unsigned long ALIGN_POWER2
  *          Contrary to strlen(), this is a constant expression.
  * @x: a string literal.
  */
-#define STRLEN(x) (sizeof(""x"") - 1)
+#define STRLEN(x) (STRLEN("" x ""))

 /*
  * container_of - cast a member of a structure out to the containing structure

Let's exclude the macro itself from the transformation to avoid this
2019-04-28 22:11:15 +02:00
Frantisek Sumsal 55033662f9 tree-wide: drop !! casts to booleans
Done by coccinelle/bool-cast.cocci
2019-04-28 14:32:19 +02:00
Frantisek Sumsal 4e361acc06 tree-wide: replace explicit NULL checks with their shorter variants
Done by coccinelle/equals-null.cocci
2019-04-28 14:28:49 +02:00
Frantisek Sumsal 17e3e37c05 coccinelle: avoid matching 'errno' as a file descriptor
The `coccinelle/take-fd.cocci` transformation file attempts to rewrite

r = fd;
fd = -1;

to

r = TAKE_FD(fd);

Unfortunately, using `identifier` or `idexpression` as a metavariable
type in this case wouldn't match more complex location descriptions,
like:

x->fd = fd
fd = -1;

Using 'expression' metavariable type generates false positives,
as you can't specify scope of such expression. The only real example
from the current codebase is the global 'errno' variable, which results
in following patch generated by `spatch`:

--- src/basic/errno-util.h
+++ /tmp/cocci-output-28263-971baa-errno-util.h
@@ -15,8 +15,7 @@ static inline void _reset_errno_(int *sa

 #define UNPROTECT_ERRNO                         \
         do {                                    \
-                errno = _saved_errno_;          \
-                _saved_errno_ = -1;             \
+                errno = TAKE_FD(_saved_errno_);             \
         } while (false)

 static inline int negative_errno(void) {

Let's explicitly state that the matched expression should not equal
'errno' to avoid this. It's not particularly nice, but it should be
enough, at least for now.
2019-04-27 15:46:48 +02:00
Frantisek Sumsal b3fd7b53ff coccinelle: add explicit statement isomorphisms
Coccinelle needs a custom isomorphism file with rules (isomorphisms) how
to correctly rewrite conditions with explicit NULL checks (i.e.
if (ptr == NULL)) to their shorter form (i.e. if (!ptr)). Coccinelle
already contains such isomorphisms in its default .iso file, however,
they're in the opposite direction, which results in useless output from
coccinelle/equals-null.cocci.

With this fix, `spatch` should no longer report patches like:

@@ -628,8 +628,9 @@ static int path_deserialize_item(Unit *u
                 f = path_result_from_string(value);
                 if (f < 0)
                         log_unit_debug(u, "Failed to parse result value: %s", value);
-                else if (f != PATH_SUCCESS)
-                        p->result = f;
+                else {if (f != PATH_SUCCESS)
+                                p->result = f;
+                }

         } else
                 log_unit_debug(u, "Unknown serialization key: %s", key);
2019-04-27 15:26:11 +02:00
Yu Watanabe aeafd03a2b resolve: use bridge or bonding interfaces in degraded-carrier state
Fixes #12285.
2019-04-26 10:00:06 +02:00
Franck Bui 83a32ea7b0 sd-bus: bump message queue size again
Simliarly to issue #4068, the current limit turns out to be too small for a
big storage setup that uses many small disks. Let's bump it further.
2019-04-26 09:59:02 +02:00
Franck Bui 5406c36844 udevd: notify when max number value of children is reached only once per batch of events
When booting with "udev.log-priority=debug" for example, the output might be
spammed with messages like this:

    systemd-udevd[23545]: maximum number (248) of children reached
    systemd-udevd[23545]: maximum number (248) of children reached
    systemd-udevd[23545]: maximum number (248) of children reached
    systemd-udevd[23545]: maximum number (248) of children reached
    systemd-udevd[23545]: maximum number (248) of children reached
    systemd-udevd[23545]: maximum number (248) of children reached
    systemd-udevd[23545]: maximum number (248) of children reached

While the message itself is useful, printing it per batch of events should be
enough.
2019-04-26 09:58:12 +02:00
Zbigniew Jędrzejewski-Szmek a6d04b1a17
Merge pull request #12394 from poettering/oncalendar-tweak
systemd-run --on-calendar= follow-up
2019-04-26 08:48:28 +02:00
Lennart Poettering 85318688cc chown-recursive: also check mode before we bypass 2019-04-26 08:31:08 +02:00
Lennart Poettering cbb3092ce6 json: let's not accept embedded NUL bytes when allocating JSON strings
Let's add an additional paranoia check, and not accept embedded NUL
bytes in strings, just in case.
2019-04-26 08:24:41 +02:00
Lennart Poettering b2bdf6e456 json: make log message more focussed 2019-04-26 08:22:22 +02:00
Frantisek Sumsal afa879c3b4 bash-completion: accept files for --bind/--bind-ro options 2019-04-26 08:06:23 +02:00
Frantisek Sumsal babf4f68fc bash-completion: process only non-template units for systemctl isolate 2019-04-26 08:05:05 +02:00
Frantisek Sumsal f8f542482e bash-completion: don't sort syslog priorities
By default, the available completions are sorted alphabetically, which
is counterproductive in case of syslog priorities. Override the default
behavior using the `nosort` option
2019-04-26 08:04:15 +02:00
Jérémy Rosen 6e9d246592 Document /etc/initrd-release
When systemd is started, it detects initrd by checking for that file
The usage of that file is not documented anywhere, so mention it early
in the most relevant man-page I could find.
2019-04-26 08:01:41 +02:00
Evgeny Vereshchagin bf0e551c17 Revert "Revert "README: remove Coverity Scan badge""
This reverts commit 93e4163e91.
2019-04-25 22:52:59 +02:00
Lennart Poettering 04220fda5c run: when we determine a timer cannot elapse anymore, really just warn, nothing else
When we determine that a calendar expression cannot elapse anymore,
print a warning but proceed regardless like we normally would.

Quite possibly a remote system has a different understanding of time
(timezone, system clock) than we have, hence we really shouldn't change
behaviour here client side, but log at best, and then leave the decision
what to do to the server side.

Follow-up for #12299
2019-04-25 13:40:01 +02:00
Lennart Poettering 9bb656bd0c calendarspec: make return time value of calendar_spec_next_usec() optional
If noone is interested, there's no reason to return it.

(Also document the ENOENT error code in a comment)
2019-04-25 13:21:54 +02:00
Zbigniew Jędrzejewski-Szmek c5b7ae0edb
Merge pull request #12074 from poettering/io-acct
expose IO stats on the bus and in "systemctl status" and "systemd-run --wait"
2019-04-25 11:59:37 +02:00
Frantisek Sumsal 10434dbdfd run: check if the specified calendar event is not in the past
Check if calendar event specification passed by --on-calendar runs in
some time in the future. If not, execute the given command immediately
2019-04-25 11:27:40 +02:00
Zbigniew Jędrzejewski-Szmek b6411f716c
Merge pull request #12332 from cdown/default_min
cgroup: Add support for propagation of memory.min
2019-04-25 11:06:45 +02:00
Dave Ross 4275e9b7c3 hwdb: add axis range corrections for the Dell Latitude e7250
Based on touchpad-edge-detector and dimensions confirmed with the owner's manual (https://content.etilize.com/User-Manual/1037738079.pdf)
2019-04-25 10:56:43 +02:00
Zbigniew Jędrzejewski-Szmek e87c1a458a
Merge pull request #12382 from yuwata/wireguard-12377
network: fix ListenPort= in [WireGuard] section
2019-04-25 10:55:53 +02:00
Zbigniew Jędrzejewski-Szmek 688fc38537
Merge pull request #12316 from yuwata/network-prevent-multiple-initialization-12315
network: prevent interfaces to be initialized multiple times
2019-04-25 10:54:28 +02:00
Yu Watanabe 5f707e1280 network: fix ref/unref logic for Link object
- bridge or bonding master takes a reference of slave links.
- drop link from bridge or bonding master's slave list when slave link
  is removed.
- change type of Link::slaves to Set*,

Fixes #12315.
2019-04-25 10:47:17 +02:00
Yu Watanabe bd08ce5615 network: prevent interfaces to be initialized multiple times
When a uevent is received during the relevant interface is in
LINK_STATE_PENDING, then the interface may be initialized twice.
To prevent that, this introduces LINK_STATE_INITIALIZED.
2019-04-25 10:44:46 +02:00
Yu Watanabe 84ea567eb4 udev,network: warn when .link or .network file has no [Match] section
Closes #12098.
2019-04-25 08:41:10 +02:00
Yu Watanabe a62b7bb79e network: fix ListenPort= in [WireGuard] section
This fixes a bug introduced by f1368a333e.

Fixes #12377.
2019-04-25 02:43:03 +02:00
Yu Watanabe 06895a1dda test-network: fix invalid assertions 2019-04-25 00:29:20 +02:00
Zbigniew Jędrzejewski-Szmek 2d6888cc0d
Merge pull request #12376 from mrc0mmand/deal-with-backslashes-in-completion
bash-completion: properly autocomplete escaped unit names
2019-04-24 19:45:47 +02:00
Frantisek Sumsal 9521d5582b bash-completion: unify indentation 2019-04-24 18:03:30 +02:00
Frantisek Sumsal 72c9177db2 bash-completion: properly autocomplete escaped unit names 2019-04-24 18:03:15 +02:00
Paul Menzel 1fa3ba9096 NEWS: List getty@tty1.service as not being enabled anymore
Fixes: https://github.com/systemd/systemd/issues/12345
2019-04-24 16:13:02 +02:00
Lennart Poettering aba5472979
Merge pull request #12351 from keszybz/sd-bus-add-symbol
Add symbol to tell the linker that new libsystemd version is needed
2019-04-24 10:23:10 +02:00
Zbigniew Jędrzejewski-Szmek db8d154dc4 man: describe interaction with ProtectHome=/InaccessiblePaths= in BindMount=
https://github.com/systemd/systemd/issues/7153#issuecomment-485252308

Apparently this is still confusing for people.

Longer-term, I think we should just make BindMount= automatically "upgrade"
(or "downgrade", depending on how you look at this), any InaccessiblePath=
mountpoints to "tmpfs". I don't see much point in forcing users to remember
this interaction. But let's at least document the status quo, we can always
update the docs if the code changes.
2019-04-24 10:21:37 +02:00
Jan Klötzke 99b43caf26 core: immediately trigger watchdog action on WATCHDOG=trigger
A service might be able to detect errors by itself that may require the
system to take the same action as if the service locked up. Add a
WATCHDOG=trigger state change notification to sd_notify() to let the
service manager know about the self-detected misery and instantly
trigger the configured watchdog behaviour.
2019-04-24 10:17:10 +02:00
Lennart Poettering 1329fee5da
Merge pull request #12366 from lkundrak/lr/olpc-xo-175-keyboard
Add support for OLPC XO-1.75 keyboard
2019-04-24 10:15:54 +02:00
Lennart Poettering 0a6001c134
Merge pull request #12367 from keszybz/accept-check
Put a limit on the loop to flush connections
2019-04-24 10:14:51 +02:00
Frantisek Sumsal d7707faec2 semaphore: merge semaphore scripts to avoid code duplication (#12365) 2019-04-24 07:52:49 +02:00
Zbigniew Jędrzejewski-Szmek 155dc16168 meson: do not use f-strings
Our travis CI still uses python3.5. I'm making this into a separate
commit to make it easy to revert later.
2019-04-23 22:59:19 +02:00
Zbigniew Jędrzejewski-Szmek afb9c0c958 man: document sd_bus_add_{object,fallback}_vtable
The interface provided by those two functions is huge, so this text could
probably be made two or three times as long if all details were described.
But I think it's a good start.
2019-04-23 22:58:51 +02:00
Zbigniew Jędrzejewski-Szmek bf135d288d sd-bus: when running user find function don't trust the value to be initialized
The find function is externally provided, and we shouldn't trust that the
authors remember to set the output parameter in all cases.
2019-04-23 22:58:39 +02:00
Zbigniew Jędrzejewski-Szmek d5c8d8233c busctl: add introspect --xml-interface
This wraps the call to org.freedesktop.DBus.Introspectable.Introspect.
Using "busctl call" directly is inconvenient because busctl escapes the
string before printing.

Example:
$ busctl introspect --xml org.freedesktop.systemd1 /org/freedesktop/systemd1 | pygmentize -lxml | less -RF
2019-04-23 22:58:29 +02:00
Zbigniew Jędrzejewski-Szmek d603324b4b test-bus-{vtable,introspect}: share data and test introspect_path()
test-bus-introspect is also applied to the tables from test-bus-vtable.c.

test-bus-vtable.c is also used as C++ sources to produce test-bus-vtable-cc,
and our hashmap headers are not C++ compatible. So let's do the introspection
part only in the C version.
2019-04-23 22:58:26 +02:00
Zbigniew Jędrzejewski-Szmek 31471d1ddb
Merge pull request #12320 from mrc0mmand/tweak-start-timeout-in-TEST-16-EXTEND-TIMEOUT
test: don't timeout while waiting for other test units
2019-04-23 15:48:47 +02:00
Zbigniew Jędrzejewski-Szmek 67962036f6 basic/socket-util: put a limit on the loop to flush connections
Follow-up for #12346.
2019-04-23 15:24:56 +02:00
Lubomir Rintel 0533cf4371 hwdb: Fix the key codes of the OLPC XO button pad
These are not on a key pad. These codes are sent by the "rocker" buttons
that resemble a game pad.
2019-04-23 15:20:19 +02:00
Lubomir Rintel 1430e4b653 hwdb: Fix the OLPC XO rotate key
The comment is incorrect -- this key code is sent by the rotate button,
the brightness keys are separate.
2019-04-23 15:15:33 +02:00
Lubomir Rintel 740bdfea87 hwdb: No LEDs on the OLPC XO keyboard 2019-04-23 15:15:17 +02:00