Should umask takes effect when we create device file via mknod?
Hi all, Currently, umask takes effect when we create device file via mknod, as bellow commands show:
<fs> mknod-b 0760 8 1 /dev/sdf <fs> ll /dev/sdf brwxr----- 1 root root 8, 1 Apr 15 11:10 /sysroot/dev/sdf
But I wonder whether it is reasonable? For mknod(1), when we use option -m mode, we set file permission bits to MODE, not a=rw - umask. Should this also be applicable to mknod in guestfish, thus when we create device file with mode set, umask doesn't take effect?
On Thu, Apr 15, 2010 at 07:18:15PM +0800, Yufang Zhang wrote:
Hi all, Currently, umask takes effect when we create device file via mknod, as bellow commands show:
<fs> mknod-b 0760 8 1 /dev/sdf <fs> ll /dev/sdf brwxr----- 1 root root 8, 1 Apr 15 11:10 /sysroot/dev/sdf
But I wonder whether it is reasonable? For mknod(1), when we use option -m mode, we set file permission bits to MODE, not a=rw - umask. Should this also be applicable to mknod in guestfish, thus when we create device file with mode set, umask doesn't take effect?
I think it's reasonable for us to use the umask, but probably it should be better documented. In the daemon we use the mknod(2) system call which is documented to be affected by umask: The permissions are modified by the process’s umask in the usual way: the permissions of the created node are (mode & ~umask). But the behaviour is a little bit different from the mknod(1) program. We could add a mknod-mode command (see also mkdir-mode). If you think this is worth it, then please file a bug or send a patch. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://et.redhat.com/~rjones/libguestfs/ See what it can do: http://et.redhat.com/~rjones/libguestfs/recipes.html
On 04/17/2010 04:37 PM, Richard W.M. Jones wrote:
a mknod-mode command File a bug as a feature request to track this issue: https://bugzilla.redhat.com/show_bug.cgi?id=583554
See also: http://git.annexia.org/?p=libguestfs.git;a=blob;f=daemon/mknod.c;h=50865a626... Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into Xen guests. http://et.redhat.com/~rjones/virt-p2v
participants (2)
-
Richard W.M. Jones -
Yufang Zhang