Skip to content

--null-data + --null + -r leads to malformed replacement  #1487

Closed
@gaycodegal

Description

@gaycodegal

What version of ripgrep are you using?

ripgrep 11.0.2
-SIMD -AVX (compiled)
+SIMD +AVX (runtime)

How did you install ripgrep?

cargo install ripgrep

What operating system are you using ripgrep on?

Linux username 5.3.0-28-generic #30~18.04.1-Ubuntu SMP Fri Jan 17 06:14:09 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Sample of reproducing the bug:

What I tried to do:

echo -e "hi.hh\0you.hh" | rg --null --null-data -e '\.hh$' -r "" | xargs -0 -I{} echo {}.first {}.second
bad output
hi.hh.h hi.hh.hh
you
.h you
.hh

How I expect it to work

This does work fine. (note replaced \0 with \n, and removed null command line args)

echo -e "hi.hh\nyou.hh" | rg -e '\.hh$' -r "" | xargs -I{} echo {}.first {}.second
good output
hi.h hi.hh
you.h you.hh

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA bug.wontfixA feature or bug that is unlikely to be implemented or fixed.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions