linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* What does last_rule really mean?
@ 2009-10-25  1:45 Tom Horsley
  2009-10-25  2:20 ` David Zeuthen
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Tom Horsley @ 2009-10-25  1:45 UTC (permalink / raw)
  To: linux-hotplug

I'm trying to figure out how to write my own udev rules because
fedora is conveniently switching from hal to udev to control
things like which disks get automounted by nautilus in a gnome
session, so I see a lot of docs on the web that recommend
last_rule as a way to override the system rules.

First question:

The udev man page says this about last_rule:

   Stops further rules application. No later rules will have
   any effect.

If taken at face value, that implies that you can't use
last_rule more than once in all your udev rules becase it
will completely ignore everything after that rule.

I'm betting that isn't what it actually means :-).

So what is last_rule really "last" for? Can someone provide
a pseudocode algorithm to define it unambiguously? Or is
last_rule not really what I want anyway?

Second question:

I'm trying to match the disk with the label "BACKUP", in
hal, that was simply an attribute I could ask about, in
udev there does not appear to be a ATTR of any kind that
will get me the label.

How can I match the disk label? Can I run a program to
create a pattern? Any examples?


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: What does last_rule really mean?
  2009-10-25  1:45 What does last_rule really mean? Tom Horsley
@ 2009-10-25  2:20 ` David Zeuthen
  2009-10-25 14:08 ` Tom Horsley
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: David Zeuthen @ 2009-10-25  2:20 UTC (permalink / raw)
  To: linux-hotplug

Hi,

On Sun, 2009-10-25 at 01:45 +0000, Tom Horsley wrote:
> I'm trying to figure out how to write my own udev rules because
> fedora is conveniently switching from hal to udev to control
> things like which disks get automounted by nautilus in a gnome
> session, so I see a lot of docs on the web that recommend
> last_rule as a way to override the system rules.

That advice sounds incredibly busted if you all you want to do is to
control policy. Instead, set udev attributes like DKD_PRESENTATION_*
('man DeviceKit-disks' for details) to control behavior.

(For the record, the last_rule directive in udev is really dangerous as
it may have unintended consequences hiding devices like this from
system-level software depending on it - last time I talked to Kay he
mentioned that it might be nice to remove it since there's really no
reason to hand out rope like that.)

> I'm trying to match the disk with the label "BACKUP", in
> hal, that was simply an attribute I could ask about, in
> udev there does not appear to be a ATTR of any kind that
> will get me the label.
> 
> How can I match the disk label? Can I run a program to
> create a pattern? Any examples?

Here's one example

 # tell the desktop automounter to avoid automounting filesystems with
 # the label "BACKUP"
 ENV{ID_FS_LABEL}="BACKUP", ENV{DKD_PRESENTATION_NOPOLICY}="1"

You can be more creative here by matching on the device path to e.g.
disable automounting of any partition that is part of a disk plugged
into a given USB port. You can also run your own programs (through
udev's IMPORT{} feature) that can do any kind of calculation they want.
The sky is pretty much the limit.

You can also use DKD_PRESENTATION_HIDE, DKD_PRESENTATION_NAME and
DKD_PRESENTATION_ICON_NAME to control what the icon representing the
filesystem looks like.

Hope this helps.

     David



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: What does last_rule really mean?
  2009-10-25  1:45 What does last_rule really mean? Tom Horsley
  2009-10-25  2:20 ` David Zeuthen
@ 2009-10-25 14:08 ` Tom Horsley
  2009-10-25 17:51 ` Kay Sievers
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Tom Horsley @ 2009-10-25 14:08 UTC (permalink / raw)
  To: linux-hotplug

On Sat, 24 Oct 2009 22:20:20 -0400
David Zeuthen wrote:

> Here's one example
> 
>  # tell the desktop automounter to avoid automounting filesystems with
>  # the label "BACKUP"
>  ENV{ID_FS_LABEL}="BACKUP", ENV{DKD_PRESENTATION_NOPOLICY}="1"

Thanks! That was almost exactly what I wanted, but HIDE seems even
better than NOPOLICY since the HIDE setting even manages to get the
insanely annoying GTK file browser to leave the unmounted filesystem
out of the list it offers (I've been trying to figure out how to
do that for a while as well).

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: What does last_rule really mean?
  2009-10-25  1:45 What does last_rule really mean? Tom Horsley
  2009-10-25  2:20 ` David Zeuthen
  2009-10-25 14:08 ` Tom Horsley
@ 2009-10-25 17:51 ` Kay Sievers
  2009-10-25 19:05 ` Tom Horsley
  2009-10-28 10:52 ` Kay Sievers
  4 siblings, 0 replies; 6+ messages in thread
From: Kay Sievers @ 2009-10-25 17:51 UTC (permalink / raw)
  To: linux-hotplug

On Sun, Oct 25, 2009 at 11:20, David Zeuthen <david@fubar.dk> wrote:

> (For the record, the last_rule directive in udev is really dangerous as
> it may have unintended consequences hiding devices like this from
> system-level software depending on it - last time I talked to Kay he
> mentioned that it might be nice to remove it since there's really no
> reason to hand out rope like that.)

Yeah, let's remove that thing. It causes too much trouble and is just
an indication that something needs to be fixed differently.

Kay

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: What does last_rule really mean?
  2009-10-25  1:45 What does last_rule really mean? Tom Horsley
                   ` (2 preceding siblings ...)
  2009-10-25 17:51 ` Kay Sievers
@ 2009-10-25 19:05 ` Tom Horsley
  2009-10-28 10:52 ` Kay Sievers
  4 siblings, 0 replies; 6+ messages in thread
From: Tom Horsley @ 2009-10-25 19:05 UTC (permalink / raw)
  To: linux-hotplug

On Mon, 26 Oct 2009 02:51:03 +0900
Kay Sievers wrote:

> On Sun, Oct 25, 2009 at 11:20, David Zeuthen <david@fubar.dk> wrote:
> 
> > (For the record, the last_rule directive in udev is really dangerous as
> > it may have unintended consequences hiding devices like this from
> > system-level software depending on it - last time I talked to Kay he
> > mentioned that it might be nice to remove it since there's really no
> > reason to hand out rope like that.)
> 
> Yeah, let's remove that thing. It causes too much trouble and is just
> an indication that something needs to be fixed differently.

Or re-define it sensibly. One of the potential definitions I thought
about when trying to decide what it might actually mean was: "Save this
rule up and process it at the end of all the other rules". Then it
just becomes a way to get your rule to the end without having to
worry about some distro coming along and trumping your 99-zzz.rules
file with a 99-~~~.rules file :-).

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: What does last_rule really mean?
  2009-10-25  1:45 What does last_rule really mean? Tom Horsley
                   ` (3 preceding siblings ...)
  2009-10-25 19:05 ` Tom Horsley
@ 2009-10-28 10:52 ` Kay Sievers
  4 siblings, 0 replies; 6+ messages in thread
From: Kay Sievers @ 2009-10-28 10:52 UTC (permalink / raw)
  To: linux-hotplug

On Sun, Oct 25, 2009 at 18:51, Kay Sievers <kay.sievers@vrfy.org> wrote:
> On Sun, Oct 25, 2009 at 11:20, David Zeuthen <david@fubar.dk> wrote:
>
>> (For the record, the last_rule directive in udev is really dangerous as
>> it may have unintended consequences hiding devices like this from
>> system-level software depending on it - last time I talked to Kay he
>> mentioned that it might be nice to remove it since there's really no
>> reason to hand out rope like that.)
>
> Yeah, let's remove that thing. It causes too much trouble and is just
> an indication that something needs to be fixed differently.

It's gone now.

Thanks,
Kay

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-10-28 10:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-25  1:45 What does last_rule really mean? Tom Horsley
2009-10-25  2:20 ` David Zeuthen
2009-10-25 14:08 ` Tom Horsley
2009-10-25 17:51 ` Kay Sievers
2009-10-25 19:05 ` Tom Horsley
2009-10-28 10:52 ` Kay Sievers

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).