Skip to content

io::copy() might be trying to use invalid file descriptor #122052

Closed as not planned
@jkarneges

Description

@jkarneges

Code:

use std::fs;

fn main() {
    fs::copy("foo", "bar").unwrap();
}

If I ensure "foo" exists and run the above program under valgrind on Linux, I get:

==75959== Warning: invalid file descriptor -1 in syscall copy_file_range(fd_in)()

The docs say copy_file_range may be used on Linux. Maybe it is used incorrectly? The file does get copied though.

This warning appears when the program is built with stable (1.76.0) and nightly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.T-libsRelevant to the library team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions