8000 "Input/output error" while there is a long filename · Issue #181 · BurntSushi/walkdir · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
"Input/output error" while there is a long filename  #181
Open
@b0207191

Description

@b0207191

if there is a file whose filename is too long, about 190 bytes, walk will fail and report error forever.
/mnt/d/tmp/rustmp/a1 - 副本.txt
/mnt/d/tmp/rustmp/a1.txt
failed to access entry
Error 1 Err(Error { depth: 1, inner: Io { path: None, err: Os { code: 5, kind: Uncategorized, message: "Input/output error" } } })
failed to access entry
Error 2 Err(Error { depth: 1, inner: Io { path: None, err: Os { code: 5, kind: Uncategorized, message: "Input/output error" } } })
failed to access entry
Error 3 Err(Error { depth: 1, inner: Io { path: None, err: Os { code: 5, kind: Uncategorized, message: "Input/output error" } } })
failed to access entry
Error 4 Err(Error { depth: 1, inner: Io { path: None, err: Os { code: 5, kind: Uncategorized, message: "Input/output error" } } })
failed to access entry
Error 5 Err(Error { depth: 1, inner: Io { path: None, err: Os { code: 5, kind: Uncategorized, message: "Input/output error" } } })
failed to access entry
Error 6 Err(Error { depth: 1, inner: Io { path: None, err: Os { code: 5, kind: Uncategorized, message: "Input/output error" } } })

my code is just like this

`

fn walk(inpath:String, list:&mut Vec) {
let mut errv:i32 = 0;
let path = Path::new(&inpath);
for entry in WalkDir::new(path){
match &entry {
Ok(path) => {
println!("{}", path.path().display());
}
}
Err(err) => {
let errpath = err.path().unwrap_or(Path::new("")).display();
println!("failed to access entry {}", errpath);
errv = errv+1;
println!("Error {} {:?}", errv, entry);
let three_seconds = Duration::from_secs(3);
sleep(three_seconds);
continue
}
`

i guess it happens because the program running in Linux is going to read a directory in NTFS of windows, there is a limit of max 256 for filename in linux filesystem, but in windows, there is no such limit.

i wonder how to skip the error entry when it happens, in this case , the program seems to be in a loop, although in the doc it says :"If an error occurs at any point during iteration, then it is returned in place of its corresponding directory entry and iteration continues as normal. "

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0