linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* udev - flag for preserving the ownership
@ 2004-06-01 15:45 Harald Hoyer
  2004-06-02 10:26 ` Harald Hoyer
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Harald Hoyer @ 2004-06-01 15:45 UTC (permalink / raw)
  To: linux-hotplug

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

How about a config flag, which means that udev preserves the ownership 
of an already existing device node (with the correct major, minor numbers)?

Btw, we only check if the file we want to create is block or char, not 
e.g. that we want block and it is char.

if (((stats.st_mode & S_IFMT) == S_IFBLK || (stats.st_mode & S_IFMT) == 
S_IFCHR) && (stats.st_rdev == makedev(major, minor)))

should look like:

if (((stats.st_mode & S_IFMT) == mode) && (stats.st_rdev == 
makedev(major, minor)))

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

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

* Re: udev - flag for preserving the ownership
  2004-06-01 15:45 udev - flag for preserving the ownership Harald Hoyer
@ 2004-06-02 10:26 ` Harald Hoyer
  2004-06-02 18:21 ` Olaf Hering
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Harald Hoyer @ 2004-06-02 10:26 UTC (permalink / raw)
  To: linux-hotplug


[-- Attachment #1.1: Type: text/plain, Size: 575 bytes --]

Harald Hoyer wrote:
> How about a config flag, which means that udev preserves the ownership 
> of an already existing device node (with the correct major, minor numbers)?
> 
> Btw, we only check if the file we want to create is block or char, not 
> e.g. that we want block and it is char.
> 
> if (((stats.st_mode & S_IFMT) == S_IFBLK || (stats.st_mode & S_IFMT) == 
> S_IFCHR) && (stats.st_rdev == makedev(major, minor)))
> 
> should look like:
> 
> if (((stats.st_mode & S_IFMT) == mode) && (stats.st_rdev == 
> makedev(major, minor)))

how about this (see attachement)?

[-- Attachment #1.2: udev-025-keepowner.patch --]
[-- Type: text/x-patch, Size: 563 bytes --]

--- udev-025/udev-add.c.keep	2004-04-21 23:39:10.000000000 +0200
+++ udev-025/udev-add.c	2004-06-02 12:08:16.728855024 +0200
@@ -114,10 +114,10 @@
 		goto create;
 
 	/* preserve node with already correct numbers, to not change the inode number */
-	if (((stats.st_mode & S_IFMT) == S_IFBLK || (stats.st_mode & S_IFMT) == S_IFCHR) &&
+	if (((stats.st_mode & S_IFMT) == (mode & S_IFMT)) &&
 	    (stats.st_rdev == makedev(major, minor))) {
 		dbg("preserve file '%s', cause it has correct dev_t", file);
-		goto perms;
+		goto exit;
 	}
 
 	if (unlink(file) != 0)

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

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

* Re: udev - flag for preserving the ownership
  2004-06-01 15:45 udev - flag for preserving the ownership Harald Hoyer
  2004-06-02 10:26 ` Harald Hoyer
@ 2004-06-02 18:21 ` Olaf Hering
  2004-06-03  8:16 ` Harald Hoyer
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Olaf Hering @ 2004-06-02 18:21 UTC (permalink / raw)
  To: linux-hotplug

 On Wed, Jun 02, Harald Hoyer wrote:

> Harald Hoyer wrote:
> >How about a config flag, which means that udev preserves the ownership 
> >of an already existing device node (with the correct major, minor numbers)?
> >
> >Btw, we only check if the file we want to create is block or char, not 
> >e.g. that we want block and it is char.
> >
> >if (((stats.st_mode & S_IFMT) = S_IFBLK || (stats.st_mode & S_IFMT) = 
> >S_IFCHR) && (stats.st_rdev = makedev(major, minor)))
> >
> >should look like:
> >
> >if (((stats.st_mode & S_IFMT) = mode) && (stats.st_rdev = 
> >makedev(major, minor)))
> 
> how about this (see attachement)?

I havent looked at the larger context, but I believe this changes
behaviour of udev. Currently udevstart can fix up your system for sure,
but with this change, a bogus file will not be removed if it happens to
have the same permissions.
Or will stats.st_rdev = makedev(major, minor) take care of that?

> --- udev-025/udev-add.c.keep	2004-04-21 23:39:10.000000000 +0200
> +++ udev-025/udev-add.c	2004-06-02 12:08:16.728855024 +0200
> @@ -114,10 +114,10 @@
>  		goto create;
>  
>  	/* preserve node with already correct numbers, to not change the inode number */
> -	if (((stats.st_mode & S_IFMT) = S_IFBLK || (stats.st_mode & S_IFMT) = S_IFCHR) &&
> +	if (((stats.st_mode & S_IFMT) = (mode & S_IFMT)) &&
>  	    (stats.st_rdev = makedev(major, minor))) {
>  		dbg("preserve file '%s', cause it has correct dev_t", file);
> -		goto perms;
> +		goto exit;
>  	}
>  
>  	if (unlink(file) != 0)




-- 
USB is for mice, FireWire is for men!

sUse lINUX ag, n√úRNBERG


-------------------------------------------------------
This SF.Net email is sponsored by the new InstallShield X.
From Windows to Linux, servers to mobile, InstallShield X is the one
installation-authoring solution that does it all. Learn more and
evaluate today! http://www.installshield.com/Dev2Dev/0504
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

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

* Re: udev - flag for preserving the ownership
  2004-06-01 15:45 udev - flag for preserving the ownership Harald Hoyer
  2004-06-02 10:26 ` Harald Hoyer
  2004-06-02 18:21 ` Olaf Hering
@ 2004-06-03  8:16 ` Harald Hoyer
  2004-06-03 10:59 ` Olaf Hering
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Harald Hoyer @ 2004-06-03  8:16 UTC (permalink / raw)
  To: linux-hotplug

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

Olaf Hering wrote:
> I havent looked at the larger context, but I believe this changes
> behaviour of udev. Currently udevstart can fix up your system for sure,
> but with this change, a bogus file will not be removed if it happens to
> have the same permissions.
> Or will stats.st_rdev == makedev(major, minor) take care of that?

yep, it will not change file permissions and ownership, if it already 
exists and is the correct node... we can also create a config flag, 
which changes the goto. You may look at the whole code.

What I also wish is a flag for the DB, which indicates that the file 
already existed and should not be removed with the "remove" ACTION.

> 
> 
>>--- udev-025/udev-add.c.keep	2004-04-21 23:39:10.000000000 +0200
>>+++ udev-025/udev-add.c	2004-06-02 12:08:16.728855024 +0200
>>@@ -114,10 +114,10 @@
>> 		goto create;
>> 
>> 	/* preserve node with already correct numbers, to not change the inode number */
>>-	if (((stats.st_mode & S_IFMT) == S_IFBLK || (stats.st_mode & S_IFMT) == S_IFCHR) &&
>>+	if (((stats.st_mode & S_IFMT) == (mode & S_IFMT)) &&
>> 	    (stats.st_rdev == makedev(major, minor))) {
>> 		dbg("preserve file '%s', cause it has correct dev_t", file);
>>-		goto perms;
>>+		goto exit;
>> 	}
>> 
>> 	if (unlink(file) != 0)
> 
> 
> 
> 
> 


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

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

* Re: udev - flag for preserving the ownership
  2004-06-01 15:45 udev - flag for preserving the ownership Harald Hoyer
                   ` (2 preceding siblings ...)
  2004-06-03  8:16 ` Harald Hoyer
@ 2004-06-03 10:59 ` Olaf Hering
  2004-06-03 11:03 ` Harald Hoyer
  2004-06-03 11:14 ` Olaf Hering
  5 siblings, 0 replies; 7+ messages in thread
From: Olaf Hering @ 2004-06-03 10:59 UTC (permalink / raw)
  To: linux-hotplug

 On Thu, Jun 03, Harald Hoyer wrote:

> Olaf Hering wrote:
> >I havent looked at the larger context, but I believe this changes
> >behaviour of udev. Currently udevstart can fix up your system for sure,
> >but with this change, a bogus file will not be removed if it happens to
> >have the same permissions.
> >Or will stats.st_rdev = makedev(major, minor) take care of that?
> 
> yep, it will not change file permissions and ownership, if it already 
> exists and is the correct node... we can also create a config flag, 
> which changes the goto. You may look at the whole code.

ok in this case.

> What I also wish is a flag for the DB, which indicates that the file 
> already existed and should not be removed with the "remove" ACTION.

That cant be the job of udev. If the device is not there, then noone
will need the device node. We can certainly argue about broken things
like md0 and similar chicken/egg problems.

-- 
USB is for mice, FireWire is for men!

sUse lINUX ag, n√úRNBERG


-------------------------------------------------------
This SF.Net email is sponsored by the new InstallShield X.
From Windows to Linux, servers to mobile, InstallShield X is the one
installation-authoring solution that does it all. Learn more and
evaluate today! http://www.installshield.com/Dev2Dev/0504
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

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

* Re: udev - flag for preserving the ownership
  2004-06-01 15:45 udev - flag for preserving the ownership Harald Hoyer
                   ` (3 preceding siblings ...)
  2004-06-03 10:59 ` Olaf Hering
@ 2004-06-03 11:03 ` Harald Hoyer
  2004-06-03 11:14 ` Olaf Hering
  5 siblings, 0 replies; 7+ messages in thread
From: Harald Hoyer @ 2004-06-03 11:03 UTC (permalink / raw)
  To: linux-hotplug

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

Olaf Hering wrote:
>  On Thu, Jun 03, Harald Hoyer wrote:
>>What I also wish is a flag for the DB, which indicates that the file 
>>already existed and should not be removed with the "remove" ACTION.
> 
> 
> That cant be the job of udev. If the device is not there, then noone
> will need the device node. We can certainly argue about broken things
> like md0 and similar chicken/egg problems.
> 

Think of the administrator manually changing the ownership of device 
nodes. You cannot/will not want to teach them to edit the udev 
permissions file. Thus you have to preserve the node, if it was there 
before udev stepped in. With the old ownerships and permissions.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

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

* Re: udev - flag for preserving the ownership
  2004-06-01 15:45 udev - flag for preserving the ownership Harald Hoyer
                   ` (4 preceding siblings ...)
  2004-06-03 11:03 ` Harald Hoyer
@ 2004-06-03 11:14 ` Olaf Hering
  5 siblings, 0 replies; 7+ messages in thread
From: Olaf Hering @ 2004-06-03 11:14 UTC (permalink / raw)
  To: linux-hotplug

 On Thu, Jun 03, Harald Hoyer wrote:

> Olaf Hering wrote:
> > On Thu, Jun 03, Harald Hoyer wrote:
> >>What I also wish is a flag for the DB, which indicates that the file 
> >>already existed and should not be removed with the "remove" ACTION.
> >
> >
> >That cant be the job of udev. If the device is not there, then noone
> >will need the device node. We can certainly argue about broken things
> >like md0 and similar chicken/egg problems.
> >
> 
> Think of the administrator manually changing the ownership of device 
> nodes. You cannot/will not want to teach them to edit the udev 
> permissions file. Thus you have to preserve the node, if it was there 
> before udev stepped in. With the old ownerships and permissions.

That would fail as well if one updates the devs.rpm. Either use udev and
its permissions config file, or dont use udev. 



-- 
USB is for mice, FireWire is for men!

sUse lINUX ag, n√úRNBERG


-------------------------------------------------------
This SF.Net email is sponsored by the new InstallShield X.
From Windows to Linux, servers to mobile, InstallShield X is the one
installation-authoring solution that does it all. Learn more and
evaluate today! http://www.installshield.com/Dev2Dev/0504
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

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

end of thread, other threads:[~2004-06-03 11:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-01 15:45 udev - flag for preserving the ownership Harald Hoyer
2004-06-02 10:26 ` Harald Hoyer
2004-06-02 18:21 ` Olaf Hering
2004-06-03  8:16 ` Harald Hoyer
2004-06-03 10:59 ` Olaf Hering
2004-06-03 11:03 ` Harald Hoyer
2004-06-03 11:14 ` Olaf Hering

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