Bug 505090

Summary: tmpfiles wants to create /usr/var rather than /var
Product: [Plasma] plasma-login-manager Reporter: Harald Sitter <sitter>
Component: generalAssignee: Plasma Bugs List <plasma-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: kde, nicolas.fella, olib141
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Harald Sitter 2025-06-01 13:20:17 UTC
[This may be a bug in extra-cmake-modules]

SUMMARY
The statedir location seems to be incorrectly prefixed with a /usr when it should be /. Causing tmpfiles on immutable /usr to trip over /usr/var/lib/plasmalogin being readonly.

STEPS TO REPRODUCE
1. cmake install
2. observe incorrect path in artifacts (e.g. the tmpfiles.d file)
3. mount a readonly /usr that does not contain a /usr/var/ (specific step depends on your system alas)
4. systemd-tmpfiles --create

OBSERVED RESULT
tmpfiles fails over readonly filesystem

EXPECTED RESULT
tmpfiles should exit successfully

SOFTWARE/OS VERSIONS
Operating System: KDE Linux 2025-05-05
KDE Plasma Version: 6.3.80
KDE Frameworks Version: 6.15.0
Qt Version: 6.9.0
Kernel Version: 6.14.4-arch1-2 (64-bit)
Graphics Platform: Wayland
Processors: 32 × AMD Ryzen 9 5950X 16-Core Processor
Memory: 64 GiB of RAM (62.7 GiB usable)
Graphics Processor: AMD Radeon RX 7800 XT

ADDITIONAL INFORMATION
I haven't really looked at it but chances are kdeinstalldirs in ECM doesn't special-handle /var correctly. To align with the cmake default behaviors it'd have to "For <dir> other than the SYSCONFDIR, LOCALSTATEDIR and RUNSTATEDIR, the value of CMAKE_INSTALL_<dir> is prefixed with usr/ if it is not user-specified as an absolute path.". Possibly it doesn't implement the latter two exclusions.
Comment 1 Nicolas Fella 2025-06-01 18:34:09 UTC
Relevant code seems to be https://invent.kde.org/plasma/plasma-login-manager/-/blob/master/services/CMakeLists.txt?ref_type=heads#L21

> DESTINATION "${CMAKE_INSTALL_LIBDIR}/tmpfiles.d"

so clearly not an ECM issue
Comment 2 Nicolas Fella 2025-06-01 18:37:02 UTC
CMAKE_INSTALL_FULL_LOCALSTATEDIR looks questionable though, that's probably ECM
Comment 3 Nicolas Fella 2025-06-01 18:38:39 UTC
(In reply to Nicolas Fella from comment #1)
> Relevant code seems to be
> https://invent.kde.org/plasma/plasma-login-manager/-/blob/master/services/
> CMakeLists.txt?ref_type=heads#L21
> 
> > DESTINATION "${CMAKE_INSTALL_LIBDIR}/tmpfiles.d"
> 
> so clearly not an ECM issue

ok, I probably misunderstood what the issues with tmpfiles.d was
Comment 5 Bug Janitor Service 2025-06-02 22:28:38 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/extra-cmake-modules/-/merge_requests/532
Comment 6 Nicolas Fella 2025-06-05 12:55:24 UTC
Git commit b6a9bc541dfccb3052b7686e376bc9a3836450dc by Nicolas Fella.
Committed on 05/06/2025 at 12:29.
Pushed by nicolasfella into branch 'master'.

Fix LOCALSTATEDIR when installing to /usr

In that case we want /var, not /usr/var.

Apply the same logic as for /etc

M  +6    -1    kde-modules/KDEInstallDirsCommon.cmake
M  +1    -0    tests/CMakeLists.txt

https://invent.kde.org/frameworks/extra-cmake-modules/-/commit/b6a9bc541dfccb3052b7686e376bc9a3836450dc