cp wrong permission of source directory instead of umask

Open
#10,862 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
52/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
rust
Domain
cli

Research direction

Start at the cp command implementation and reproduce the issue with the mkdir, chmod, and umask commands shown in the report. Compare the copied directory's permissions with GNU cp, then add or update the relevant test if the repository provides one. Done means newly created destination directories respect the process umask while preserving the reported source attributes behavior.

Written by the indexing model from the issue text.

Description

U - cp

Following #10529, all newly created directories copy attributes from their source regardless of the preserve setting. This ignores the umask setting of the process and causes discrepancy with GNU:

mkdir test
chmod 770 test

GNU:

(umask 700; cp -r test test-copy)
ls -l

drwxrwx---. 1 my4ng my4ng      0 Feb 11 03:14 test
d---rwx---. 1 my4ng my4ng      0 Feb 11 03:14 test-copy

uutils:

(umask 700; cp -r test test-copy)
ls -l

drwxrwx---. 1 my4ng my4ng      0 Feb 11 03:16 test
drwxrwx---. 1 my4ng my4ng      0 Feb 11 03:16 test-copy

It seems GNU's implementation makes the target's permission to be the intersection of source and umask.

Dominant language
Rust
Stars
24.1k
Forks
2k
Avg merge
1d 5h
Merged PRs (30d)
365

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from uutils/coreutils

All issues in uutils/coreutils

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.