Skip to content

paste -s -d does not reset the delimiter list per file (diverges from GNU) #13438

Closed

Description

@winklemad

Bug

In paste -s (serial mode) with multiple delimiters (-d/--delimiters), the delimiter list is not restarted for each file. Each input file becomes its own output line, so the delimiter list should restart from its first element for each file — as GNU does, and as uutils's own non-serial branch already does — but the DelimiterState cycle is created once and carried across files.

Reproduce

$ printf 'a\nb\n' > f1; printf 'c\nd\ne\n' > f2; printf 'f\ng\n' > f3
$ paste -s -d ':|' f1 f2 f3
uutils (wrong) GNU coreutils 9.x (expected)
line 1 a:b a:b
line 2 c:d|e c:d|e
line 3 f|g f:g ← 3rd file must restart at :, not continue at |

Another example: paste -s -d '123' f1 f2 → uutils .../13213, GNU .../11223.

Cause / fix

DelimiterState::reset_to_first_delimiter() already exists and is called per output line in the non-serial branch, but the serial branch never calls it between files. Calling it at the end of each file iteration in the serial loop makes paste -s -d match GNU. Verified against GNU coreutils across a delimiter/file matrix. PR incoming.

Activity

  1. added a commit that references this issue on Jul 18, 2026
    8f215fb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions