unexpand --tabs=N,+M supports an "extended" tab specification where a trailing +M adds one more tab stop M past the last explicit stop N. That extra stop is computed as last + inc with no overflow guard, so a last stop near usize::MAX plus a positive increment overflows. Under overflow checks it aborts; in the default release build it wraps to 0, which then fails the "tab sizes must be ascending" check for the wrong reason.
# overflow-checks build (RUSTFLAGS="-C overflow-checks=on"):
$ printf '\t\n' | unexpand --tabs=18446744073709551615,+1
thread 'main' panicked at src/uu/unexpand/src/unexpand.rs:120:19:
attempt to add with overflow
Aborted (core dumped)
$ echo $?
134
# default release build: no panic; last + inc wraps to 0, so the stop list
# [usize::MAX, 0] is not ascending:
$ printf '\t\n' | unexpand --tabs=18446744073709551615,+1
unexpand: tab sizes must be ascending
$ echo $?
1
18446744073709551615 is usize::MAX on a 64-bit target, so last + inc is usize::MAX + 1.
GNU unexpand handles the same specification by erroring with memory exhausted because it pre-allocates a blank buffer sized to the tab stop:
$ printf '\t\n' | /usr/bin/unexpand --tabs=18446744073709551615,+1
/usr/bin/unexpand: memory exhausted
$ echo $?
1
unexpand --tabs=N,+Msupports an "extended" tab specification where a trailing+Madds one more tab stopMpast the last explicit stopN. That extra stop is computed aslast + incwith no overflow guard, so a last stop nearusize::MAXplus a positive increment overflows. Under overflow checks it aborts; in the default release build it wraps to0, which then fails the "tab sizes must be ascending" check for the wrong reason.18446744073709551615isusize::MAXon a 64-bit target, solast + incisusize::MAX + 1.GNU
unexpandhandles the same specification by erroring withmemory exhaustedbecause it pre-allocates a blank buffer sized to the tab stop: