Skip to content

factor: only skip leading spaces in number arguments - #16143

Merged
RenjiSann merged 1 commit into
uutils:mainfrom
emirmrkaljevic:factor-arg-whitespace
Nov 3, 2026
Merged

RenjiSann merged 1 commit into
uutils:mainfrom
emirmrkaljevic:factor-arg-whitespace

Conversation

@emirmrkaljevic

Copy link
Copy Markdown
Contributor

Fixes #16142

GNU factor skips only leading spaces in a number argument (then one +), and any other whitespace makes it invalid. uutils called trim() on every argument, so factor '30 ' and factor $'\t30' printed factors instead of failing.

This drops the trim() and skips only leading spaces in parse_num, while the error message keeps the argument as given (' x' instead of 'x'). Stdin input is already split on whitespace, so it is unchanged.

Test: test_argument_whitespace. All test_factor tests pass, clippy and fmt are clean.

Found with behave.

@RenjiSann
RenjiSann merged commit 8e267ce into uutils:main Nov 3, 2026
100 of 101 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

factor: arguments with trailing whitespace or a leading tab are accepted, GNU rejects them

2 participants