Skip to content

cat -n doesn't handle CRLF newline delimiters correctly #6248

@pfmoore

Description

@pfmoore

This is with the latest version from github, built locally via cargo build --release --features windows

❯ coreutils printf "hello\r\nworld\r\nthere\r\n" | coreutils cat -n
     1  hello     2
world
there

Weirdly, looking at the output via xxd, the CRLF sequence is switched to LFCR...

❯ target\release\coreutils printf "hello\r\nworld\r\nthere\r\n" | target\release\coreutils cat -n | xxd
00000000: 2020 2020 2031 0968 656c 6c6f 2020 2020       1.hello
00000010: 2032 090a 0d77 6f72 6c64 0a0d 7468 6572   2...world..ther
00000020: 650a 0d                                  e..
❯ target\release\coreutils printf "hello\r\nworld\r\nthere\r\n" | xxd
00000000: 6865 6c6c 6f0d 0a77 6f72 6c64 0d0a 7468  hello..world..th
00000010: 6572 650d 0a                             ere..

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