Commit graph

39775 commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 64538af89b udev/cdrom_id: drop unneeded parentheses 2019-05-01 11:46:42 +02:00
Lennart Poettering adb7b782f8
Merge pull request #12218 from keszybz/use-libmount-more
Use libmount more
2019-04-30 19:44:17 +02:00
Franck Bui 9f3f596477 meson: make source files including nspawn-settings.h depend on libseccomp
Since nspawn-settings.h includes seccomp.h, any file that includes
nspawn-settings.h should depend on libseccomp so the correct header path where
seccomp.h lives is added to the header search paths.

It's especially important for distros such as openSUSE where seccomp.h is not
shipped in /usr/include but /usr/include/libseccomp.

This patch is similar to 8238423095.
2019-04-30 19:31:22 +02:00
Yu Watanabe 8b803ad634 udev: drop unnecessary brackets
Follow-up for ed0cb34682.
2019-04-30 19:10:35 +02:00
Lennart Poettering 0892f3f999
Merge pull request #12420 from mrc0mmand/coccinelle-tweaks
Coccinelle improvements
2019-04-30 11:37:19 +02:00
Lennart Poettering 8d76f2905d
Merge pull request #12439 from poettering/simplify-umask-util
simplify RUN_WITH_UMASK()
2019-04-30 11:36:55 +02:00
Lennart Poettering 043d453c40 tests: add test for umask-util.h 2019-04-30 09:53:09 +02:00
Lennart Poettering 650c7a2e8b umask-util: simplify RUN_WITH_UMASK()
Why have a struct to store the iteration bit if we actually have plenty
place in mode_t?
2019-04-30 09:52:35 +02:00
Frantisek Sumsal ccd52940d0 coccinelle: further restrict certain transformations
Some transformations generate results we don't want to keep, so
let's disable such transformations for specific files.

Also, disable const-strlen.cocci everywhere, as the STRLEN macro has a
pretty limited scope, so the transformation generates false positives in
most cases.
2019-04-30 09:39:13 +02:00
Frantisek Sumsal 1f72479037 coccinelle: exclude JsonVariant* from the IN_SET transformation
JsonVariant* doesn't work with the current IN_SET implementation, so
let's exclude it from the transformation altogether
2019-04-30 09:39:13 +02:00
Frantisek Sumsal ed0cb34682 tree-wide: code improvements suggested by Coccinelle 2019-04-30 09:39:07 +02:00
Zbigniew Jędrzejewski-Szmek cb9ff7532b
Merge pull request #12434 from poettering/rm-rf-children-take-ptr
minor rm_rf_children() modernizations
2019-04-30 08:23:13 +02:00
Aaron Barany fcc72fd0f1 alloc-util: don't use malloc_usable_size() to determine allocated size
This reverts commit d4b604baea.

When realloc() is called, the extra memory between the originally
requested size and the end of malloc_usable_size() isn't copied. (at
least with the version of glibc that currently ships on Arch Linux)
As a result, some elements get lost and use uninitialized memory, most
commonly 0, and can lead to crashes.

fixes #12384
2019-04-30 08:20:59 +02:00
Lennart Poettering b9de47b97b
Merge pull request #12428 from jwrdegoede/hwdb-logitech-kbds
Hwdb: Add key-mappings for various wireless Logitech keyboards
2019-04-29 21:34:42 +02:00
Yuri Chornoivan 95a37f5979 Update Ukrainian translation 2019-04-29 21:26:39 +02:00
Lennart Poettering 987719d37d
Merge pull request #12414 from keszybz/detect-podman
Detect podman as separate container type
2019-04-29 19:07:24 +02:00
Susant Sahani b5799eeb07 networkd: Add back static routes after DHCPv4 lease expires.
1. When the DHCPv4 lease expires kernel removes the route. So add it back
when we gain lease again.

Closes https://github.com/systemd/systemd/issues/12426

