Bug#524665: Order of rules file processing broken?

2009-04-21 Thread Joachim Breitner
Hi,

Am Dienstag, den 21.04.2009, 02:25 +0200 schrieb Marco d'Itri:
> On Apr 20, Joachim Breitner  wrote:
> > What is the relation
> > between /sys/bus/usb/devices/2-2/usb_device/usbdev2.2/
> > and /sys/bus/usb/devices/2-2?
> They represent different levels of the USB protocol.
> Fix your rules to only match the real device.
> Look at the libgphoto2 and libsane packages for examples.

thanks for the clarification. But I’m wondering: Is it correct that for
both devices, the same file in /dev is created resp. reused?

$ udevadm test /sys/bus/usb/devices/2-2/usb_device/usbdev2.2/  2>&1 | fgrep NAME
udev_rules_apply_to_event: NAME 'bus/usb/002/002' 
/lib/udev/rules.d/50-udev.rules:39
$ udevadm test /sys/bus/usb/devices/2-2  2>&1 | fgrep NAME
udev_rules_apply_to_event: NAME 'bus/usb/002/002' 
/lib/udev/rules.d/50-udev.rules:35

I’d expect that only one level of the USB protocol should get this NAME.

Thanks,
Joachim

-- 
Joachim "nomeata" Breitner
Debian Developer
  nome...@debian.org | ICQ# 74513189 | GPG-Keyid: 4743206C
  JID: nome...@joachim-breitner.de | http://people.debian.org/~nomeata


signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil


Bug#524665: Order of rules file processing broken?

2009-04-20 Thread Marco d'Itri
On Apr 20, Joachim Breitner  wrote:

> What is the relation
> between /sys/bus/usb/devices/2-2/usb_device/usbdev2.2/
> and /sys/bus/usb/devices/2-2?
They represent different levels of the USB protocol.
Fix your rules to only match the real device.
Look at the libgphoto2 and libsane packages for examples.

-- 
ciao,
Marco


signature.asc
Description: Digital signature


Bug#524665: Order of rules file processing broken?

2009-04-20 Thread Joachim Breitner
Hi,

Am Montag, den 20.04.2009, 12:19 +0200 schrieb Marco d'Itri:
> On Apr 20, Micha Lenk  wrote:
> 
> > In opposite to this Joachim experienced something different: The rules
> > in /lib/udev/rules.d/91-permissions.rules get applied after the rules
> > in /etc/udev/rules.d/z60_libchipcard-tools.rules. So the rules from
> > z60_libchipcard-tools.rules get overwritten by those from
> > 91-permessions.rules even though "91-..." comes before "z60_..." in
> > lexical order.
> Please reproduce this using udevadm test.

Here is the output, with does not show what’s happening

$ udevadm test /sys/bus/usb/devices/2-2
run_command: calling: test
udevadm_test: version 141
parse_file: reading '/etc/udev/rules.d/025_libgphoto2.rules' as rules file
parse_file: reading '/lib/udev/rules.d/50-udev.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-persistent-input.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-persistent-serial.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-persistent-storage-tape.rules' as 
rules file
parse_file: reading '/lib/udev/rules.d/60-persistent-storage.rules' as rules 
file
parse_file: reading '/lib/udev/rules.d/60-persistent-v4l.rules' as rules file
parse_file: reading '/dev/.udev/rules.d/61-dev-root-link.rules' as rules file
parse_file: reading '/etc/udev/rules.d/65_dmsetup.rules' as rules file
parse_file: reading '/etc/udev/rules.d/70-persistent-cd.rules' as rules file
parse_file: reading '/etc/udev/rules.d/70-persistent-net.rules' as rules file
parse_file: reading '/lib/udev/rules.d/75-cd-aliases-generator.rules' as rules 
file
parse_file: reading '/lib/udev/rules.d/75-persistent-net-generator.rules' as 
rules file
parse_file: reading '/lib/udev/rules.d/80-drivers.rules' as rules file
parse_file: reading '/etc/udev/rules.d/85-pcmcia.rules' as rules file
parse_file: reading '/lib/udev/rules.d/90-hal.rules' as rules file
parse_file: reading '/lib/udev/rules.d/91-permissions.rules' as rules file
util_lookup_user: specified user 'tss' unknown
util_lookup_group: specified group 'tss' unknown
util_lookup_group: specified group 'kvm' unknown
util_lookup_group: specified group 'rdma' unknown
parse_file: reading '/lib/udev/rules.d/95-late.rules' as rules file
parse_file: reading '/etc/udev/rules.d/libmtp8.rules' as rules file
parse_file: reading '/etc/udev/rules.d/plextor.rules' as rules file
parse_file: reading '/etc/udev/rules.d/z60_alsa-utils.rules' as rules file
parse_file: reading '/etc/udev/rules.d/z60_hdparm.rules' as rules file
parse_file: reading '/etc/udev/rules.d/z60_hplip.rules' as rules file
parse_file: reading '/etc/udev/rules.d/z60_ifplugd.rules' as rules file
parse_file: reading '/etc/udev/rules.d/z60_libchipcard-tools.rules' as rules 
file
parse_file: reading '/etc/udev/rules.d/z60_libpisock9.rules' as rules file
parse_file: reading '/etc/udev/rules.d/z60_libsane-extras.rules' as rules file
parse_file: reading '/etc/udev/rules.d/z60_libsane.rules' as rules file
parse_file: reading '/etc/udev/rules.d/z60_virtualbox-ose.rules' as rules file
parse_file: reading '/etc/udev/rules.d/z60_xserver-xorg-input-wacom.rules' as 
rules file
udev_rules_new: rules use 149688 bytes tokens (12474 * 12 bytes), 16512 bytes 
buffer
udev_rules_new: temporary index used 36360 bytes (1818 * 20 bytes)
udev_device_new_from_syspath: device 0x1efb430 has devpath 
'/devices/pci:00/:00:1a.0/usb2/2-2'
udev_device_new_from_syspath: device 0x1efadb0 has devpath 
'/devices/pci:00/:00:1a.0/usb2/2-2'
udev_device_read_db: device 0x1efadb0 filled with db symlink data 
'/dev/bus/usb/002/002'
udev_device_new_from_syspath: device 0x1ef4a90 has devpath 
'/devices/pci:00/:00:1a.0/usb2'
udev_device_new_from_syspath: device 0x1ef4d40 has devpath 
'/devices/pci:00/:00:1a.0'
udev_device_new_from_syspath: device 0x1ef4ff0 has devpath '/devices/pci:00'
udev_rules_apply_to_event: PROGRAM 'check-ptp-camera 06/01/01' 
/etc/udev/rules.d/025_libgphoto2.rules:939
util_run_program: 'check-ptp-camera 06/01/01'
util_run_program: '/lib/udev/check-ptp-camera' returned with status 1
udev_rules_apply_to_event: LINK 'char/189:129' /lib/udev/rules.d/50-udev.rules:2
udev_rules_apply_to_event: NAME 'bus/usb/002/002' 
/lib/udev/rules.d/50-udev.rules:35
udev_rules_apply_to_event: RUN 'socket:@/org/freedesktop/hal/udev_event' 
/lib/udev/rules.d/90-hal.rules:2
udev_rules_apply_to_event: MODE 0664 /lib/udev/rules.d/91-permissions.rules:40
udev_rules_apply_to_event: GROUP 117 
/etc/udev/rules.d/z60_libchipcard-tools.rules:8
udev_rules_apply_to_event: RUN 
'/usr/lib/chipcard/trigger_chipcardreader_scan.sh' 
/etc/udev/rules.d/z60_libchipcard-tools.rules:8
udev_device_update_db: create db link (bus/usb/002/002 char/189:129)
udev_node_add: creating device node '/dev/bus/usb/002/002', devnum=189:129, 
mode=0664, uid=0, gid=117
udev_node_mknod: preserve file '/dev/bus/usb/002/002', because it has correct 
dev_t
update_link: found 2 devices with name '/dev/char/189:129'
udev_device_n

Bug#524665: Order of rules file processing broken?

2009-04-20 Thread Marco d'Itri
On Apr 20, Micha Lenk  wrote:

> In opposite to this Joachim experienced something different: The rules
> in /lib/udev/rules.d/91-permissions.rules get applied after the rules
> in /etc/udev/rules.d/z60_libchipcard-tools.rules. So the rules from
> z60_libchipcard-tools.rules get overwritten by those from
> 91-permessions.rules even though "91-..." comes before "z60_..." in
> lexical order.
Please reproduce this using udevadm test.

-- 
ciao,
Marco


signature.asc
Description: Digital signature


Bug#524665: Order of rules file processing broken?

2009-04-20 Thread Micha Lenk
Package: udev
Version: 0.140-2

Hi udev maintainers,

when investigating the reasons for bug #524665 I discovered a
discrepancy between the udev man page and what apparently happens on
Joachim's system. The udev man page says in section "Rules files":

"The udev rules are read from the files located in the
  default rules directory /lib/udev/rules.d/, the custom rules
  directory /etc/udev/rules.d/ and the temporary rules directory
  /dev/.udev/rules.d/. All rule files are sorted and processed in
  lexical order, regardless in which of these directories they live."

In opposite to this Joachim experienced something different: The rules
in /lib/udev/rules.d/91-permissions.rules get applied after the rules
in /etc/udev/rules.d/z60_libchipcard-tools.rules. So the rules from
z60_libchipcard-tools.rules get overwritten by those from
91-permessions.rules even though "91-..." comes before "z60_..." in
lexical order.

Is this a bug in udev or did Joachim observe some weird special cases
(i.e. caused by a race condition)?

I definitely need your help. What do you suggest in order to fix the
bug?

Regards
  Micha

- Forwarded message from Joachim Breitner  -

Subject: Bug#524665: udev group setting does not work
From: Joachim Breitner 
To: Debian Bug Tracking System 
Date: Sat, 18 Apr 2009 23:13:23 +0200

Package: libchipcard-tools
Version: 4.2.7-2
Severity: important
File: /etc/udev/rules.d/z60_libchipcard-tools.rules

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi Micha,

for a while (probably since some udev upgrade), the file
/dev/bus/usb/003/006 (numbers vary, of course) do not have the proper
chipcard group setting any more.

I have attached a udev log with priority=info that shows what happens
when pluggin in my card reader. The settings from
/etc/udev/rules.d/z60_libchipcard-tools.rules do get applied, but are
later overridden by a line in /lib/udev/rules.d/91-permissions.rules:

SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", \
MODE="0664"

Which, as it seems, also resets the group.

I assume that you need to change your udev rule number, or move it to
/lib or something. I guess you should consult the udev maintainers for
that.

Greetings,
Joachim


- -- Package-specific info:
Available chipcard readers (output of "chipcard-tool list"):

- -- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.28-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages libchipcard-tools depends on:
ii  adduser  3.110   add and remove users and groups
ii  libc62.9-7   GNU C Library: Shared libraries
ii  libchipcard- 4.2.7-2 configuration files for libchipcar
ii  libchipcardc 4.2.7-2 library for accessing smartcards
ii  libdbus-1-3  1.2.12-1simple interprocess messaging syst
ii  libgcc1  1:4.3.3-8   GCC support library
ii  libgwenhywfa 3.8.0-1 OS abstraction layer
ii  libhal1  0.5.12~git20090406.46dc48-1 Hardware Abstraction Layer - share
ii  libpcsclite1 1.5.2-2 Middleware to access a smart card 
ii  libstdc++6   4.3.3-8 The GNU Standard C++ Library v3
ii  procps   1:3.2.7-11  /proc file system utilities
ii  zlib1g   1:1.2.3.3.dfsg-13   compression library - runtime

Versions of packages libchipcard-tools recommends:
ii  hal  0.5.12~git20090406.46dc48-1 Hardware Abstraction Layer

Versions of packages libchipcard-tools suggests:
ii  libccid   1.3.10-1   PC/SC driver for USB CCID smart ca
pn  libtowitoko2   (no description available)

- -- no debconf information

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAknqQnMACgkQ9ijrk0dDIGx+fgCfa5jkz/vnlSFf3EO+1SEceT9u
//MAnjxUXm9wDnoj1yE5TUlluZ3imTY3
=K5/l
-END PGP SIGNATURE-




- End forwarded message -



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org