Control: tags 1009654 + patch Attached is a patch fixing the udev rule truncation.
Root cause: the PROGRAM= value in debian/rpi.gpio-common.udev's third rule substitutes %p eight separate times (four in the chown arguments, four in the chmod arguments). udev performs this substitution into the rule text before invoking /bin/sh, so a deeply nested device path (e.g. reached through a chain of USB hubs) gets multiplied by 8x in the final command string, which is what overruns udev's ~1023-character internal limit on PROGRAM values and produces the truncation described in the original report. Fix: substitute %p once into a shell variable ($p, escaped as $$p so udev itself doesn't try to interpret it as one of its own $-prefixed specifiers) and reuse that variable for all eight references instead of re-substituting %p each time. This cuts the multiplier from 8x to 1x. Verified: - udevadm verify reports the patched rule file as syntactically valid - Simulated against a realistic deeply-nested USB-hub sysfs path: the original rule produces a 1515-character command (over the limit, reproducing the reported truncation); the patched rule produces a 310-character command for the same path (comfortably under it) - Patch applies cleanly against a fresh pristine 0.7.1~a4-1.2 source tree The reporter's own suggested alternative (splitting into multiple shorter PROGRAM rules) would also work but only reduces the multiplier by a constant factor rather than addressing why the substitution happens repeatedly in the first place; this patch is a smaller diff with a larger safety margin. Changes: - debian/rpi.gpio-common.udev (one line changed) - debian/changelog
diff -ruN '--exclude=.pc' pristine-rpi/debian/changelog rpi.gpio-0.7.1~a4/debian/changelog --- pristine-rpi/debian/changelog 2025-03-06 09:55:03.000000000 +0000 +++ rpi.gpio-0.7.1~a4/debian/changelog 2026-10-07 07:36:22.379600033 +0000 @@ -1,3 +1,9 @@ +rpi.gpio (0.7.1~a4-1.3) UNRELEASED; urgency=medium + + * Fix udev rule command-line truncation for GPIO devices reached + through nested USB hubs (Closes: #1009654) + + -- Stefan Andrei Ionut <[email protected]> Wed, 7 Oct 2026 10:36:06 +0300 rpi.gpio (0.7.1~a4-1.2) unstable; urgency=medium * Non-maintainer upload. diff -ruN '--exclude=.pc' pristine-rpi/debian/rpi.gpio-common.udev rpi.gpio-0.7.1~a4/debian/rpi.gpio-common.udev --- pristine-rpi/debian/rpi.gpio-common.udev 2025-03-06 09:55:03.000000000 +0000 +++ rpi.gpio-0.7.1~a4/debian/rpi.gpio-common.udev 2026-10-07 07:34:33.285811469 +0000 @@ -1,3 +1,3 @@ SUBSYSTEM=="bcm2835-gpiomem", KERNEL=="gpiomem", GROUP="dialout", MODE="0660" SUBSYSTEM=="gpio", KERNEL=="gpiochip*", ACTION=="add", PROGRAM="/bin/sh -c 'chown root:dialout /sys/class/gpio/export /sys/class/gpio/unexport ; chmod 220 /sys/class/gpio/export /sys/class/gpio/unexport'" -SUBSYSTEM=="gpio", KERNEL=="gpio*", ACTION=="add", PROGRAM="/bin/sh -c 'chown root:dialout /sys%p/active_low /sys%p/direction /sys%p/edge /sys%p/value ; chmod 660 /sys%p/active_low /sys%p/direction /sys%p/edge /sys%p/value'" +SUBSYSTEM=="gpio", KERNEL=="gpio*", ACTION=="add", PROGRAM="/bin/sh -c 'p=/sys%p; chown root:dialout $$p/active_low $$p/direction $$p/edge $$p/value ; chmod 660 $$p/active_low $$p/direction $$p/edge $$p/value'"

