Skip to content

Fix file_chmod() with an empty vector of paths - #523

Open
taekop wants to merge 1 commit into
r-lib:mainfrom
taekop:fix-471-empty-chmod
Open

taekop wants to merge 1 commit into
r-lib:mainfrom
taekop:fix-471-empty-chmod

Conversation

@taekop

@taekop taekop commented Sep 29, 2026

Copy link
Copy Markdown

Part of #471.

file_chmod(character(0), "644") errored with "subscript out of bounds": with no paths, the current permissions vector is empty, and the mode recycling in as_fs_perms() divides by its length. file_chmod() now returns the empty path vector invisibly when there are no paths, the same kind of zero-length guard path_ext() uses. Recycling of modes over several paths is unchanged.

This only covers the empty-path case. The other cases in the issue (a non-empty path with an empty mode, and a single path with several modes) are about what the error or behavior should be, so I left them for a separate change. I didn't add a NEWS entry since there's no development section yet.

This branch has not been deployed

No deployments
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