Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

sort: `-b` and `-M` still skip leading form feed and carriage return (follow-up to #14119)

Open Beginner friendly
#15,588 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@ozenyunus35 is already working on this.

Since Oct 22, 2026.

  • #15647 by @ozenyunus35 — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
rust
Domain
cli

Research direction

The reported behavior is in src/uu/sort/src/sort.rs, in the -b key trimming and month_parse paths. Read those sections and the existing sort tests, then run the focused tests for blank trimming and month sorting. Done means form feed and carriage return are not skipped as blanks in the C locale, and the results match the reported GNU examples.

Written by the indexing model from the issue text.

Description

U - sort

#14119 (closed by PR #15436) was about uutils sort treating \f and \r as blanks. After #15436, -n, -h, -d and default field splitting match GNU. Two places still skip a leading \f or \r: the leading-blank trimming of -b (global or -k N b) and the month parser of -M. In the C locale a blank is only a space or a tab.

The GNU manual (sort invocation) says:

-b: Ignore leading blanks when finding sort keys in each line. By default a blank is a space or a tab, but the LC_CTYPE locale can change this.

-M: An initial string, consisting of any amount of blanks, followed by a month name abbreviation, is folded to UPPER case and compared in the order 'JAN' < 'FEB' < ... < 'DEC'. Invalid names compare low to valid names. ... By default a blank is a space or a tab

printf 'a\n\fb\n' | sort -k1b | od -An -c
# GNU 9.12:  \f   b  \n   a  \n      (the key keeps its \f, and \f < a)
# uutils:     a  \n  \f   b  \n      (the \f was skipped, so "b" > "a")

printf '\rFEB\nJAN\n' | sort -M | od -An -c
# GNU 9.12:  \r   F   E   B  \n   J   A   N  \n      ("\rFEB" is not a month, so it sorts low)
# uutils:     J   A   N  \n  \r   F   E   B  \n

\f and \r behave the same in both cases.

Versions. uutils main eee56033d28bf7ef5cc816286b048779d57fb803 (2026-10-21, includes #15436) and the 0.12.0 release binary, macOS 26 aarch64 (the loop found it on Linux x86_64), LC_ALL=C, compared with GNU coreutils 9.12.

Where. src/uu/sort/src/sort.rs: the -b key trimming uses is_ascii_whitespace (in the key-selection code around position(|c| !c.is_ascii_whitespace())), and month_parse starts with line.trim_ascii_start().

Related: #14119 and PR #15436 cover -n, -h, -d and field splitting.

Found with an automated differential tester that compares uutils with GNU 9.12.

Reproduction steps
export LC_ALL=C
printf 'a\n\fb\n' | sort -k1b | od -An -c
# GNU 9.12:  \f   b  \n   a  \n
# uutils:     a  \n  \f   b  \n

printf '\rFEB\nJAN\n' | sort -M | od -An -c
# GNU 9.12:  \r   F   E   B  \n   J   A   N  \n
# uutils:     J   A   N  \n  \r   F   E   B  \n
Dominant language
Rust
Stars
24.3k
Forks
2.1k
Avg merge
1d 21h
Merged PRs (30d)
331

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from uutils/coreutils

All issues in uutils/coreutils

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.