From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Merry Date: Thu, 17 Aug 2006 15:55:54 +0000 Subject: [PATCH] incorrectly placed sysfs_init() call in udevtest Message-Id: <20060817155554.GA1587@glitch.errata> MIME-Version: 1 Content-Type: multipart/mixed; boundary="===============0617319363==" List-Id: To: linux-hotplug@vger.kernel.org --===============0617319363== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="b5gNqxB1S1yM7hjW" Content-Disposition: inline --b5gNqxB1S1yM7hjW Content-Type: multipart/mixed; boundary="G4iJoqBmSsgzjUCe" Content-Disposition: inline --G4iJoqBmSsgzjUCe Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable The udevtest documentation doesn't make this explicitly clear, but udevtest should treat device paths in the same way as udevinfo: it should strip the leading /sys (or whatever sysfs_path is) if given. In fact, there is code in udevtest.c designed to do just this. However, sysfs_init() is called _after_ this code, which uses sysfs_path. So, at the time it checks whether sysfs_path is at the front of the device path, sysfs_path is an empty string. As a result, the command udevtest /sys/block/hda fails with the message main: unable to open '/sys/block/hda' while udevtest /block/hda produces the expected output (assuming you have at least one ide drive). The attached patch moves sysfs_init() to the same place as udev_init(), and before the code that uses sysfs_path. Diff against udev-097. Alex :-) --=20 Pippin Computer Monkey to the Pelican www.oxrev.org.uk, www.corpusjcr.org, www.rev.org.uk --G4iJoqBmSsgzjUCe Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="udev-097-udevtest_sysfs-1.patch" Content-Transfer-Encoding: quoted-printable diff -urw udev-097.orig/udevtest.c udev-097/udevtest.c --- udev-097.orig/udevtest.c 2006-08-17 12:01:45.000000000 +0100 +++ udev-097/udevtest.c 2006-08-17 12:02:09.000000000 +0100 @@ -64,6 +64,7 @@ udev_config_init(); if (udev_log_priority < LOG_INFO) udev_log_priority =3D LOG_INFO; + sysfs_init(); =20 if (argc !=3D 2) { info("Usage: udevtest "); @@ -82,7 +83,6 @@ } else devpath =3D argv[1]; =20 - sysfs_init(); udev_rules_init(&rules, 0); =20 dev =3D sysfs_device_get(devpath); --G4iJoqBmSsgzjUCe-- --b5gNqxB1S1yM7hjW Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.4 (GNU/Linux) iD8DBQFE5JGKBRauKLutZ9ARAuLsAKCxMFuJ/8CJeLU+C+dHm03Y1oSwQgCgoiga xCWjNW+YJSp6046P/MfypeY= =DTz3 -----END PGP SIGNATURE----- --b5gNqxB1S1yM7hjW-- --===============0617319363== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 --===============0617319363== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net Linux-hotplug-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel --===============0617319363==--