summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2021-05-31doc: document '{a,b}' glob syntaxIlya Grigoriev
This syntax does not exist in `git`, so it is not documented in `man gitignore`. There is a question of whether it *should* exist, but as long as it does, it should be documented somewhere. See also: https://github.com/BurntSushi/ripgrep/issues/1221 https://github.com/BurntSushi/ripgrep/issues/1368 Closes #1816
2021-05-31ci: check docs for all cratesMarco Ieni
This also replaces '--all' in Cargo commands with '--workspace'. The former has apparently been deprecated. We also fix a couple warnings that this new step detected. Closes #1848
2021-05-31doc: clarify --files-with-matches and --files-without-matchJade
Ref https://github.com/BurntSushi/ripgrep/issues/103#issuecomment-763083510 Closes #1869
2021-05-31doc: improve wordingVarik Valefor
This tightens up the wording in ripgrep's opening description. It's used in several places, so we update all of them. Closes #1881
2021-05-31cli: fix process leakVasili Revelas
If ripgrep was called in a way where the entire contents of a file aren't read (like --files-with-matches, among other methods), and if the file was read through an external process, then ripgrep would never reap that process. We fix this by introducing an explicit 'close' method, which we now call when using decompression or preprocessor searches. The implementation of 'close' is a little hokey. In particular, when we close stdout, this usually results in a broken pipe, and, consequently, a non-zero code returned once the child process is reaped. This is "situation normal," so we invent a (hopefully portable) heuristic for detecting it. Fixes #1766, Closes #1767
2021-05-31searcher: remove variable shadowingVasili Revelas
The previous variable name was the same as one of the method arguments.
2021-05-31regex: add unit tests for non-matching anchor bytesAndrew Gallant
This is in addition to the integration level test added in 581a35e568c3acd32461d276a4cfe746524e17cd.
2021-05-31args: make --passthru and -A/-B/-C override each otherAndrew Gallant
Fixes #1868
2021-05-29doc: add vulnerability report docsAndrew Gallant
Fixes #1773
2021-05-29cli: fix arbitrary execution of program bugAndrew Gallant
This fixes a bug only present on Windows that would permit someone to execute an arbitrary program if they crafted an appropriate directory tree. Namely, if someone put an executable named 'xz.exe' in the root of a directory tree and one ran 'rg -z foo' from the root of that tree, then the 'xz.exe' executable in that tree would execute if there are any 'xz' files anywhere in the tree. The root cause of this problem is that 'CreateProcess' on Windows will implicitly look in the current working directory for an executable when it is given a relative path to a program. Rust's standard library allows this behavior to occur, so we work around it here. We work around it by explicitly resolving programs like 'xz' via 'PATH'. That way, we only ever pass an absolute path to 'CreateProcess', which avoids the implicit behavior of checking the current working directory. This fix doesn't apply to non-Windows systems as it is believed to only impact Windows. In theory, the bug could apply on Unix if '.' is in one's PATH, but at that point, you reap what you sow. While the extent to which this is a security problem isn't clear, I think users generally expect to be able to download or clone repositories from the Internet and run ripgrep on them without fear of anything too awful happening. Being able to execute an arbitrary program probably violates that expectation. Therefore, CVE-2021-3013[1] was created for this issue. We apply the same logic to the --pre command, since the --pre command is likely in a user's config file and it would be surprising for something that the user is searching to modify which preprocessor command is used. The --pre and -z/--search-zip flags are the only two ways that ripgrep will invoke external programs, so this should cover any possible exploitable cases of this bug. [1] - https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-3013
2021-05-29changelog: sync with commits since last releaseAndrew Gallant
I'm hoping to get a release out soon, and this is the first step.
2021-05-29impl: fix --multiline anchored match bugAndrew Gallant
This fixes a bug where using \A or (?-m)^ in combination with -U/--multiline would permit matches that aren't anchored to the beginning of the file. The underlying cause was an optimization that occurred when mmaps couldn't be used. Namely, ripgrep tries to still read the input incrementally if it knows the pattern can't match through a new line. But the detection logic was flawed, since it didn't account for line anchors. This commit fixes that. Fixes #1878, Fixes #1879
2021-05-28ignore/types: add po files to supported typesjack1142
See: https://www.gnu.org/software/gettext/manual/html_node/PO-Files.html Closes #1875
2021-05-15printer: fix --vimgrep for multi-line modeAndrew Gallant
It turned out that --vimgrep wasn't quite getting the column of each match correctly. Instead of printing column numbers relative to the current line, it was printing column numbers as byte offsets relative to where the match began. To fix this, we simply subtract the offset of the line number from the beginning of the match. If the beginning of the match came before the start of the current line, then there's really nothing sensible we can do other than to use a column number of 1, which we now document. Interestingly, existing tests were checking that the previous behavior was intended. My only defense is that I somehow tricked myself into thinking it was a byte offset instead of a column number. Kudos to @bfrg for calling this out in #1866: https://github.com/BurntSushi/ripgrep/issues/1866#issuecomment-841635553
2021-05-08doc: fix typo in --engine flag docsAlessandro Caputo
Fixes #1862
2021-05-01deps: update to regex 1.5.2Andrew Gallant
This brings in a performance bug fix, merged in https://github.com/rust-lang/regex/pull/768. Fixes #1860.
2021-04-30deps: update everythingAndrew Gallant
It looks like no new dependencies have been introduced. Yay! This update was primarily motivated to bring regex 1.5 in with its new memmem implementation from the memchr crate.
2021-04-21doc: add links to Spanish translationEliaz Bobadilla
PR #1856
2021-04-15doc: clarify --hidden definitionDan Bjorge
On Windows, we didn't previously document that ripgrep respected both the prefix-dot convention _and_ the "hidden" attribute on files. Fixes #1847
2021-04-04ignore/types: add mintjgart
PR #1844
2021-03-31core: add a 'trace' messageAndrew Gallant
This message will emit the binary detection mechanism being used for each file. This does not noticeably increases the number of log messages, as the 'trace' level is already used for emitting messages for every file searched. This trace message was added in the course of investigating #1838.
2021-03-31searcher: update outdated comment for buffer sizearicha1940
Looks like this was accidentally left set to 8 in commit 46fb77c. PR #1839
2021-03-23tests: fix tests for buffer size changeAndrew Gallant
Sadly, there were several tests that are coupled to the size of the buffer used by ripgrep. Making the tests agnostic to the size is difficult. And it's annoying to fix the tests. But we rarely change the buffer size, so ¯\_(ツ)_/¯.
2021-03-23searcher: bump buffer sizeAndrew Gallant
This increases the initial buffer size from 8KB to 64KB. This actually leads to a reasonably noticeable improvement in at least one work-load, and is unlikely to regress in any other case. Also, since Rust programs (at least on Linux) seem to always use a minimum of 6-8MB of memory, adding an extra 56KB is negligible. Before: $ hyperfine -i "rg 'zqzqzqzq' OpenSubtitles2018.raw.en --no-mmap" Benchmark #1: rg 'zqzqzqzq' OpenSubtitles2018.raw.en --no-mmap Time (mean ± σ): 2.109 s ± 0.012 s [User: 565.5 ms, System: 1541.6 ms] Range (min … max): 2.094 s … 2.128 s 10 runs After: $ hyperfine -i "rg 'zqzqzqzq' OpenSubtitles2018.raw.en --no-mmap" Benchmark #1: rg 'zqzqzqzq' OpenSubtitles2018.raw.en --no-mmap Time (mean ± σ): 1.802 s ± 0.006 s [User: 462.3 ms, System: 1337.9 ms] Range (min … max): 1.795 s … 1.814 s 10 runs
2021-03-20ci: fix deb build script in clean checkoutAllen Wild
If ripgrep hasn't been built yet (i.e. target/debug/ doesn't exist), then cargo-out-dir can't find OUT_DIR and the copy commands fail. Fix by running cargo build before finding OUT_DIR. Also add a check to fail early with a sensible error message when asciidoctor isn't installed, rather than failing because of a missing rg.1 file after the build. PR #1831
2021-03-11deps: bump regex and regex-syntaxAndrew Gallant
2021-02-12gitignore: add HTML files generated by cargo -Z timingsHanif Ariffin
PR #1801
2021-01-30ignore/types: improve bazel globsSergei Vorobev
Adds *.BUILD and *.bazelrc. PR #1789
2021-01-25regex: s/CachedThreadLocal/ThreadLocalAndrew Gallant
CachedThreadLocal has been deprecated. We bump thread_local's minimal version corresponding to that deprecation as well.
2021-01-17deps: update everythingAndrew Gallant
Most of these updates come from releases I've made, and the rest appear minor. No new dependencies have been added, and `const_fn` was removed. Yay.
2021-01-17deps: replace memmap with memmap2Andrew Gallant
memmap is unmaintained at this point and it is being flagged as a RUSTSEC advisory in ripgrep. This doesn't seem like that big of a deal to me honestly, but memmap2 looks like a fine choice at this point. Fixes #1785, Closes #1786
2020-11-23ignore-0.4.17ignore-0.4.17Andrew Gallant
2020-11-23cli: fix stdin detection for Powershell on UnixRoey Darwish Dror
It seems that PowerShell uses sockets instead of FIFOs to redirect the output between commands. So add `is_socket` to our `is_readable_stdin` check. This seems unlikely to cause problems and it probably more generally correct than what we had before. In theory, it could cause problems if it produces false positives, in which case, ripgrep will try to read stdin when it should search the current working directory. (And this usually winds up manifesting as ripgrep blocking forever.) But, if the stdin handle reports itself as a socket, then it seems like we should read it. Fixes #1741, Closes #1742
2020-11-23ignore: provide underlying IO ErrorEd Page
`ignore::Error` wraps `std::io::Error` with additional information (as well as expose non-IO errors). For people wanting to inspect what the error is, they have to recursively match the Enum. This provides `io_error` and `into_io_error` helpers to do this for the user. PR #1740
2020-11-22readme: fix link to .debtleb
This is a common thing to forget to do after a release.
2020-11-20ignore/types: add yang file typeJames Harr
YANG is described in RFC 6020 https://tools.ietf.org/html/rfc6020 PR #1736
2020-11-16ci: update to GITHUB_ENVAndrew Gallant
Apparently ::set-env has been completely disabled. Sigh.
2020-11-16doc: update CI links in crate READMEsAndrew Gallant
I switched to GitHub Actions long ago, which replaces both Travis and AppVeyor. Fixes #1732
2020-11-15doc: sync --help output with man pageAndrew Gallant
The man page had the correct usage hints, but the -h/--help output was using an older more incorrect version of the hints. Closes #1730 (again)
2020-11-15doc: clarify that CLI invocation must always be validAndrew Gallant
This comes up as a corner case where folks provide -e/--regexp in a configuration file and then expect to be able to run 'rg' with no args. However, ripgrep fails because it still expects at least one pattern even though one was specified in the config file. This occurs because ripgrep has to parse its CLI parameters before reading the config file. (For log output settings and to handle the --no-config flag.) This initial parse will fail if there are no patterns specified. The only way to solve this that I can see is to somehow relax the requirements of the initial parse. But this is problematic because we would still need to enforce those requirements in cases where we don't do a second parse (when no config file is present). All in all, this doesn't seem like a problem that is worth solving. Closes #1730
2020-11-09ci: install cross from crates.ioTaiki Endo
A new release of cross has been put out, so we no longer need to install it from git. PR #1728
2020-11-03doc: update several links to use httpsAlex Touchet
PR #1724
2020-11-03doc: add missing backtick in FAQStefan VanBuren
PR #1723
2020-11-02printer: tweak binary detection message formatAndrew Gallant
This roughly matches similar changes made in GNU grep recently.
2020-11-02deps: update base64 to 0.13.0Andrew Gallant
2020-11-02deps: bring in all semver updatesAndrew Gallant
This brings in all other semver updates. This did require updating some tests, since bstr changed its debug output for NUL bytes to be a bit more idiomatic.
2020-11-02deps: targeted update of some dependenciesAndrew Gallant
This updates encoding_rs, crossbeam-utils and crossbeam-channel. This serves two purposes. The encoding_rs update fixes a compilation failure on the latest nightly. The crossbeam updates are good sense and to reduce duplicate dependencies such as cfg-if. (Although, we note that the log crate still pulls in cfg-if 0.1, so ripgrep has a duplicate dependency there for now. But it's very small.) Fixes #1721, Closes #1705
2020-10-31ignore/types: add FutharkVanessa McHale
See: https://futhark-lang.org/ PR #1720
2020-10-23ignore/types: generalize bazel type a bitBrandon Adams
Bazel supports `BUILD.bazel` as well as `WORKSPACE.bazel`. In addition, it is common to ship BUILD/WORKSPACE templates for external repositories suffixed with .bazel for easier tool recognition. Co-authored-by: Brandon Adams <brandon.adams@imc.com> PR #1716
2020-10-21globset-0.4.6globset-0.4.6Andrew Gallant