2. When UseRoutes=false do not remove router
2019-04-29 18:13:31 +02:00
Hans de Goede e38fd76e5f hwdb: Fix F12 mapping on the Logitech Internet Navigator
Many Logitech keyboards have the following special functions on F9-F12:
F9: file-browser F10: document-browser F11: image-browser F12:
music-browser. These should be bound to:

 #define KEY_FILE               144     /* AL Local Machine Browser */
 #define KEY_DOCUMENTS          235
 #define KEY_IMAGES           0x1ba     /* AL Image Browser */
 #define KEY_AUDIO            0x188     /* AL Audio Browser */

This commit fixes the wrong binding of F12 to KEY_SOUND (which
translates to XF86AudioPreset) and removes the ?? comments from
both F11 and F12.
2019-04-29 17:29:08 +02:00
Hans de Goede 29516b08cb hwdb: Add key mappings for Logitech MX5500 keyboard
Add support for various custom key-codes emitted by the Logitech MX5500
keyboard, both when attached through its Bluetooth-receiver in USB-HID
proxy mode; and when connected as a Bluetooth device.
2019-04-29 17:29:08 +02:00
Hans de Goede 6736357310 hwdb: Add key mappings for Logitech MX5000 keyboard
Add support for various custom key-codes emitted by the Logitech MX5000
keyboard, both when attached through its Bluetooth-receiver in USB-HID
proxy mode; and when connected as a Bluetooth device.
2019-04-29 17:29:08 +02:00
Hans de Goede 9e2e65678d hwdb: Add key mappings for Logitech 27 MHz S520 keyboard
The upcoming kernel enumerates Logitech 27 MHz wireless keyboards and
mice by there wireless-PID, rather then using the PID of the receiver
which is the same for all 27MHz Logitech devices.

This allows us to add per model keymappings for the special keys on these
keyboards. This commit adds such mappings for the S520 keyboard
(modelnumber Y-RBA97).
2019-04-29 17:29:08 +02:00
Hans de Goede c23bc35f9b hwdb: Add key mappings for Logitech 27 MHz EX100 keyboard
The upcoming kernel enumerates Logitech 27 MHz wireless keyboards and
mice by there wireless-PID, rather then using the PID of the receiver
which is the same for all 27MHz Logitech devices.

This allows us to add per model keymappings for the special keys on these
keyboards. This commit adds such mappings for the EX100 keyboard
(modelnumber Y-RBH94).
2019-04-29 17:29:08 +02:00
Hans de Goede 0eca286716 hwdb: Add key mappings for Logitech 27 MHz MX3200 keyboard
The upcoming kernel enumerates Logitech 27 MHz wireless keyboards and
mice by there wireless-PID, rather then using the PID of the receiver
which is the same for all 27MHz Logitech devices.

This allows us to add per model keymappings for the special keys on these
keyboards. This commit adds such mappings for the MX3200 keyboard
(modelnumber Y-RAV80).
2019-04-29 17:29:08 +02:00
Hans de Goede 3008f07e02 hwdb: Add key mappings for Logitech 27 MHz MX3000 keyboard
The upcoming kernel enumerates Logitech 27 MHz wireless keyboards and
mice by there wireless-PID, rather then using the PID of the receiver
which is the same for all 27MHz Logitech devices.

This allows us to add per model keymappings for the special keys on these
keyboards. This commit adds such mappings for the MX3000 keyboard
(modelnumber Y-RAM74).
2019-04-29 17:29:08 +02:00
Hans de Goede 465a319307 hwdb: Add key mappings for Logitech 27 MHz "Cordless Rechargeable Desktop" keyboard
The upcoming kernel enumerates Logitech 27 MHz wireless keyboards and
mice by there wireless-PID, rather then using the PID of the receiver
which is the same for all 27MHz Logitech devices.

This allows us to add per model keymappings for the special keys on these
keyboards. This commit adds such mappings for the "Logitech Rechargeable
Desktop" keyboard (modelnumber Y-RK49).
2019-04-29 17:29:08 +02:00
Hans de Goede bd9133c67e hwdb: Add key mappings for Logitech 27 MHz "Cordless Access Keyboard"
The upcoming kernel enumerates Logitech 27 MHz wireless keyboards and
mice by there wireless-PID, rather then using the PID of the receiver
which is the same for all 27MHz Logitech devices.

This allows us to add per model keymappings for the special keys on these
keyboards. This commit adds such mappings for the "Logitech Cordless
Access Keyboard" (modelnumber Y-RH35).
2019-04-29 17:29:08 +02:00
Hans de Goede e016c6d6ab hwdb: Add generic key mapping for Logitech 27 MHz keyboards
The upcoming kernel enumerates Logitech 27 MHz wireless keyboards and
mice by there wireless-PID, rather then using the PID of the receiver
which is the same for all 27MHz Logitech devices.

This will allow us to add per model keymappings for the special keys on
these keyboards, which may differ per model.

This commit adds a default / fallback mapping, assigning the most common
meaning of the custom Logitech c10XX keycodes.
2019-04-29 17:29:08 +02:00
Lennart Poettering 6dc14d7366 units: drop reference to sushell man page
sushell was a Fedoraism, and has been removed since. Hence our upstream
unit files shouldn't reference it either.
2019-04-29 17:06:52 +02:00
Ben Boeckel 5238e95759 codespell: fix spelling errors 2019-04-29 16:47:18 +02:00
Lennart Poettering 50b6eec154 rm-rf: simplify rm_rf_children() a bit by using _cleanup_close_ 2019-04-29 16:21:01 +02:00
Lennart Poettering c0ba6b9286 switch-root: modernize rm_rf_children() invocation a bit 2019-04-29 16:17:29 +02:00
Frantisek Sumsal 4a4eaade60 coccinelle: exclude certain paths from the transformations
There's no point in running these transformation for certain files,
mainly anything from src/boot/efi and src/shared/linux, as this code
doesn't have access to our internal utility functions
2019-04-29 15:38:53 +02:00
Frantisek Sumsal 60d9959dd8 coccinelle: ignore function transformations causing recursion
For example, following transformation:

- isempty(s) ? NULL : s
+ empty_to_null(s)

would get applied to the empty_to_null function itself as well,
causing an infinite recursion, like:

--- src/basic/string-util.h
+++ /tmp/cocci-output-307-9f76e6-string-util.h
@@ -50,11 +50,11 @@ static inline bool isempty(const char *p
 }

 static inline const char *empty_to_null(const char *p) {
-        return isempty(p) ? NULL : p;
+        return empty_to_null(p);
 }

Let's avoid that by checking the current match position
2019-04-29 15:38:53 +02:00
Zbigniew Jędrzejewski-Szmek 90fb1f0938 basic/virt: treat "podman" as separate container type
We would detect podman as container-other. Let's assign a name to it.
Inspired by https://github.com/containers/libpod/issues/2996.
2019-04-29 15:36:26 +02:00
Zbigniew Jędrzejewski-Szmek 342bed0208 basic/virt: try the /proc/1/sched hack also for PID1
If a container manager does not set $container, we could end up
in a strange situation when detect-virt returns container-other when
run as non-pid-1 and none when run as pid-1.
2019-04-29 15:36:26 +02:00
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
Yu Watanabe 51aba17b88 network: drop invalid assertion
The link may not have corresponding .network file.
Note that in that case, link_ipv4ll_enabled() and link_dhcp4_enabled()
returns false. So, it is safe to drop the assertion.

Fixes #12422.
2019-04-28 19:54:50 +02:00
Lennart Poettering 8b6cd93044
Merge pull request #12322 from ljmf00/hwdb-accel-location-patch
Add support for ACCEL_LOCATION udev property to deal with 2 sensors
2019-04-28 17:43:54 +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
Luís Ferreira ccf4784174 hwdb: add ACCEL_LOCATION property to parse_hwdb.py
Signed-off-by: Luís Ferreira <contact@lsferreira.net>
2019-04-27 22:12:08 +01:00
Luís Ferreira cdb6b552c2 hwdb: add ACCEL_LOCATION to the allowed properties
Signed-off-by: Luís Ferreira <contact@lsferreira.net>
2019-04-27 22:12:07 +01: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
Lennart Poettering d8974757c4
Merge pull request #12407 from keszybz/two-unrelated-cleanups
Two unrelated cleanups
2019-04-26 23:43:27 +02:00
Ben Boeckel 8f8dfb9552 nspawn-expose-ports: fix a typo in error message 2019-04-26 23:42:55 +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