#6750: chmod is broken for non-superuser -------------------------------+--------------------------------- Reporter: grahamh | Owner: axeld Type: bug | Status: new Priority: normal | Milestone: R1 Component: File Systems/BFS | Version: R1/Development Resolution: | Keywords: chmod, write_stat Blocked By: | Has a Patch: 1 Platform: All | Blocking: -------------------------------+--------------------------------- Comment (by bonefish): Replying to [comment:15 grahamh]: > Need to be a bit careful if making this kind of thing common. Most filesystems will need to do this, but not all of them. (For example I don't think that MSDOS filesystems have a concept of "file owner".) I would guess that's why it's not done in the VFS layer? File systems that don't have those features should simply pretend they do and emulate the behavior accordingly. The main reasons for leaving permission checks to the file system implementation are: 1. Performance. The VFS could use the read_stat() and/or access() hooks to do that before invoking the FS hook that performs the actual operation, but that would have more overhead than the FS doing it. 1. Atomicity (more importantly). Only the FS can make sure the check and the actual operation are performed atomically, since the locks for the volume/node are not known outside the FS implementation. -- Ticket URL: <http://dev.haiku-os.org/ticket/6750#comment:16> Haiku <http://dev.haiku-os.org> Haiku - the operating system.