When running ripgrep like this:
rg foo > output
we must be careful not to search `output` since ripgrep is actively writing
to it. Searching it can cause massive blowups where the file grows without
bound.
While this is conceptually easy to fix (check the inode of the redirection
and the inode of the file you're about to search), there are a few problems
with it.
First, inodes are a Unix thing, so we need a Windows specific solution to
this as well. To resolve this concern, I created a new crate, `same-file`,
which provides a cross platform abstraction.
Second, stat'ing every file is costly. This is not avoidable on Windows,
but on Unix, we can get the inode number directly from directory traversal.
However, this information wasn't exposed, but now it is (through both the
ignore and walkdir crates).
Fixes #286
57 lines
1.3 KiB
TOML
57 lines
1.3 KiB
TOML
[package]
|
|
name = "ripgrep"
|
|
version = "0.3.2" #:version
|
|
authors = ["Andrew Gallant <jamslam@gmail.com>"]
|
|
description = """
|
|
Line oriented search tool using Rust's regex library. Combines the raw
|
|
performance of grep with the usability of the silver searcher.
|
|
"""
|
|
documentation = "https://github.com/BurntSushi/ripgrep"
|
|
homepage = "https://github.com/BurntSushi/ripgrep"
|
|
repository = "https://github.com/BurntSushi/ripgrep"
|
|
readme = "README.md"
|
|
keywords = ["regex", "grep", "egrep", "search", "pattern"]
|
|
license = "Unlicense/MIT"
|
|
exclude = ["HomebrewFormula"]
|
|
build = "build.rs"
|
|
|
|
[[bin]]
|
|
bench = false
|
|
path = "src/main.rs"
|
|
name = "rg"
|
|
|
|
[[test]]
|
|
name = "integration"
|
|
path = "tests/tests.rs"
|
|
|
|
[dependencies]
|
|
bytecount = "0.1.4"
|
|
clap = "2.19.0"
|
|
env_logger = { version = "0.3", default-features = false }
|
|
grep = { version = "0.1.4", path = "grep" }
|
|
ignore = { version = "0.1.5", path = "ignore" }
|
|
lazy_static = "0.2"
|
|
libc = "0.2"
|
|
log = "0.3"
|
|
memchr = "1"
|
|
memmap = "0.5"
|
|
num_cpus = "1"
|
|
regex = "0.2.0"
|
|
same-file = "0.1.1"
|
|
termcolor = { version = "0.1.0", path = "termcolor" }
|
|
|
|
[target.'cfg(windows)'.dependencies]
|
|
kernel32-sys = "0.2.2"
|
|
winapi = "0.2.8"
|
|
|
|
[build-dependencies]
|
|
clap = "2.18"
|
|
lazy_static = "0.2"
|
|
|
|
[features]
|
|
avx-accel = ["bytecount/avx-accel"]
|
|
simd-accel = ["bytecount/simd-accel", "regex/simd-accel"]
|
|
|
|
[profile.release]
|
|
debug = true
|