You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] tail -n with an unparseable count silently prints 10 lines (e.g. tail -n -2) #253
Match GNU tail: tail -n -2 prints the last 2 lines (11, 12) — a leading - is the same as no sign. tail -n abc errors (invalid number of lines) and exits 1.
Actual Behavior
tail -n -2 prints the last 10 lines (3 … 12). tail -n abc prints the whole input and exits 0. Any count that fails to parse is silently replaced with a default, so an agent gets a wrong answer with no error.
Possible Solution
src/commands/tail.rs:25 — count = val.parse().unwrap_or(10); (and rest.parse().unwrap_or(1) on line 23 for +N). Strip an optional leading - and propagate the parse error with ?, the way head does after #218 (signed_count in src/commands/head.rs).
Related Issues
Found while reviewing #218 (part of #207). Pre-existing on main, not introduced by that PR.
Activity