feat(tac): add stdin availability check on Unix
Add a new function `ensure_stdin_open()` that uses the `nix` crate to check if stdin is open before attempting to read from it. This prevents potential errors when stdin is closed, improving robustness of the tac command on Unix systems. Updated dependencies to include `nix` in Cargo.toml and Cargo.lock.
6342dc2
2 months ago
by mattsu2020
-5.8%
refactor(test): simplify test_fifo_argument in tac tests
- Remove unnecessary line breaks in OpenOptions and child.wait() calls for conciseness and readability.
bbbd9be
2 months ago
by mattsu2020
-0.25%
refactor(tac): simplify file metadata handling using if-let-else
Replace match statement with if-let-else for path.metadata() to leverage modern Rust syntax, improving code conciseness without altering functionality.
c796479
2 months ago
by mattsu2020
+3.61%
fix(tac): avoid mmap for zero-length files to handle procfs/sysfs correctly
Zero-length files in procfs/sysfs may still produce data, but memory mapping them yields an empty buffer, causing incorrect behavior. This change adds a check for file length > 0 before attempting mmap, ensuring compatibility with GNU tac-2-nonseekable test.
3c86187
2 months ago
by mattsu2020
-3.23%
feat: add sysfs to jargon wordlist
Add "sysfs" to the cspell jargon dictionary to prevent spell check warnings for this Linux filesystem term used in the codebase.
27628df
2 months ago
by mattsu2020
-0.05%
refactor(tac): replace nix with libc for stdin validation
- Switch tac crate dependency from nix to libc
- Implement direct libc-based checks for stdin state and /dev/null
- Avoids nix dependency while preserving robust stdin error handling
67a3607
2 months ago
by mattsu2020
-0.01%
refactor(tac): use CString for /dev/null path on unix
- Replace CStr::from_bytes_with_nul with CString::new for /dev/null to simplify construction and clarify intent
- Remove unused libc import, keeping unix-specific code minimal and cleaner
007d1a0
2 months ago
by mattsu2020
+0.16%
chore(tac): fix unix-specific imports and cspell jargon list
- Add ACCMODE, RDONLY, RDWR to cspell jargon dictionary to avoid false positives
- Gate CString and MaybeUninit imports behind unix cfg to prevent non-unix build issues
b3a1976
2 months ago
by mattsu2020
+3.13%
refactor(tac): use nix for unix fd/stat handling
- Add nix as a unix-only dependency for tac
- Replace direct libc fcntl/open/fstat calls with nix equivalents
- Simplify stdin/dev-null checks for improved safety and clarity
9a02f06
2 months ago
by mattsu2020
+0.01%
refactor(tac): replace libc usage with nix/std APIs
- Remove libc dependency from tac crate and Cargo.lock
- Use nix OFlag/FileStat and std::os::fd::AsRawFd for stdin checks
- Improve error handling by mapping nix Errno to std::io::Error
c5af52d
2 months ago
by mattsu2020
-0.01%
style(tac): reorder nix fcntl imports for consistency
- Reorders nix::fcntl imports to follow a consistent, conventional order
- Improves code readability without changing behavior
2280f07
2 months ago
by mattsu2020
+0.02%
Merge branch 'main' into tac_compatibility
29ef0cc
27 days ago
by mattsu2020
+0.01%
Merge branch 'main' into tac_compatibility
222109e
26 days ago
by mattsu2020
-0.01%
Merge branch 'main' into tac_compatibility
94a231a
13 days ago
by mattsu2020
+2.19%
feat: allow tac to read from /dev/null opened in RDWR mode
- Simplify stdin closure check by removing /dev/null specific logic
- Remove unused functions and imports
- Add test ensuring RDWR /dev/null stdin is supported
be6ed78
13 days ago
by mattsu2020
-2.19%
refactor(tac): replace nix with uucore signals for stdin closed detection
Remove dependency on nix crate and use uucore's new signals feature to detect
if stdin was closed before Rust reopens it as /dev/null. This centralizes stdio
state handling and improves consistency across utilities. Add libc dependency
for signal functions. Update error handling to set exit code properly on
stdin closure.