[Pkg-raspi-maintainers] Bug#1009654: fixed: patch attached (udev rule command truncation)
2014.stefanandreiionut at gmail.com
2014.stefanandreiionut at gmail.com
Wed Oct 7 08:37:57 BST 2026
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rpigpio-udev-truncation.patch
Type: text/x-diff
Size: 1615 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/pkg-raspi-maintainers/attachments/20261007/ba568019/attachment.patch>
More information about the Pkg-raspi-maintainers
mailing list