uutils/coreutils · error · io::Error
Is a directory
Error message
Is a directory
What it means
While validating a checksum file line, get_file_to_check opened the named path successfully but stat shows it is a directory, so no digest can be computed. The code prints an 'Is a directory' io error, counts it as a failed open, and returns LineCheckError::FileIsDirectory — the line is treated as a verification failure.
Solutions
- Remove or skip directory entries from the checksum file — checksums apply to regular files only.
- Generate the manifest correctly: find . -type f -exec sha256sum {} + > file.sha256
- Run find with -type d filtering or exclude directories when creating/verifying the list.
- Check the path in the checksum file relative to your cwd; cd to the manifest's root directory before `sha256sum -c`.
Example fix
# before: checksum file contains a directory line -> "Is a directory"
grep -v '/$' checksums.sha256 > checksums.files.sha256
# after: regenerate from files only
find . -type f -exec sha256sum {} + > checksums.sha256
sha256sum -c checksums.sha256 Defensive patterns
Strategy: validation
Validate before calling
# Filter directory entries out of a checksum manifest before -c
awk '$1 !~ /^[0-9a-fA-F]{32,}$/ {next} {print}' checksums.sha256 > clean.sha256
# or generate correctly in the first place:
find . -type f -exec sha256sum {} + > checksums.sha256 Type guard
// Node: skip directories listed in a manifest
const st = fs.statSync(line.path, { throwIfNoEntry: false });
if (!st || !st.isFile()) return; // skip dirs/missing entries Try / catch
match compute_and_check_digest_from_file(...) {
Err(LineCheckError::FileIsDirectory) => {
eprintln!("skipping {}: it is a directory, not a file", path);
}
Err(e) => return Err(e),
Ok(digest) => verify(digest),
} Prevention
- Generate manifests with find -type f only
- Never hand-edit checksum files with directory names
- cd to the manifest root before sha256sum -c so paths resolve to files
- Treat any listed directory in a manifest as a generation bug to fix upstream
When it happens
Trigger: Running `sha256sum -c` (or md5sum -c) where the checksum file lists a path that is actually a directory, e.g. a manually written checksum file or a generated one containing 'dir/' entries; also nested directories with a checksum file per directory (check mode) encountering directory names.
Common situations: Hand-maintained .sha256 files with directory names pasted in; tools generating manifest entries for directories by mistake; running checksum verification from the wrong working directory where the same name maps to a directory; with `--check` inside recursive setups.
Related errors
AI-assisted analysis of uutils/coreutils@92995feca2 (2026-09-20).
Data as JSON: /api/errors/f661ca636c1c0101.
Report an issue: GitHub.
Appendix: source
Thrown at src/uucore/src/lib/features/checksum/validate.rs:570
FileChecksumResult::CantOpen,
opts.verbose,
);
};
let print_error = |err: io::Error| {
show!(err.map_err_context(|| {
locale_aware_escape_name(filename, QuotingStyle::SHELL_ESCAPE)
// This is non destructive thanks to the escaping
.to_string_lossy()
.to_string()
}));
};
match File::open(filename) {
Ok(f) => {
if f.metadata()
.map_err(|_| LineCheckError::CantOpenFile)?
.is_dir()
{
print_error(io::Error::new(
io::ErrorKind::IsADirectory,
"Is a directory",
));
// also regarded as a failed open
failed_open();
Err(LineCheckError::FileIsDirectory)
} else {
Ok(Box::new(f))
}
}
Err(err) => {
if !opts.ignore_missing {
// yes, we have both stderr and stdout here
print_error(err);
failed_open();
}
// we could not open the file but we want to continue
Err(LineCheckError::FileNotFound)View on GitHub (pinned to 92995feca2)