Skip to content

create_dir_all("") should complain about invalid filename #105108

Closed
@rosik

Description

@rosik

I tried this code:

fn main() {
    std::fs::create_dir_all("").unwrap();
}

The filename is invalid, so I've expected to see some error similar to posix utils:

$ mkdir -p ""
mkdir: cannot create directory ‘’: No such file or directory
$ mkdir ""
mkdir: cannot create directory ‘’: No such file or directory

Instead, nothing interesting happened, create_dir_all succeeded.

Meta

$ rustc --version --verbose
rustc 1.67.0-nightly (e0098a5cc 2022-11-29)
binary: rustc
commit-hash: e0098a5cc3a87d857e597af824d0ce1ed1ad85e0
commit-date: 2022-11-29
host: x86_64-unknown-linux-gnu
release: 1.67.0-nightly
LLVM version: 15.0.4

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.1 LTS
Release:        22.04
Codename:       jammy

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ioArea: `std::io`, `std::fs`, `std::net` and `std::path`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