Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

@CSRessel

Description

@CSRessel

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions