From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alesh Slovak Date: Fri, 04 Sep 2009 00:06:55 +0000 Subject: udev rules file validation Message-Id: <4AA05A1F.2040009@avasys.jp> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org Dear list, I am a developer on iscan, which is a SANE driver and frontend for Epson scanners. We try to support the broadest range of distributions possible with our packages. One of the ways in which we do this is by generating our udev rules files automatically from existing rules files we find on the system. Namely, rules files for other scanners that have been prepared by the distribution. This also gives us the added benefit of following distribution access policies without having to constantly keep up with them. There seems to have been a change in udev recently that causes it to abort if it encounters a broken rules file. This causes boot failures. After this happened to iscan's packages with Debian testing, we became aware of a bug in our generation script that had always been there, but had gone unnoticed until the aforementioned changes were made to udev. Of course, we fixed the bug, but in order to avoid this kind of problem in the future, I wanted to find a way to validate our udev rules files using udev itself, before actually installing them. I was able to come up with a fairly round-about way of validating a rules file using the output of the following command: `UDEV_CONFIG_FILE=temp.conf udevadm test NULL` The configuration file temp.conf simply points to a temporary directory containing the candidate udev rules file to avoid any possible interference from other rules files on the system. I used NULL for the device because I just want udev to load my rules file and tell me if there is anything wrong with it and `udevadm test` won't do anything unless I specify *something* for the device. I wanted to get some opinions from the udev developers on this admittedly somewhat flimsy method for udev rules file validation and whether there are any better ways to do this that I am overlooking. I would appreciate any comments or suggestions. Regards, Alesh