-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
Summary
Ensure that POSIX special files (block devices, character devices, FIFOs, Unix sockets) are never included in the inventory and are never treated as transferable files.
Background
POSIX special files are not regular files and cannot/should not be synchronized:
- Block devices: Raw disk access, not file content
- Character devices: Streams with no defined size (
/dev/null,/dev/urandom) - FIFOs: Inter-process communication, reading blocks until writer connects
- Sockets: Network/IPC endpoints, not file content
Expected Behavior
During inventory building (InventoryBuilder):
- Before processing a file entry, classify it using the POSIX detection service
- If the entry is a special file (
BlockDevice,CharacterDevice,Fifo,Socket):- Skip the entry (do not add to
FileDescriptions) - Record it as a skipped entry with reason
SpecialPosixFile - Log at
Warninglevel
- Skip the entry (do not add to
- Never attempt to read content, compute hash, or transfer these files
Acceptance Criteria
- Integrate POSIX classification in
InventoryBuilder.DoAnalyze(FileInfo) - Special files are excluded before any file operation (size, hash, etc.)
- Skipped entries are tracked in
InventoryPart.SkippedEntries - Warning log message includes file path and detected type
- Integration test: inventory a directory containing a FIFO, verify it's excluded
- No behavior change on Windows (classification returns
RegularFile)
Dependencies
- Requires: POSIX special file detection via Mono.Posix (issue #X)
- Requires:
SkippedEntrymodel andSkipReasonenum (issue #X)
Technical Notes
Integration point in InventoryBuilder.DoAnalyze(FileInfo):
// Early exit for special POSIX files
var entryKind = FileSystemInspector.ClassifyEntry(fileInfo);
if (entryKind.HasFlag(FileSystemEntryKind.SpecialPosix))
{
RecordSkippedEntry(fileInfo, SkipReason.SpecialPosixFile);
_logger.LogWarning("File {Path} is a POSIX special file ({Kind}) and will be skipped",
fileInfo.FullName, entryKind);
return;
}Priority
Critical — Prevents undefined behavior, hangs, or crashes when inventorying directories containing special files.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels