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

nl: unnumbered lines are padded with width+1 spaces, ignoring the length of `-s`

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

Maintainers usually reply within 1 day

@cakebaker is already working on this.

Since Oct 22, 2026.

  • #15619 by @cakebaker — open

Assessment

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

Research direction

Read nl() in src/uu/nl/src/nl.rs at the blank_width calculation identified in the issue. Compare the padding for unnumbered lines with the separator length used for numbered lines, then run the provided nl -s ':-:' and nl -s '' reproductions against GNU output. Done when the unnumbered line prefix matches the number width plus the separator length, including the default TAB case.

Written by the indexing model from the issue text.

Description

U - nl

For a line that is not numbered (for example an empty line under the default -b t), uutils nl writes number_width + 1 spaces, as if the separator were always the one-byte TAB. With a longer or empty -s STRING, unnumbered lines no longer line up with numbered ones. GNU nl pads with number_width + length(STRING) spaces.

The GNU manual (nl invocation) says:

-s STRING: Separate the line number from the text line in the output with STRING (default is the TAB character).

When a line is not numbered, the current line number is not incremented, but the line number separator character is still prepended to the line.

GNU 9.12 keeps the text column aligned: the prefix of an unnumbered line is as wide as the number plus the separator.

printf 'a\n\nb\n' | nl -s ':-:' | sed -n 2p | tr ' ' .
# GNU 9.12: .........      (9 = 6 + 3)
# uutils:   .......        (7 = 6 + 1)

printf 'a\n\nb\n' | nl -s '' | sed -n 2p | tr ' ' .
# GNU 9.12: ......         (6)
# uutils:   .......        (7)

With the default TAB separator both print 7 spaces.

Versions. uutils main eee56033d28bf7ef5cc816286b048779d57fb803 (2026-10-21) 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. nl() in src/uu/nl/src/nl.rs: let blank_width = settings.number_width + 1;.

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

Reproduction steps
export LC_ALL=C
printf 'a\n\nb\n' | nl -s ':-:' | cat -A
# GNU 9.12:
#      1:-:a$
#          $
#      2:-:b$
# uutils:
#      1:-:a$
#        $
#      2:-:b$
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.