HomeFreeBSD

hexdump: Do not trust st_size if it equals zero.

Description

hexdump: Do not trust st_size if it equals zero.

Fix for hexdump -s not being able to skip files residing in
pseudo-filesystems that advertise a zero size value.

Historically, many pseudofs-based filesystems (e.g., procfs) report
a va_size of 0 for numerous files classified as regular files.
Typically, the contents of these files are generated on demand
from kernel data as sbuf(9) strings at the time they are read.
Accurately reporting the size of these files is challenging, as it
often involves generating their contents. These pseudofs implementations
frequently report the size as 0. This is a historical behavior and also
aligns with Linux behavior. To maintain compatibility, we have chosen
to preserve the existing behavior and address it in the userland
application, rather than modifying it in the kernel (by updating the
correct value for va_size).

PR: bin/276106
MFC after: 1 week

Details

Provenance
rbranco_suse.comAuthored on Jan 3 2024, 8:17 PM
delphijCommitted on Jan 4 2024, 8:16 AM
Parents
rG67082f077f39: bhyveload: fix non -l use
Branches
Unknown
Tags
Unknown