Bryan Kadzban wrote:
> akhiezer wrote:
>>> Date: Thu, 17 Feb 2011 23:38:21 +0000
>>> From: akhiezer <[email protected]>
>>> Subject: sed matches too much? - sec-7.10 custom symlinks
>>>
>>> ver:        "SVN-20110216"
>>> sec:        "7.10. Creating Custom Symlinks to Devices"
>>>
>>> In sub-section '7.10.1. CD-ROM symlinks', does the sed command match 
>>> too much: looks like the target file ends up with the following for 
>>> usb/firewire devices:
>>>
>>> PROGRAM="write_cd_rules by-id by-id"
>>>
>>> Am not in a position right now to test/double-check this on an 
>>> lfs-6.8-rc1 install, or how its udev might react to such an entry: 
>>> can someone verify?
> 
> Argh, the rules changed.  That one wasn't there when the sed was written.
> 
> As for the sed, I think the backreferences are getting a bit
> complicated.  Maybe it'd be simpler to just do something like this:
> 
> s/"write_cd_rules"/"write_cd_rules mode"/
> 
> Alternately, maybe match on GENERATED before the substitution, and rely
> on the fact that the usb/firewire rule is split across two lines?

Here is the file, slightly reformatted.

# the "path" of usb/ieee1394 devices changes frequently, use "id"
ACTION=="add", SUBSYSTEM=="block",             \
                ENV{ID_CDROM}=="?*",            \
                ENV{GENERATED}!="?*",           \
                PROGRAM="write_cd_rules by-id", \
                SYMLINK+="%c",                  \
                SUBSYSTEMS=="usb|ieee1394",     \
                GOTO="persistent_cd_end"

ACTION=="add", SUBSYSTEM=="block",             \
                ENV{ID_CDROM}=="?*",            \
                ENV{GENERATED}!="?*",           \
                PROGRAM="write_cd_rules",       \
                SYMLINK+="%c"

LABEL="persistent_cd_end"

The first question is whether we need to change this file at all.  If we 
do, then the GENERATED matches both rules and is inappropriate.  I think 
the simple change with the quotes will work.

   -- Bruce
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to