chmod: incorrect error messages and missing errors during recursive chmod on read-only filesystem
Open
Nobody has claimed this yet.
U - chmod
- Dominant language
- Rust
- Stars
- 24.1k
- Forks
- 2k
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 365
Description
Component
chmod
Description
When running chmod -R on a read-only filesystem, uutils produces incorrect output compared to GNU coreutils. There are two differences:
- uutils shows a raw OS error instead of a formatted message
- Only one error is reported instead of one per file/directory
Steps to reproduce
# Create a read-only filesystem
dd if=/dev/zero of=/tmp/testfs.img bs=1M count=10
mkfs.ext4 /tmp/testfs.img
mkdir /tmp/testmount
sudo mount /tmp/testfs.img /tmp/testmount
sudo mkdir /tmp/testmount/testdir
sudo touch /tmp/testmount/testdir/file1.txt
sudo touch /tmp/testmount/testdir/file2.txt
sudo touch /tmp/testmount/testdir/file3.txt
sudo chmod 500 /tmp/testmount/testdir
sudo chmod 400 /tmp/testmount/testdir/file1.txt
sudo chmod 400 /tmp/testmount/testdir/file2.txt
sudo chmod 400 /tmp/testmount/testdir/file3.txt
sudo mount -o remount,ro /tmp/testfs.img /tmp/testmount
# Attempt to change permissions on mountpoint
sudo ./target/debug/coreutils chmod -R ugo+w /tmp/testmount/testdir/
uutils output
chmod: Read-only file system (os error 30)
chmod: cannot access '/tmp/testmount/testdir/file2.txt': Permission denied
Expected (GNU) output
chmod: changing permissions of '/tmp/testmount/testdir/': Read-only file system
chmod: changing permissions of '/tmp/testmount/testdir/file1.txt': Read-only file system
chmod: changing permissions of '/tmp/testmount/testdir/dir1': Read-only file system
chmod: changing permissions of '/tmp/testmount/testdir/dir1/file1.txt': Read-only file system
chmod: changing permissions of '/tmp/testmount/testdir/dir1/file3.txt': Read-only file system
chmod: changing permissions of '/tmp/testmount/testdir/dir1/file4.txt': Read-only file system
chmod: changing permissions of '/tmp/testmount/testdir/dir1/file2.txt': Read-only file system
chmod: changing permissions of '/tmp/testmount/testdir/file3.txt': Read-only file system
chmod: changing permissions of '/tmp/testmount/testdir/file2.txt': Read-only file system
Additional Information
coreutils version
coreutils 0.8.0 (multi-call binary)
chmod version
chmod (GNU coreutils) 9.11
Platform
Linux archlinux 7.0.3-arch1-2
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 by running the provided read-only filesystem reproduction and inspect the chmod implementation, especially recursive traversal and error reporting. Compare the results with the expected GNU output; done means formatted errors are reported for each affected file and directory.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100