]> git.ipfire.org Git - thirdparty/systemd.git/commit
udevadm-info: handle missing data db cleanup 42958/head
authordongshengyuan <545258830@qq.com>
Fri, 10 Jul 2026 08:09:34 +0000 (16:09 +0800)
committerdongshengyuan <545258830@qq.com>
Fri, 10 Jul 2026 08:09:34 +0000 (16:09 +0800)
commit4b7f3de68cde0ed9c8950374d345141e06721c0d
treee0534b2a8ce92f9e895b5f6d3276653d83d4e1cf
parent351e29e73971c061c0423eb5769a893367a7dcd5
udevadm-info: handle missing data db cleanup

udevadm info --cleanup-db cleaned links and tags by comparing them
against /run/udev/data, but asserted when that data directory was
missing.

Treat a missing data directory as an empty database, so stale link
and tag entries can be removed without aborting.

Add a database test that runs cleanup-db with links and tags present
but no data directory.

Reproducer:

$ sudo unshare --mount --propagation private sh -c '
mount -t tmpfs tmpfs /run/udev
mkdir -p /run/udev/links/foo
udevadm info --cleanup-db
'
Assertion 'datadir' failed at src/udev/udevadm-info.c:676, function cleanup_dirs_after_db_cleanup(). Aborting.
Aborted (core dumped)

The command should handle a missing /run/udev/data directory instead
of aborting.
src/udev/udevadm-info.c
test/units/TEST-17-UDEV.database.sh