Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 912692 - x11-misc/autorandr 1.14: udev rule broken for openrc users
Summary: x11-misc/autorandr 1.14: udev rule broken for openrc users
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Florian Schmaus
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-08-20 18:49 UTC by Alexander Weber
Modified: 2024-09-23 06:49 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Weber 2023-08-20 18:49:23 UTC
If x11-misc/autorandr-1.14 is installed, the udev rule refers to systemd service instead of autorandr call. 

cat /lib/udev/rules.d/40-monitor-hotplug.rules
ACTION=="change", SUBSYSTEM=="drm", RUN+="/bin/systemctl start --no-block autorandr.service"

Therefore autorandr is broken for openrc users in this version.

It seems the same issue is back like the second one in https://bugs.gentoo.org/803545.
Comment 1 Alexander Weber 2024-04-10 09:58:23 UTC
The issue is still not solved in x11-misc/autorandr-1.15

I thing the cause of comeback the issue is this change:
https://github.com/phillipberndt/autorandr/pull/345
that was merged into 1.14
Comment 2 wolfwood 2024-09-22 22:24:59 UTC
I am seeing this issue as well on an OpenRC system. running the `make install_udev` command gives the following output:

mkdir -p ///usr/lib/udev/rules.d/
echo 'ACTION=="change", SUBSYSTEM=="drm", RUN+="/usr//bin/autorandr --batch --change --default default"' > ///usr/lib/udev/rules.d/40-monitor-hotplug.rules

and indeed the indicated file has the correct output.

so the ebuild must be doing something different. I noticed it runs emake with SYSTEMD_UNIT_DIR="$(systemd_get_systemunitdir)" unconditionally rather than only if the use flag is in effect.

from the makefile it would seem the output issue comes from this if statement triggering:
# Rules for systemd
SYSTEMD_UNIT_DIR:=$(shell pkg-config --variable=systemdsystemunitdir systemd 2>/dev/null)
ifneq (,$(SYSTEMD_UNIT_DIR))
DEFAULT_TARGETS+=systemd
endif

removing the SYSTEMD_UNIT_DIR assignment from the emake call in the ebuild gives the correct output, so I surmise that $(systemd_get_systemunitdir) dies not return an empty stirn on non-systemd installs the way that pkg-config --variable=systemdsystemunitdir systemd does.

seems like the fix is either to conditionally set SYSTEMD_UNIT_DIR, or to use pkg-config --variable=systemdsystemunitdir systemd rather than $(systemd_get_systemunitdir), but its possible this also indicates a QA issue with $(systemd_get_systemunitdir)?
Comment 3 wolfwood 2024-09-23 00:50:07 UTC
this change to the ebuild produces correct results for both systemd and -systemd

61c61
< 		  SYSTEMD_UNIT_DIR="$(systemd_get_systemunitdir)" \
---
> 		  SYSTEMD_UNIT_DIR=$(usex systemd "$(systemd_get_systemunitdir)" "") \
Comment 4 Florian Schmaus gentoo-dev 2024-09-23 06:35:25 UTC
Yep, the problem are those lines in upstream's Makefile

ifneq (,$(SYSTEMD_UNIT_DIR))
DEFAULT_TARGETS+=systemd
endif

https://github.com/phillipberndt/autorandr/blob/770dc86bec9d20bbe22b596aad9aa1520c966720/Makefile#L84-L86
Comment 5 Larry the Git Cow gentoo-dev 2024-09-23 06:49:24 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0acccf502267e74b578035511adaf2d53e1eaf67

commit 0acccf502267e74b578035511adaf2d53e1eaf67
Author:     Florian Schmaus <flow@gentoo.org>
AuthorDate: 2024-09-23 06:42:56 +0000
Commit:     Florian Schmaus <flow@gentoo.org>
CommitDate: 2024-09-23 06:47:26 +0000

    x11-misc/autorandr: fix non-systemd udev rule, enable python 3.13
    
    Thanks to wolfwood for digging into the root cause and suggesting the
    used fix.
    
    Closes: https://bugs.gentoo.org/912692
    Signed-off-by: Florian Schmaus <flow@gentoo.org>

 x11-misc/autorandr/autorandr-1.15-r1.ebuild | 76 +++++++++++++++++++++++++++++
 x11-misc/autorandr/autorandr-9999.ebuild    |  4 +-
 2 files changed, 78 insertions(+), 2 deletions(-)