bus1 / dbus-broker

Linux D-Bus Message Broker
https://github.com/bus1/dbus-broker/wiki
Apache License 2.0
661 stars 78 forks source link

Dangling symlink results in crash #328

Closed allisonkarlitskaya closed 6 months ago

allisonkarlitskaya commented 6 months ago

Since the last release:

Dec 19 08:57:58 x1 dbus-broker-launch[2177]: Original source was unlinked while parsing service file '/var/home/lis/.local/share/dbus-1/services/ca.desrt.toolbox-terminal.fedora-toolbox-35.service'
Dec 19 08:57:58 x1 dbus-broker-launch[2177]: ERROR launcher_load_service_dir @ ../src/launch/launcher.c +795: No such file or directory
Dec 19 08:57:58 x1 dbus-broker-launch[2177]:       launcher_load_standard_session_services @ ../src/launch/launcher.c +889
Dec 19 08:57:58 x1 dbus-broker-launch[2177]:       launcher_load_services @ ../src/launch/launcher.c +974
Dec 19 08:57:58 x1 dbus-broker-launch[2177]:       launcher_run @ ../src/launch/launcher.c +1343
Dec 19 08:57:58 x1 dbus-broker-launch[2177]:       run @ ../src/launch/main.c +152
Dec 19 08:57:58 x1 dbus-broker-launch[2177]:       main @ ../src/launch/main.c +178
Dec 19 08:57:58 x1 dbus-broker-launch[2177]: Exiting due to fatal error: -2
Dec 19 08:57:58 x1 systemd[2086]: dbus-broker.service: Main process exited, code=exited, status=1/FAILURE
Dec 19 08:57:58 x1 systemd[2086]: dbus-broker.service: Failed with result 'exit-code'.
Dec 19 08:57:58 x1 systemd[2086]: Failed to start dbus-broker.service - D-Bus User Message Bus.

That seems vaguely related to the work that happened in that area recently: https://github.com/bus1/dbus-broker/commit/cb737464dc49604d78dde0827d3da5f754f344d1 but I'm not entirely sure, since that should only impact the order that the files are visited, not what we do when we fail to open one.

Either way, this messed up my system pretty badly and took a while to debug. A quick fix would surely be appreciated by many others :)

allisonkarlitskaya commented 6 months ago

Oh, and of course: removing the dangling symlink (which was there since January 2022) fixes the problem.

dvdhrm commented 6 months ago

I just pushed 6aca911cd44f850cb1dce0b2c25e38c0ef49ee3a to fix this. There is a leftover errno-check from the old dir-iteration after the loop, which was incorrectly kept.

This only triggers if service-file or config-file prep-work fails.

Thanks a lot for the report! I will test it via CI and locally a bit more and then release v35 as bug-fix release.

dvdhrm commented 6 months ago

I pushed out v35. Let me know if anything is missing. Thanks a lot for the quick report!