-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
date -f /
is doing an infinite loop on Is a directory
#4539
Comments
@sylvestre I'd like to give this a try. |
This seems to be due to the |
This issue is related: rust-lang/rust#64144 (but they seem reluctant to change the behaviour) |
Yes, I agree. It is definitely related to Files not returning when accessing a directory. |
We should probably check our entire codebase for this, basically every time we call |
Okay, I actually don't think this is a footgun anymore. The problem is actually on our side, because we explicitly ignore the errors, which obviously doesn't get us the right behaviour. This would fix it for instance: DateSource::File(ref path) => {
file = File::open(path).unwrap();
let lines = BufReader::new(file).lines();
- let iter = lines.filter_map(Result::ok).map(parse_date);
+ let iter = lines.map_while(Result::ok).map(parse_date);
Box::new(iter)
}
DateSource::Now => { @shanmukhateja feel free to incorporate this in your PR. |
Found with the fuzzer introduced in #4389
target/debug/coreutils date -f /
runs forever.
strace shows
while
date -f /
on GNU returns immediately without any message (which might be a bug)The text was updated successfully, but these errors were encountered: