bug(ls): when the current cwd swapped to a /dev/null copy file it returns . and .. even must not
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 24.1k
- Forks
- 2k
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 365
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Rust implementation and tests for the ls command, then reproduce the two-terminal sequence that replaces the current directory with a /dev/null copy file. The fix is done when ls treats the path as a file and no longer prints . and .., matching GNU ls.
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
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100