Skip to content

bug(ls): when the current cwd swapped to a /dev/null copy file it returns . and .. even must not #12968

@HackingRepo

Description

@HackingRepo

Hi, uutils mainteners

that issue to be triggered you need 2 terminals,

in the 1st terminal the first step is

$ mkdir z
$ cd z

then create a new terminal and

$ ls

everything from here good it shows . and .. whiches fully good

then go back to the first terminal and then type the following commands

relunsec@relunsec:~/software/coreutils/target/debug$ rm -rf z
relunsec@relunsec:~/software/coreutils/target/debug$ cp /dev/null z

back to the second terminal and then type ./ls again as i see .. and . those dir things appeared, even z now swapped and become a file

relunsec@relunsec:~/software/coreutils/target/debug/z$ ../ls -lah
total 82K
drwxrwxr-x  0 relunsec relunsec   2 Jun 18 14:13 .
drwxrwxr-x 11 relunsec relunsec 473 Jun 18 14:13 ..

now try with gnu ls

relunsec@relunsec:~/software/coreutils/target/debug/z$ gnuls -lah
total 0

as you can see it do not output . and .. because now z no longer a dir it is now a file instead and that is the correct
however the uu one outputs . and .. even z is a file now whiches a bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions