]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
3 years agotest: partition the MD device 23093/head
Frantisek Sumsal [Fri, 15 Apr 2022 17:01:45 +0000 (19:01 +0200)] 
test: partition the MD device

Also, loop the assemble/disassemble part couple of times to test udev
even harder.

Resolves: #23092

3 years agotest: cleanup after the MD + LVM test case as well
Frantisek Sumsal [Sat, 16 Apr 2022 20:43:20 +0000 (05:43 +0900)] 
test: cleanup after the MD + LVM test case as well

3 years agosystemctl: colorize "enabled" in 'systemctl status ...'
amarjargal [Fri, 15 Apr 2022 17:29:15 +0000 (01:29 +0800)] 
systemctl: colorize "enabled" in 'systemctl status ...'

"enabled" state is highlighted in green and "disabled" state is
highlighted in yellow because I felt that white and grey colors were not
so distinguishable. Other states are not highlighted. Any other coloring
suggestions are welcome!

Closes #16932.

3 years agoRevert "lgtm: disable cpp/missing-return (again)"
Frantisek Sumsal [Sat, 16 Apr 2022 09:36:02 +0000 (11:36 +0200)] 
Revert "lgtm: disable cpp/missing-return (again)"

This reverts commit 000096f4c61477f96fbd9c48b2d772c7c690d259.

After a couple of manual tests LGTM finally appears to have the fix for
https://github.com/github/codeql/issues/8409, so let's reenable the
check for the last time.

3 years agoMerge pull request #23089 from yuwata/sd-device-use-path_extract_filename
Yu Watanabe [Sat, 16 Apr 2022 05:33:58 +0000 (14:33 +0900)] 
Merge pull request #23089 from yuwata/sd-device-use-path_extract_filename

sd-device: use path_extract_filename()

3 years agoMerge pull request #23021 from fbuihuu/tmpfiles-fix-precedence-with-plus-sign
Yu Watanabe [Fri, 15 Apr 2022 16:36:51 +0000 (01:36 +0900)] 
Merge pull request #23021 from fbuihuu/tmpfiles-fix-precedence-with-plus-sign

Tmpfiles fix precedence with plus sign

3 years agoshared/install: fix crash when reenable is called without --root
Zbigniew Jędrzejewski-Szmek [Tue, 12 Apr 2022 18:42:32 +0000 (20:42 +0200)] 
shared/install: fix crash when reenable is called without --root

3 years agotest: add tests for sd_device_get_sysnum() 23089/head
Yu Watanabe [Fri, 15 Apr 2022 05:06:56 +0000 (14:06 +0900)] 
test: add tests for sd_device_get_sysnum()

3 years agosd-device: shorten code a bit
Yu Watanabe [Fri, 15 Apr 2022 04:45:26 +0000 (13:45 +0900)] 
sd-device: shorten code a bit

3 years agosd-device: use path_extract_filename() at one more place
Yu Watanabe [Fri, 15 Apr 2022 04:29:53 +0000 (13:29 +0900)] 
sd-device: use path_extract_filename() at one more place

3 years agonetworkctl: obey --full with lldp command
Simon Ellmann [Wed, 13 Apr 2022 19:53:10 +0000 (04:53 +0900)] 
networkctl: obey --full with lldp command

Do not ellipsize output when -l or --full is handed to networkctl lldp.

Fixes #22806.

3 years agofs-util: use path_extract_filename() at one more place
Yu Watanabe [Fri, 15 Apr 2022 04:33:43 +0000 (13:33 +0900)] 
fs-util: use path_extract_filename() at one more place

3 years agoMerge pull request #23090 from yuwata/firewall-util-cleanups
Yu Watanabe [Fri, 15 Apr 2022 11:11:58 +0000 (20:11 +0900)] 
Merge pull request #23090 from yuwata/firewall-util-cleanups

firewall-util: cleanups

3 years agofirewall-util: inline iterator and add several missing assertions 23090/head
Yu Watanabe [Fri, 15 Apr 2022 08:38:31 +0000 (17:38 +0900)] 
firewall-util: inline iterator and add several missing assertions

3 years agosd-netlink: use correct type of iterator
Yu Watanabe [Fri, 15 Apr 2022 08:37:52 +0000 (17:37 +0900)] 
sd-netlink: use correct type of iterator

3 years agoMerge pull request #23081 from mrc0mmand/more-md-tests
Yu Watanabe [Fri, 15 Apr 2022 05:30:55 +0000 (14:30 +0900)] 
Merge pull request #23081 from mrc0mmand/more-md-tests

test: extend the MD coverage with more RAID levels and LVM

3 years agoboot: Add missing continue statements
Jan Janssen [Thu, 14 Apr 2022 11:34:07 +0000 (13:34 +0200)] 
boot: Add missing continue statements

Fortunately, this was not causing any issues as it will just try
the other option branches unsuccessfuly before going to the next
config line.

3 years agoupdate TODO
Lennart Poettering [Thu, 14 Apr 2022 16:37:32 +0000 (18:37 +0200)] 
update TODO

3 years agoupdate TODO
Lennart Poettering [Thu, 14 Apr 2022 13:15:11 +0000 (15:15 +0200)] 
update TODO

3 years agotest: add a test case for MD + LVM + ext4 23081/head
Frantisek Sumsal [Thu, 14 Apr 2022 10:54:16 +0000 (12:54 +0200)] 
test: add a test case for MD + LVM + ext4

3 years agotest: extend testcase_mdadm_basic() with RAID 5 and 10
Frantisek Sumsal [Thu, 14 Apr 2022 10:30:42 +0000 (12:30 +0200)] 
test: extend testcase_mdadm_basic() with RAID 5 and 10

3 years agoMerge pull request #23073 from medhefgo/boot-fixes
Yu Watanabe [Thu, 14 Apr 2022 07:58:21 +0000 (16:58 +0900)] 
Merge pull request #23073 from medhefgo/boot-fixes

boot: Some fixes

3 years agoAdd ConditionCPUFeature to load-fragment-gperf.gperf (#23076)
Eduard Tolosa [Thu, 14 Apr 2022 06:30:03 +0000 (01:30 -0500)] 
Add ConditionCPUFeature to load-fragment-gperf.gperf (#23076)

Fixes #23075

3 years agoboot: Use correct device root when loading device trees 23073/head
Jan Janssen [Thu, 10 Mar 2022 11:32:15 +0000 (12:32 +0100)] 
boot: Use correct device root when loading device trees

If the boot entry comes from a XBOOT partition, we have to load the device
tree from that instead of the ESP.

3 years agoboot: Fix integer format specifiers
Jan Janssen [Wed, 16 Feb 2022 11:28:20 +0000 (12:28 +0100)] 
boot: Fix integer format specifiers

gnu-efi only knows two sizes for formatting integers: 32bit without
a length prefix and 64bit with 'l' prefix. Provide a PRI-style format
specifier for (U)INTN so that Print() can read the right amount of
bytes instead of printing garbage or worse.

3 years agoMerge pull request #23011 from mrc0mmand/TEST-64-md
Lennart Poettering [Wed, 13 Apr 2022 20:26:50 +0000 (22:26 +0200)] 
Merge pull request #23011 from mrc0mmand/TEST-64-md

test: add MD-related tests to TEST-64

3 years agoMerge pull request #22759 from msekletar/issue-18077-long-sysfs-paths-hashing
Lennart Poettering [Wed, 13 Apr 2022 20:21:38 +0000 (22:21 +0200)] 
Merge pull request #22759 from msekletar/issue-18077-long-sysfs-paths-hashing

Create "hashed" unit names from long paths

3 years agoMerge pull request #23070 from poettering/devnum-split
Yu Watanabe [Wed, 13 Apr 2022 18:45:39 +0000 (03:45 +0900)] 
Merge pull request #23070 from poettering/devnum-split

basic: some devnum handling tweaks and refactorings

3 years agoMerge pull request #22969 from poettering/udevadm-tree
Yu Watanabe [Wed, 13 Apr 2022 18:45:14 +0000 (03:45 +0900)] 
Merge pull request #22969 from poettering/udevadm-tree

udevadm: add new "udevadm info --tree" command

3 years agotests: reflect that we can now handle devices with very long sysfs paths 22759/head
Michal Sekletar [Thu, 24 Mar 2022 18:24:16 +0000 (19:24 +0100)] 
tests: reflect that we can now handle devices with very long sysfs paths

3 years agotest: add MD-related tests to TEST-64 23011/head
Frantisek Sumsal [Thu, 7 Apr 2022 16:03:17 +0000 (18:03 +0200)] 
test: add MD-related tests to TEST-64

3 years agoudev: set ID_IGNORE_DISKSEQ for md devices
Yu Watanabe [Wed, 13 Apr 2022 14:09:14 +0000 (23:09 +0900)] 
udev: set ID_IGNORE_DISKSEQ for md devices

3 years agoudev: do not create disk/by-diskseq symlink when ID_IGNORE_DISKSEQ property is set
Yu Watanabe [Wed, 13 Apr 2022 14:04:47 +0000 (23:04 +0900)] 
udev: do not create disk/by-diskseq symlink when ID_IGNORE_DISKSEQ property is set

3 years agosd-device: skip diskseq verification when ID_IGNORE_DISKSEQ property is set
Yu Watanabe [Wed, 13 Apr 2022 14:01:33 +0000 (23:01 +0900)] 
sd-device: skip diskseq verification when ID_IGNORE_DISKSEQ property is set

Some drivers do not announce the diskseq change.
E.g. for md devices, the kernel increments the diskseq *after*
emitting a 'change' uevent when backing block devices are added to
a md device, and udevd does not receive no uevent which contains
the new diskseq.

3 years agodevnum-util: catch potential stack overruns early 23070/head
Lennart Poettering [Wed, 13 Apr 2022 14:25:32 +0000 (16:25 +0200)] 
devnum-util: catch potential stack overruns early

3 years agodevnum-util: define helper macros for formatting devnum major/minor pairs
Lennart Poettering [Wed, 13 Apr 2022 14:13:10 +0000 (16:13 +0200)] 
devnum-util: define helper macros for formatting devnum major/minor pairs

And port some parts over.

3 years agobasic: split out dev_t related calls into new devno-util.[ch]
Lennart Poettering [Wed, 13 Apr 2022 13:38:21 +0000 (15:38 +0200)] 
basic: split out dev_t related calls into new devno-util.[ch]

No actual code changes, just splitting out of some dev_t handling
related calls from stat-util.[ch], they are quite a number already, and
deserve their own module now I think.

Also, try to settle on the name "devnum" as the name for the concept,
instead of "devno" or "dev" or "devid". "devnum" is the name exported in
udev APIs, hence probably best to stick to that. (this just renames a
few symbols to "devum", local variables are left untouched, to make the
patch not too invasive)

No actual code changes.

3 years agoudev: create disk/by-diskseq symlink only when the device has diskseq
Yu Watanabe [Sun, 10 Apr 2022 16:42:59 +0000 (01:42 +0900)] 
udev: create disk/by-diskseq symlink only when the device has diskseq

Follow-up for 0d08db7f89ee665a9dcb6dd66c1f9e203192e8ec.

3 years agoupdate TODO 22969/head
Lennart Poettering [Tue, 5 Apr 2022 08:21:14 +0000 (10:21 +0200)] 
update TODO

3 years agoudevadm: use xopendirat() where appropriate
Lennart Poettering [Tue, 12 Apr 2022 16:30:49 +0000 (18:30 +0200)] 
udevadm: use xopendirat() where appropriate

And while we are at it, let's use more appropriate open flags.

O_NONBLOCk is pointless in combination with O_NOFOLLOW.

O_NOFOLLOW makes a ton of sense otoh, since the inode is supposed to be
a dir, we just checked.

THe other flags are implied by xopendirat()

3 years agoudevadm: add new --tree mode to "udevadm info"
Lennart Poettering [Tue, 5 Apr 2022 08:20:18 +0000 (10:20 +0200)] 
udevadm: add new --tree mode to "udevadm info"

sysfs is a tree, hence let's a mode that allows showing it as such.

3 years agosd-device: include parent devices in enumeration
Lennart Poettering [Mon, 11 Apr 2022 21:13:40 +0000 (23:13 +0200)] 
sd-device: include parent devices in enumeration

3 years agosd-device: properly support some corner case syspath
Lennart Poettering [Tue, 12 Apr 2022 13:45:48 +0000 (15:45 +0200)] 
sd-device: properly support some corner case syspath

3 years agosd-device: add some comments
Lennart Poettering [Tue, 12 Apr 2022 13:45:07 +0000 (15:45 +0200)] 
sd-device: add some comments

3 years agosd-device: filter regular files when enumerating
Lennart Poettering [Tue, 12 Apr 2022 09:25:00 +0000 (11:25 +0200)] 
sd-device: filter regular files when enumerating

Currently if enumerating with debug logging you'll likely see something
like this:

sd-device: the syspath "/sys/class/devcoredump/disabled" is not a directory.
sd-device: the syspath "/sys/class/firmware/timeout" is not a directory.
sd-device: the syspath "/sys/class/zram-control/hot_remove" is not a directory.
sd-device: the syspath "/sys/class/zram-control/hot_add" is not a directory.
sd-device: the syspath "/sys/class/drm/version" is not a directory.

This is because these sysfs classes place regular files in these
directories, which we so far didn't expect.

Let's filter them early, and only bother with enumerated inodes if they
actually are dirs or symlinks, i.e. can be kobject dirs. Regular file
definitely never are kobject dirs...

3 years agosd-device: split out checking of matches from enumerator_scan_dir_and_add_devices()
Lennart Poettering [Mon, 11 Apr 2022 21:00:52 +0000 (23:00 +0200)] 
sd-device: split out checking of matches from enumerator_scan_dir_and_add_devices()

No change in behaviour, just some splitting out of code.

3 years agosd-device: generate e better error code when trying to allocate sd_device for non-dir
Lennart Poettering [Tue, 12 Apr 2022 09:42:30 +0000 (11:42 +0200)] 
sd-device: generate e better error code when trying to allocate sd_device for non-dir

Currently, for sysfs paths outside of /sys/devices/ we do better
checking if something is a suitable path: we check if it's actually a
directory, and if not return ENODEV.

Let's make the codepath for nodes *inside* of /sys/device/ similar:
let's also return ENODEV if the path supplied is not a directory.

Previously, we'd return ENOTDIR in that case, which is quite confusing I
think.

3 years agosd-device: don't accept non-sysfs paths
Lennart Poettering [Mon, 11 Apr 2022 20:04:06 +0000 (22:04 +0200)] 
sd-device: don't accept non-sysfs paths

There are some file systems mounted below /sys/ that are not actually
sysfs, i.e. are not arranged in a sysfs/kobject style. Let's refuse
those early. (Example, /sys/fs/cgroup/ and similar.)

(Also, let's add an env var for this, so that it can be turned off for
test cases.)

3 years agosd-device: use chase_symlinks() O_PATH fd
Lennart Poettering [Mon, 11 Apr 2022 20:02:23 +0000 (22:02 +0200)] 
sd-device: use chase_symlinks() O_PATH fd

chase_symlinks() can return its last O_PATH fd to us. Let's use that and
make the access() check a bit tighter by going via faccessat() on the
O_PATH fd.

This doesn't really change too much, but is nice in context of the next
commit, which uses the O_PATH fd in one other way.

3 years agoMerge pull request #23065 from poettering/env-var-generator
Lennart Poettering [Wed, 13 Apr 2022 11:44:30 +0000 (13:44 +0200)] 
Merge pull request #23065 from poettering/env-var-generator

pid1: pass additional env vars about exec context to generators

3 years agoupdate TODO 23065/head
Lennart Poettering [Tue, 12 Apr 2022 21:47:07 +0000 (23:47 +0200)] 
update TODO

3 years agoman: document new generator env vars
Lennart Poettering [Tue, 12 Apr 2022 21:29:36 +0000 (23:29 +0200)] 
man: document new generator env vars

3 years agoman: rebreak all paragraphs in systemd.generator(7)
Lennart Poettering [Tue, 12 Apr 2022 21:00:45 +0000 (23:00 +0200)] 
man: rebreak all paragraphs in systemd.generator(7)

3 years agopid1: pass useful env vars to generators
Lennart Poettering [Tue, 12 Apr 2022 13:44:46 +0000 (15:44 +0200)] 
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.

3 years agoMerge pull request #23002 from yuwata/udev-use-child-event
Zbigniew Jędrzejewski-Szmek [Wed, 13 Apr 2022 06:32:16 +0000 (08:32 +0200)] 
Merge pull request #23002 from yuwata/udev-use-child-event

udev: use child event source

3 years agoMerge pull request #23061 from poettering/chase-symlinks-tweaks,-new
Lennart Poettering [Tue, 12 Apr 2022 20:57:17 +0000 (22:57 +0200)] 
Merge pull request #23061 from poettering/chase-symlinks-tweaks,-new

some chase_symlinks() tweaks

3 years agocore: use assert_se() which takes side-effect
Yu Watanabe [Tue, 12 Apr 2022 14:52:22 +0000 (23:52 +0900)] 
core: use assert_se() which takes side-effect

Fixes #23059.

3 years agoudev: use child event source to manage workers 23002/head
Yu Watanabe [Wed, 6 Apr 2022 18:00:20 +0000 (03:00 +0900)] 
udev: use child event source to manage workers

3 years agoudev: use EventResult type
Yu Watanabe [Wed, 6 Apr 2022 17:58:43 +0000 (02:58 +0900)] 
udev: use EventResult type

This also adds EVENT_RESULT_SUCCESS for readability.

3 years agosd-event: make inotify event work after the process is forked
Yu Watanabe [Fri, 8 Apr 2022 23:50:44 +0000 (08:50 +0900)] 
sd-event: make inotify event work after the process is forked

3 years agosd-event: do not kill a child process from another child
Yu Watanabe [Fri, 8 Apr 2022 23:50:02 +0000 (08:50 +0900)] 
sd-event: do not kill a child process from another child

3 years agosd-event: do not update signal fd after PID is changed
Yu Watanabe [Fri, 8 Apr 2022 23:28:33 +0000 (08:28 +0900)] 
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.

3 years agosd-event: set pid to event source after all setup processes finished
Yu Watanabe [Thu, 7 Apr 2022 06:21:56 +0000 (15:21 +0900)] 
sd-event: set pid to event source after all setup processes finished

Otherwise, the assertion in source_disconnect() may be triggered,

3 years agosd-event: rebreak comments
Yu Watanabe [Fri, 8 Apr 2022 23:23:50 +0000 (08:23 +0900)] 
sd-event: rebreak comments

3 years agochase-symlinks: prefer path_extract_directory() over dirname() 23061/head
Lennart Poettering [Tue, 12 Apr 2022 13:44:02 +0000 (15:44 +0200)] 
chase-symlinks: prefer path_extract_directory() over dirname()

3 years agochase-symlinks: add comment for opaque argument
Lennart Poettering [Tue, 12 Apr 2022 13:43:39 +0000 (15:43 +0200)] 
chase-symlinks: add comment for opaque argument

3 years agochase-symlinks: add missing OOM check
Lennart Poettering [Tue, 12 Apr 2022 13:43:23 +0000 (15:43 +0200)] 
chase-symlinks: add missing OOM check

3 years agochase-symlinks: use empty_to_root() where appropriate
Lennart Poettering [Tue, 12 Apr 2022 13:43:13 +0000 (15:43 +0200)] 
chase-symlinks: use empty_to_root() where appropriate

3 years agochase-symlinks: avoid using stack allocation for potentially huge paths
Lennart Poettering [Tue, 12 Apr 2022 13:41:48 +0000 (15:41 +0200)] 
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.

3 years agochase-symlinks: use proper typedef for flags argument
Lennart Poettering [Tue, 12 Apr 2022 13:41:09 +0000 (15:41 +0200)] 
chase-symlinks: use proper typedef for flags argument

3 years agoMerge pull request #23057 from keszybz/various-doc-tweaks
Yu Watanabe [Tue, 12 Apr 2022 14:09:51 +0000 (23:09 +0900)] 
Merge pull request #23057 from keszybz/various-doc-tweaks

Various doc tweaks

3 years agoman: add "internal" to "reference counter" 23057/head
Zbigniew Jędrzejewski-Szmek [Tue, 12 Apr 2022 13:33:05 +0000 (15:33 +0200)] 
man: add "internal" to "reference counter"

3 years agodocs/RELEASE: also mention syscall tables
Zbigniew Jędrzejewski-Szmek [Tue, 12 Apr 2022 10:33:33 +0000 (12:33 +0200)] 
docs/RELEASE: also mention syscall tables

3 years agoREADME: recommend zstd over xz
Zbigniew Jędrzejewski-Szmek [Tue, 12 Apr 2022 10:27:23 +0000 (12:27 +0200)] 
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.

3 years agodocs: stop recommending meson compile
Zbigniew Jędrzejewski-Szmek [Tue, 12 Apr 2022 10:05:53 +0000 (12:05 +0200)] 
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.)

3 years agoman: add page for sd_device_{ref,unref,unrefp}
Zbigniew Jędrzejewski-Szmek [Tue, 12 Apr 2022 09:51:52 +0000 (11:51 +0200)] 
man: add page for sd_device_{ref,unref,unrefp}

Gotta start somewhere.

3 years agoman: say libudev should not be used for new projects
Zbigniew Jędrzejewski-Szmek [Tue, 12 Apr 2022 09:30:28 +0000 (11:30 +0200)] 
man: say libudev should not be used for new projects

3 years agoman: add landing page for sd-device
Zbigniew Jędrzejewski-Szmek [Tue, 12 Apr 2022 09:28:17 +0000 (11:28 +0200)] 
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.

3 years agoFix man page links
Zbigniew Jędrzejewski-Szmek [Tue, 12 Apr 2022 09:02:16 +0000 (11:02 +0200)] 
Fix man page links

Based on linkchecker as usual.

3 years agoudev-builtin-input_id: use heuristics to detect joysticks
Peter Hutterer [Fri, 8 Apr 2022 06:21:47 +0000 (16:21 +1000)] 
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.

3 years agoMerge pull request #23051 from poettering/udev-tweaklets-2
Yu Watanabe [Tue, 12 Apr 2022 05:06:53 +0000 (14:06 +0900)] 
Merge pull request #23051 from poettering/udev-tweaklets-2

udev: three minor tweaks

3 years agoMerge pull request #23048 from keszybz/Add-more-tests-for-specifiers
Yu Watanabe [Tue, 12 Apr 2022 05:04:48 +0000 (14:04 +0900)] 
Merge pull request #23048 from keszybz/Add-more-tests-for-specifiers

Add more tests for specifiers

3 years agotree-wide: host_name → hostname 23048/head
Zbigniew Jędrzejewski-Szmek [Mon, 11 Apr 2022 11:50:08 +0000 (13:50 +0200)] 
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.

3 years agotest-unit-name: add missing tests for specifiers, fix existing tests
Zbigniew Jędrzejewski-Szmek [Mon, 11 Apr 2022 09:13:31 +0000 (11:13 +0200)] 
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.

3 years agocore: update to use new-style sd-bus macros
amarjargal [Mon, 11 Apr 2022 13:29:22 +0000 (21:29 +0800)] 
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.

3 years agosd-device: validate devnum parameters in device_set_devnum() 23051/head
Lennart Poettering [Tue, 5 Apr 2022 08:19:20 +0000 (10:19 +0200)] 
sd-device: validate devnum parameters in device_set_devnum()

3 years agosd-device: make device_set_syspath() more defensive
Lennart Poettering [Tue, 5 Apr 2022 08:18:17 +0000 (10:18 +0200)] 
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.

3 years agosd-device: simplify device_enumerator_scan_devices_and_subsystems() a bit
Lennart Poettering [Tue, 5 Apr 2022 08:17:22 +0000 (10:17 +0200)] 
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.

3 years agotimedate: update to use new-style sd-bus macros
Sonali Srivastava [Mon, 11 Apr 2022 11:41:29 +0000 (17:11 +0530)] 
timedate: update to use new-style sd-bus macros

3 years agoMerge pull request #22992 from poettering/loop-dissect-tweaks
Yu Watanabe [Mon, 11 Apr 2022 14:08:46 +0000 (23:08 +0900)] 
Merge pull request #22992 from poettering/loop-dissect-tweaks

loop-util/image dissect fixes

3 years agoMerge pull request #23037 from yuwata/sd-device-validate
Yu Watanabe [Mon, 11 Apr 2022 14:04:28 +0000 (23:04 +0900)] 
Merge pull request #23037 from yuwata/sd-device-validate

sd-device: validate input parameter after creating sd-device object

3 years agoMerge pull request #23038 from yuwata/udev-log-once
Zbigniew Jędrzejewski-Szmek [Mon, 11 Apr 2022 12:36:18 +0000 (14:36 +0200)] 
Merge pull request #23038 from yuwata/udev-log-once

udev: log once

3 years agoshared/specifier: make sure we set the output variable even for void answers
Zbigniew Jędrzejewski-Szmek [Mon, 11 Apr 2022 11:44:41 +0000 (13:44 +0200)] 
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.)

3 years agoAdd comments about deprecated specifiers
Zbigniew Jędrzejewski-Szmek [Fri, 8 Apr 2022 18:28:26 +0000 (20:28 +0200)] 
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.

3 years agoudev: inline loop variable 23038/head
Yu Watanabe [Sun, 10 Apr 2022 15:02:17 +0000 (00:02 +0900)] 
udev: inline loop variable

3 years agoudev: suppress multiple log message about interface naming scheme from workers
Yu Watanabe [Sun, 10 Apr 2022 14:55:06 +0000 (23:55 +0900)] 
udev: suppress multiple log message about interface naming scheme from workers

3 years agoudev/net: cache parsed result of net.ifnames=
Yu Watanabe [Sun, 10 Apr 2022 14:41:34 +0000 (23:41 +0900)] 
udev/net: cache parsed result of net.ifnames=

To make the log message shown only once.

3 years agosd-device: shorten code a bit 23037/head
Yu Watanabe [Sun, 10 Apr 2022 13:36:16 +0000 (22:36 +0900)] 
sd-device: shorten code a bit

3 years agosd-device: minor may be NULL
Yu Watanabe [Sun, 10 Apr 2022 13:36:33 +0000 (22:36 +0900)] 
sd-device: minor may be NULL

3 years agosd-device: validate input parameter after creating sd-device object
Yu Watanabe [Sun, 10 Apr 2022 13:23:34 +0000 (22:23 +0900)] 
sd-device: validate input parameter after creating sd-device object