linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Patterson <andrew.patterson@hp.com>
To: linux-hotplug@vger.kernel.org
Subject: Re: Problem parsing %s in udev rules
Date: Thu, 14 Oct 2004 20:05:49 +0000	[thread overview]
Message-ID: <1097784349.13758.83.camel@bluto.andrew> (raw)
In-Reply-To: <1097105584.9273.9.camel@bluto.andrew>

[-- Attachment #1: Type: text/plain, Size: 2293 bytes --]

On Wed, 2004-10-13 at 16:56 -0700, Greg KH wrote:
> On Wed, Oct 13, 2004 at 05:13:12PM -0600, Andrew Patterson wrote:
> > > We already trim it off when matching, but we also allow matching if you
> > > do put the spaces in there.  This patch breaks that, right?
> > 
> > Correct, I have a new patch that trims after the comparison, so it
> > should work in both cases. 
> 
> Thanks, I've applied this.

Thanks.

> 
> > > > I also wonder if it might be a good idea to do some sort of
> > > > transformation for characters in an attribute that are illegal in a file
> > > > system, rather than just chopping everything off. e.g, spaces that are
> > > > not leading or trailing would be changed to underscores.
> > > 
> > > ick, no.
> > 
> > Really?  Care to elaborate? 
> > 
> > Do you not like any transformation (besides the "let's chop off
> > everything after anything illegal") or just the underscores for spaces
> > one?  Perhaps a configuration value to make it optional? This sort of
> > thing might relieve a lot of the script writing that must be done to
> > handle cases that may be common.
> 
> Have you run into any cases where something like this is needed?  I
> don't really want to do any transformation within udev itself if
> possible, as it's a slippery slope down...  Helper programs can be used
> if people run into anything really nasty, and the fact that this hasn't
> come up yet, lends me to belive it really isn't a problem.  
> 
> Do you have any device that would need such transformation?

Need, no.  Want perhaps.  Example: using the following rule:

BUS="scsi", KERNEL="sd*", NAME="%k", SYMLINK="scsi_disks/%s{vendor}-%
s{model}"

I have this stupid disk drive that has the following vendor and model
entry:

Vendor: HP 36.4G Model: ST336753LC

So the resulting device file created by udev is
/dev/scsi_disks/HP-ST336753LC

Intuitively, I would expect /dev/scsi_disks/HP 36.4G-ST336753LC.
Given that spaces are bad, it would be be nice to see something like:

/dev/scsi_disks/HP_36.4G-ST336753LC.

Is the %s stuff used a lot?  I am somewhat surprised that I am the only
one running into issues like this.

Andrew

> 
> thanks,
> 
> greg k-h
> 
-- 
Andrew Patterson                
Hewlett-Packard

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  parent reply	other threads:[~2004-10-14 20:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-06 23:33 Problem parsing %s in udev rules Andrew Patterson
2004-10-06 23:50 ` Kay Sievers
2004-10-07  0:23 ` Andrew Patterson
2004-10-07  0:30 ` Kay Sievers
2004-10-12 23:04 ` Andrew Patterson
2004-10-12 23:58 ` Greg KH
2004-10-13 23:13 ` Andrew Patterson
2004-10-13 23:56 ` Greg KH
2004-10-14 20:05 ` Andrew Patterson [this message]
2004-10-15 18:45 ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1097784349.13758.83.camel@bluto.andrew \
    --to=andrew.patterson@hp.com \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).