Bug: `cargo watch` errors out if ignored files are not owned by current user
jnickg opened this issue · 4 comments
Overview
If the current user does not own every file in the current repository, such as artifacts owned by a docker container, cargo watch
errors out even if the directory in question is explicitly ignored.
See this repo for reproduction code. Readme of that repo copied below:
Reproduction
Clone the repo linked above. Then, run the following commands:
cargo binstall cargo-watch
docker compose up -d mongodb
cargo watch -- cargo run
or justcargo watch
Expected behavior
cargo watch
should know to ignore the ignored artifacts, per the documentation in cargo watch --help
, which states:
By default, the workspace directories of your project and all local dependencies are watched, except for the target/ and .git/ folders. Your .ignore and .gitignore files are used to filter paths.
Actual behavior
Observe the error: Error: I/O error: Permission denied (os error 13)
, despite .gitignore
ignoring that directory.
Notes
Tested with cargo-watch 8.5.2
Notes
While an argument can be made that users must go through extra steps to ensure that e.g. container artifacts are owned by the current user, and not by the container's root
, some users may want to leave behavior default, and regardless cargo watch
behavior ought to align with its documented claim
Yeah, known issue. Use watchexec for now, which handles this relatively correctly, and will do even better in a future update. Quite busy but I'm planning to bring the improvement over to cargo-watch in Q3/Q4.
@passcod -- Thanks for getting back! Is there a related Issue I can watch for updates on this?
I'll just keep this one open to track this particular bug.
Thanks again!