1
0
mirror of https://github.com/systemd/systemd.git synced 2025-02-20 01:58:18 +03:00

57362 Commits

Author SHA1 Message Date
Yu Watanabe
17d97d4c90 udev: create disk/by-diskseq symlink only when the device has diskseq
Follow-up for 0d08db7f89ee665a9dcb6dd66c1f9e203192e8ec.
2022-04-13 23:09:47 +09:00
Lennart Poettering
c87c307806
Merge pull request #23065 from poettering/env-var-generator
pid1: pass additional env vars about exec context to generators
2022-04-13 13:44:30 +02:00
Lennart Poettering
cfb5bf23d3 update TODO 2022-04-13 10:44:56 +02:00
Lennart Poettering
5b9d199ab4 man: document new generator env vars 2022-04-13 10:44:56 +02:00
Lennart Poettering
a1d0557440 man: rebreak all paragraphs in systemd.generator(7) 2022-04-13 10:07:46 +02:00
Lennart Poettering
82c5db16cc pid1: pass useful env vars to generators
This is inspired by this:

    https://github.com/systemd/zram-generator/blob/main/src/generator.rs#L29

Given it's easy for PID 1 to pass this to generators, I thin we should.
All generators not written by us likely want to know these things so
that the can adjust to the execution environment.
2022-04-13 10:07:46 +02:00
Zbigniew Jędrzejewski-Szmek
87d44b6e1a
Merge pull request #23002 from yuwata/udev-use-child-event
udev: use child event source
2022-04-13 08:32:16 +02:00
Lennart Poettering
5e9f594038
Merge pull request #23061 from poettering/chase-symlinks-tweaks,-new
some chase_symlinks() tweaks
2022-04-12 22:57:17 +02:00
Yu Watanabe
5180394b38 core: use assert_se() which takes side-effect
Fixes #23059.
2022-04-12 18:45:20 +02:00
Yu Watanabe
82e0b63183 udev: use child event source to manage workers 2022-04-13 01:08:42 +09:00
Yu Watanabe
a79cba3326 udev: use EventResult type
This also adds EVENT_RESULT_SUCCESS for readability.
2022-04-13 01:00:08 +09:00
Yu Watanabe
fbae50904f sd-event: make inotify event work after the process is forked 2022-04-13 01:00:08 +09:00
Yu Watanabe
86587c93b0 sd-event: do not kill a child process from another child 2022-04-13 01:00:08 +09:00
Yu Watanabe
01e6af7374 sd-event: do not update signal fd after PID is changed
Otherwise, child event source will not work after the process is forked
and the event source is unref()ed on the child process.
2022-04-13 01:00:08 +09:00
Yu Watanabe
54988a27b9 sd-event: set pid to event source after all setup processes finished
Otherwise, the assertion in source_disconnect() may be triggered,
2022-04-13 01:00:08 +09:00
Yu Watanabe
91c700713f sd-event: rebreak comments 2022-04-13 01:00:08 +09:00
Lennart Poettering
57f9ca3aa0 chase-symlinks: prefer path_extract_directory() over dirname() 2022-04-12 17:10:50 +02:00
Lennart Poettering
860f4c6aa6 chase-symlinks: add comment for opaque argument 2022-04-12 17:10:06 +02:00
Lennart Poettering
0ac6cdd6ae chase-symlinks: add missing OOM check 2022-04-12 17:09:21 +02:00
Lennart Poettering
69cf392f8e chase-symlinks: use empty_to_root() where appropriate 2022-04-12 17:08:33 +02:00
Lennart Poettering
7b9be862c7 chase-symlinks: avoid using stack allocation for potentially huge paths
let's better be safe and use heap allocation for paths which might be
unbounded.

In particular as previously we copied the stack memory to heap anyway,
via a noop path_make_absolute_cwd() call.
2022-04-12 17:07:49 +02:00
Lennart Poettering
8f47f880a4 chase-symlinks: use proper typedef for flags argument 2022-04-12 17:06:49 +02:00
Yu Watanabe
d89e18cc38
Merge pull request #23057 from keszybz/various-doc-tweaks
Various doc tweaks
2022-04-12 23:09:51 +09:00
Zbigniew Jędrzejewski-Szmek
52e30c6f81 man: add "internal" to "reference counter" 2022-04-12 15:33:05 +02:00
Zbigniew Jędrzejewski-Szmek
edef9c469a docs/RELEASE: also mention syscall tables 2022-04-12 15:28:39 +02:00
Zbigniew Jędrzejewski-Szmek
3983fc0227 README: recommend zstd over xz
git archive automatically uses gzip when --output=*.tar.gz is used, but
not for other extensions. Thus we need to invoke the compressor separately :(

It's a good pattern to use a variable for the repeating number, so let's
recommend that.
2022-04-12 15:28:33 +02:00
Zbigniew Jędrzejewski-Szmek
e8a688178c docs: stop recommending meson compile
With meson-0.60, meson compile stopped working with some targets:

$ meson compile -C build update-man-rules
ERROR: Can't invoke target `update-man-rules`: ambiguous name. Add target type and/or path: `PATH/NAME:TYPE`

This is obviously a regression in meson, but based on a chat with the
maintainers, it seems that there's some disagreement as to whether 'meson
compile' is useful and how exactly it should work. Since we're already at
meson 0.60.3 and this hasn't been fixed, and people generally don't seem to
consider this an issue, let's return to documenting the usual practice of
'ninja -C build' that just works everywhere.

(Since nobody has raised any fuss in systemd, it means that people are
generally using the shorter form during development too. I only noticed
because I pasted a command from the release docs when preparing -rc1.)
2022-04-12 12:35:44 +02:00
Zbigniew Jędrzejewski-Szmek
2a1a7910f9 man: add page for sd_device_{ref,unref,unrefp}
Gotta start somewhere.
2022-04-12 12:35:44 +02:00
Zbigniew Jędrzejewski-Szmek
69e6a46970 man: say libudev should not be used for new projects 2022-04-12 12:28:24 +02:00
Zbigniew Jędrzejewski-Szmek
fc6f59aedc man: add landing page for sd-device
We got documentation for sd-device for the first time with
b51f4eaf7b58f064092215cea9c6fc1c5af5646e, so let's celebrate by adding a
landing page that also explains the relationship with libudev.
2022-04-12 12:28:24 +02:00
Zbigniew Jędrzejewski-Szmek
ff9412c152 Fix man page links
Based on linkchecker as usual.
2022-04-12 11:02:16 +02:00
Peter Hutterer
bc85f8b51d udev-builtin-input_id: use heuristics to detect joysticks
Several keyboard devices are erroneously tagged with ID_INPUT_JOYSTICK
because of random buttons they set. For example, the LiteOn Lenovo
Calliope USB Keyboard sets BTN_TRIGGER, BTN_TOP2, BTN_PINKIE and
BTN_BASE, see libinput issue 745 for details.

ID_INPUT_JOYSTICK triggers the uaccess rules, making those keyboards
easily accessible. That's not a problem in the LiteOn example since that
event node doesn't contain the normal keys and eavesdropping on volume
keys is probably not very interesting.

Improve the joystick detection by adding heuristics similar to what
libinput 1.20 uses: check for some specific set of keys that are common
on keyboards but very unlikely on joysticks. If enough of those are
present (or the device has less than 2 axes or joysticks), don't tag it
as joystick.

libinput also checks for > 10 keyboard keys, but this is not done here
to be more conservative.
2022-04-12 09:24:25 +02:00
Yu Watanabe
e2185ffef8
Merge pull request #23051 from poettering/udev-tweaklets-2
udev: three minor tweaks
2022-04-12 14:06:53 +09:00
Yu Watanabe
68fe012fdf
Merge pull request #23048 from keszybz/Add-more-tests-for-specifiers
Add more tests for specifiers
2022-04-12 14:04:48 +09:00
Zbigniew Jędrzejewski-Szmek
9a5893e9bb tree-wide: host_name → hostname
We use "hostname" exclusively in docs, and also in a big majority of the
code. Let's use the same spelling in remaining places.
2022-04-11 21:02:34 +02:00
Zbigniew Jędrzejewski-Szmek
8b4679a684 test-unit-name: add missing tests for specifiers, fix existing tests
It turns out that in fa3cd7394c227ad38c5c09b2bc2d035e7fb14a76 back
in 2013 I got the test reversed: assert_se(strncmp()) should be
assert_se(strncmp==0). So the tests that were using "*" were not entirely
useful ;) The function was refactored a bunch of times since then, and it
seems nobody noticed.

So let's replace this fragile construct by a simple fnmatch, which also
has the advantage that the glob can be inserted in arbitrary places.

Following up for d0aba07f1ac8d6df2ccfa033fe1e195b1b9e5272: we should have at
least basic tests for all interfaces, even the deprecated ones, so that we
catch obvious errors. This sorts the specifiers the same way that they are
declared in the unit-printf.c, and adds tests for all the specifiers. We
even were setting 'shell', but not using it in a test.

Also, we shouldn't initialize variables in tests. This catches the error fixed
in previous commit.
2022-04-11 21:01:44 +02:00
amarjargal
a008b6d771 core: update to use new-style sd-bus macros
Replace old SD_BUS_METHOD_WITH_NAMES and SD_BUS_SIGNAL_WITH_NAMES macros 
to the new SD_BUS_METHOD_WITH_ARGS and SD_BUS_SIGNAL_WITH_ARGS macros.
2022-04-12 01:46:20 +09:00
Lennart Poettering
9d41c62f6e sd-device: validate devnum parameters in device_set_devnum() 2022-04-11 16:27:40 +02:00
Lennart Poettering
4d960d0bdb sd-device: make device_set_syspath() more defensive
Simplify generated sysfs paths, since we might get data passed that
includes extra // in the middle.

Also, let's not assume /sys/ prefix without verification.
2022-04-11 16:26:58 +02:00
Lennart Poettering
09c24f76dc sd-device: simplify device_enumerator_scan_devices_and_subsystems() a bit
We can use enumerator_scan_devices_all() to shorten the code, and drop
some of the error handling complexities.
2022-04-11 16:25:48 +02:00
Sonali Srivastava
008714f8c4 timedate: update to use new-style sd-bus macros 2022-04-11 23:10:06 +09:00
Yu Watanabe
29d902f03a
Merge pull request #22992 from poettering/loop-dissect-tweaks
loop-util/image dissect fixes
2022-04-11 23:08:46 +09:00
Yu Watanabe
cdecc9a56f
Merge pull request #23037 from yuwata/sd-device-validate
sd-device: validate input parameter after creating sd-device object
2022-04-11 23:04:28 +09:00
Zbigniew Jędrzejewski-Szmek
75a0c40c79
Merge pull request #23038 from yuwata/udev-log-once
udev: log once
2022-04-11 14:36:18 +02:00
Zbigniew Jędrzejewski-Szmek
1c7ec2d2c8 shared/specifier: make sure we set the output variable even for void answers
This doesn't change anything for real uses, because we'd initialize the
variable to NULL for _cleanup_ anyway, but let's follow our general pattern
of always setting the output on "success". (Even if that success is an empty
answer here.)
2022-04-11 13:51:28 +02:00
Zbigniew Jędrzejewski-Szmek
ec7401d015 Add comments about deprecated specifiers
Inspired by 9fe20c3234. When the specifier is undocumented, it is really easy
to add a duplicate definition in  a different place.
2022-04-11 13:51:28 +02:00
Yu Watanabe
23ebdf4f86 udev: inline loop variable 2022-04-11 19:59:04 +09:00
Yu Watanabe
262953ac77 udev: suppress multiple log message about interface naming scheme from workers 2022-04-11 19:59:04 +09:00
Yu Watanabe
d806fff1dd udev/net: cache parsed result of net.ifnames=
To make the log message shown only once.
2022-04-11 19:58:54 +09:00
Yu Watanabe
08405125c3 sd-device: shorten code a bit 2022-04-11 19:56:38 +09:00