Re: chmod messes up permissions on hfs filesystem

From: Horms
Date: Mon Nov 01 2004 - 06:08:01 EST


On Mon, Nov 01, 2004 at 01:35:59PM +0900, Horms wrote:
> On Sun, Oct 24, 2004 at 05:21:44PM +0200, Siep Kroonenberg wrote:
> > Package: kernel-image-2.6.8-powerpc Version: 2.6.8-6 Severity: normal
> >
> >
> > chmod commands on files on hfs partitions tend to give weird results,
> > e.g.:
> >
> > original: -rw-r--r--
> > after chmod g+w:
> > -----w--w-
> > after chmod g-w:
> > ----------
> > after unmounting and remounting the partition:
> > -r--r--r--
> >
> > I assume this is kernel-related, since with a 2.4 kernel, chmod
> > commands mostly got ignored on this hfs partition. Anyhow, the
> > maintainer of coreutils doesn't consider this a problem with chmod.
>
> That is very strange indeed. I have sent this on to LKML so see if he has
> any ideas.
>
> From reading hfs_inode_setattr() in fs/hfs/inode.c I observe that, it
> only honours changes for the write flag, and it changes the global,
> group and user flag simultaneously. I guess HFS only has one permission
> flag, write, which can be on or off. The relevant code in the hfs tree
> doesn't seem to have changed for many moons, so either it has always
> been broken in 2.6 or something strange has happened elsewhere.
>
> In any case the behaviuor describe above is weird and should work
> more along the lines of.
>
> -rw-r--r--
> after chmod g+w:
> -rw-rw-rw-
> after chmod g-w:
> -r--r--r--
> after unmounting and remounting the partition:
> -r--r--r--

I took a closer look into this and it seems to be caused by completely
bogus handling of the umask and dirmask of the fs which is set
at mount time and supposed to control the default permisions of files.
I am working on a patch to resolve this.

--
Horms
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/