uutils / uutils/coreutils

chmod: Doesn't modify files within a symlink to a folder with -R -H

Open
#7,638 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Issue

The new -H flag should traverse symlinks IFF they are passed as arguments to the chmod call.

Other folders should still be traversed as normal.

The recursive behavior is currently not applying to the directory contents of symlink arguments passed to chmod -R -H

Environment

uutils main commit 07cce02

GNU coreutils v9.6

Given

$ mkdir -p example/tmp
$ cd example 
$ touch tmp/{a,b}
$ ln -s tmp arg_symlink             
$ ls -l
total 4
lrwxrwxrwx 1 me me    3 Apr  2 02:00 arg_symlink -> tmp
drwxrwxr-x 2 me me 4096 Apr  2 02:00 tmp
$ ls -l tmp
total 0
-rw-rw-r-- 1 me me 0 Apr  2 02:00 a
-rw-rw-r-- 1 me me 0 Apr  2 02:00 b

Expected

coreutils behavior on 9.6:

$ which chmod
/home/me/Documents/builds/coreutils-9.6/src/chmod
$ chmod u+x -R -H arg_symlink
$ ls -l    
total 4
lrwxrwxrwx 1 me me    3 Apr  2 02:00 arg_symlink -> tmp
drwxrwxr-x 2 me me 4096 Apr  2 02:00 tmp
$ ls -l tmp                  
total 0
-rwxrw-r-- 1 me me 0 Apr  2 02:00 a
-rwxrw-r-- 1 me me 0 Apr  2 02:00 b

Actual

uutils behavior on main:

$ cargo run -q --features=unix chmod u+x -R -H arg_symlink
$ ls -l
total 4
lrwxrwxrwx 1 me me    3 Apr  2 02:00 arg_symlink -> tmp
drwxrwxr-x 2 me me 4096 Apr  2 02:00 tmp
$ ls -l tmp
total 0
-rw-rw-r-- 1 me me 0 Apr  2 02:00 a
-rw-rw-r-- 1 me me 0 Apr  2 02:00 b

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.

Research direction

Start with the chmod command's recursive traversal and reproduce the issue using the shell commands in the report with cargo run -q --features=unix chmod. The work is done when chmod u+x -R -H arg_symlink applies the executable bit to the symlink target's contents, matching the GNU coreutils output.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.