Skip to contentSkip to conversation

Bug#261181: udev: doesn't notice parentheses in rules files

DISCUSSION Marco d'Itri 4 participants 8 messages Sep 13, 2004 – Apr 29, 2005

lore
Share & tools
lore
#0 lore raw

Looks like it has some merit, invalid % sequences are not reported.

----- Forwarded message from Joe Pfeiffer <[email protected]> -----

Subject: Bug#261181: udev: doesn't notice parentheses in rules files
Reply-To: Joe Pfeiffer <[email protected]>, [email protected]
Original-Sender: Joe Pfeiffer <[email protected]>
X-Debian-PR-Message: report 261181
X-Debian-PR-Package: udev
X-Debian-PR-Keywords:
From: Joe Pfeiffer <[email protected]>
To: Debian Bug Tracking System <[email protected]>

Package: udev
Version: 0.026-1
Severity: wishlist

some udev rules require the use of braces, as in
BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/ide-devfs.sh %k %b %n", NAME="%c{1}", SYMLINK="%k %c{2}"

It is easy to mistakenly attempt to create a rule using parentheses instead.

I'm not quite sure what udev does with these errors, but it doesn't report a syntax error, and finding the mistake can take longer than it should...

-- System Information:
Debian Release: testing/unstable
APT prefers testing
APT policy: (700, 'testing'), (600, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.7snowball
Locale: LANG=C, LC_CTYPE=C

Versions of packages udev depends on:

ii  debconf [debconf-2.0]    1.4.29          Debian configuration management sy
ii  hotplug                  0.0.20040329-11 Linux Hotplug Scripts
ii  initscripts              2.85-22         Standard scripts needed for bootin
ii  libc6                    2.3.2.ds1-13    GNU C Library: Shared libraries an
ii  libnewt0.51              0.51.6-5        Not Erik's Windowing Toolkit - tex
ii  makedev                  2.3.1-70        Creates device files in /dev

-- debconf information:
* udev/devfs-warning:
* udev/reboot-warning:

----- End forwarded message -----

Signature · 13 lines
ciao, |
Marco | [7974 scPL7EWZC1tNI]


-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM. 
Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
#1 lore raw

Re: Bug#261181: udev: doesn't notice parentheses in rules file

Marco:

Quoted 2 lines

There is nothing udev can do about this, because %c(1) is a valid device name.

Which shows an ambiguity in the syntax:

'%c{1}' is taken to mean the first word returned from a program. It could also be taken for the complete string returned from a program, followed by a literal '{1}'. If I want the second alternative, how do I write that?

A more regular syntax would be (for example):

%c whole string returned from program
%3c third word returned from program

Anything after the c is taken literally (except for another %-escape).

Signature · 12 lines
Robbe


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
#2 lore raw

Re: Bug#261181: udev: doesn't notice parentheses in rules file

In reply to Marco d'Itri
Quoted 6 lines · Robert Bihlmeyer

Marco:

Quoted 2 lines

There is nothing udev can do about this, because %c(1) is a valid device name.

Which shows an ambiguity in the syntax:

Quoted 8 lines

'%c{1}' is taken to mean the first word returned from a program. It could also be taken for the complete string returned from a program, followed by a literal '{1}'. If I want the second alternative, how do I write that?

A more regular syntax would be (for example):

%c whole string returned from program

It is that way.

Quoted 1 line

%3c third word returned from program

This is the length parameter which limit the output to 3 chars.

Quoted 1 line

Anything after the c is taken literally (except for another %-escape).

I don't understand anything else in this mail, especially not the the relation with the mail Subject. What is the problem here?

Kay

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#3 lore raw

Re: Bug#261181: udev: doesn't notice parentheses in rules file

In reply to Marco d'Itri
Quoted 9 lines · Kay Sievers
Quoted 3 lines

A more regular syntax would be (for example):

%c whole string returned from program

It is that way.

Quoted 1 line

%3c third word returned from program

This is the length parameter which limit the output to 3 chars.

I did not know that, I couldn't find detailed documentation about the % escapes.

Quoted 2 lines

I don't understand anything else in this mail, especially not the the relation with the mail Subject. What is the problem here?

I'm sorry it was noted in the bugtracking system that this feature request was already forwarded to the hotplug list, so I thought you know about this issue. See
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug&1181
for the whole thing. I think the original request can't be fulfilled sensibly...

Signature · 12 lines
Robbe


-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans!
Take this survey and enter to win a one-year sub to SourceForge.net
Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start!  http://www.idcswdc.com/cgi-bin/survey?id5hix
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
#4 lore raw

Re: Bug#261181: udev: doesn't notice parentheses in rules file

In reply to Marco d'Itri
Quoted 6 lines · Robert Bihlmeyer
Quoted 4 lines · Kay Sievers
Quoted 3 lines

A more regular syntax would be (for example):

%c whole string returned from program

Quoted 8 lines
Quoted 5 lines

It is that way.

Quoted 1 line

%3c third word returned from program

This is the length parameter which limit the output to 3 chars.

I did not know that, I couldn't find detailed documentation about the % escapes.

Does 'man udev' not provide enough information about these?

thanks,

greg k-h

-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans! Take this survey and enter to win a one-year sub to SourceForge.net Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start! http://www.idcswdc.com/cgi-bin/survey?id5hix
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#5 lore raw

Re: Bug#261181: udev: doesn't notice parentheses in rules file

In reply to Marco d'Itri

[dropping bugs.debian.org, as we are on a tangent now]

Quoted 4 lines · Greg KH
Quoted 2 lines

I did not know that, I couldn't find detailed documentation about the % escapes.

Does 'man udev' not provide enough information about these?

In 056 udev(8) tells me that %c exists, but neither about %3c nor about %c{3}.

Signature · 1 line
Robbe
#6 lore raw

Re: Bug#261181: udev: doesn't notice parentheses in rules file

In reply to Marco d'Itri
Quoted 11 lines · Robert Bihlmeyer

[dropping bugs.debian.org, as we are on a tangent now]

Quoted 4 lines · Greg KH
Quoted 2 lines

I did not know that, I couldn't find detailed documentation about the % escapes.

Does 'man udev' not provide enough information about these?

In 056 udev(8) tells me that %c exists, but neither about %3c nor about %c{3}.

Is is there for a very long time:

...

%c The string returned by the external program, specified in PRO-
GRAM (This does not work within the PROGRAM field for the obvi- ous reason.)
A single part of the string, separated by a space character may be selected by specifying the part number as an attribute: %c{N} If the number is followed by the + char this part plus all remaining parts of the result string are substituted: %c{N+}

...

The count of characters to insert may be limited by specifying the for- mat length value. For example, ’%3s{file}’ will only insert the first three characters of the sysfs attribute.
...

Kay

-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans! Take this survey and enter to win a one-year sub to SourceForge.net Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start! http://www.idcswdc.com/cgi-bin/survey?id5hix
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#7 lore raw

Re: Bug#261181: udev: doesn't notice parentheses in rules file

In reply to Marco d'Itri
Quoted 1 line · Kay Sievers

Is is there for a very long time:

Yes, I am a dummy. I had a stone-old /usr/share/man/man8/udev.8 lying around which overrode udev.8.gz belonging to the newest package...

Signature · 12 lines
Robbe


-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans!
Take this survey and enter to win a one-year sub to SourceForge.net
Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start!  http://www.idcswdc.com/cgi-bin/survey?id5hix
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel