Skip to main content

Module chmod

Module chmod 

Source
Expand description

Recursive permission/ownership changes (chmod/chgrp/chown) over a fileset.

The public entry point is chmod; it mirrors crate::rm() but transforms metadata in place (from a per-type rule) instead of removing entries.

Structs§

ModeProgram
Per-type mode rules. Symlinks are never included (mode bits aren’t settable on Linux symlinks).
OwnerProgram
Which user/group id (if any) to apply to each entry type. None leaves that type unchanged for this operation.
Settings
Configuration for a recursive chmod/chgrp/chown run.
Summary
SymbolicClause
One [ugoa][+-=][rwxXst] clause. who/perms are bitmasks (see WHO_* / PERM_*).

Enums§

IdKind
Whether a DSL id token refers to a user or group.
ModeOp
The operator in a symbolic mode clause: add, remove, or set permissions.
ModeSpec
A parsed chmod mode expression: either a symbolic program (applied relative to the current mode) or an absolute octal value (12-bit).

Functions§

apply_mode
Apply a mode spec to a current 12-bit mode, returning the new 12-bit mode. is_dir drives the conditional X permission.
chmod
Public entry point. Applies metadata changes to path and, recursively, its contents. Mirrors crate::rm::rm for the root-filter check.
parse_mode_dsl
Parse a --mode DSL string. A bare token is the default for files+dirs; f:/d: sections override per type. l: is rejected (symlink mode bits are not settable on Linux).
parse_owner_dsl
Parse a --group/--owner DSL string. A bare token is the default for all types; f:/d:/l: sections override per type.

Type Aliases§

Error
Error type for chmod operations. See crate::error::OperationError.