Skip to content

fix(chmod): preserve unselected permission classes in assignments - #1293

Open
Sskift wants to merge 1 commit into
shelljs:mainfrom
Sskift:fix/chmod-preserve-unselected-classes
Open

Sskift wants to merge 1 commit into
shelljs:mainfrom
Sskift:fix/chmod-preserve-unselected-classes

Conversation

@Sskift

@Sskift Sskift commented Nov 2, 2026

Copy link
Copy Markdown

Symbolic assignments currently clear permissions for every class. For example, applying u=r to mode 0755 produces 0400, removing the group's and other users' access even though the expression only names the owner.

Clear only the permission and special bits associated with the selected classes, then apply the new bits. This also makes sequential assignments such as u=rw,g=r,o= retain the earlier classes. The existing directory setuid/setgid preservation behavior is unchanged.

Validation on Windows with Node 24:

  • New portable regression fails before the fix and passes afterward; 14 explicit modes cover selected classes, sequential assignments, special bits, and directories. It captures modes passed to the filesystem because Windows cannot represent all POSIX mode bits.
  • All 23 chmod tests and the full ESLint check pass (existing Unix-specific filesystem checks skip on Windows).
  • Full suite: 655 pass, 6 skip; the same three Windows failures already recorded on the unchanged baseline remain (two command-not-found expectations and a find symlink case).

AI assistance was used to develop and validate this change. Native Unix filesystem validation has not been performed locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant