Compare commits

..

10 Commits

Author SHA1 Message Date
Sungjoon Moon
0a88cccd51 Fix compression tests in QEMU cross-compilation environments (#3248)
Some checks failed
ci / test (macos, macos-latest, nightly) (push) Waiting to run
ci / test (stable-arm-musleabi, ubuntu-latest, stable, armv7-unknown-linux-musleabi) (push) Waiting to run
ci / test (stable-powerpc64, ubuntu-latest, stable, powerpc64-unknown-linux-gnu) (push) Waiting to run
ci / test (stable-riscv64, ubuntu-latest, stable, riscv64gc-unknown-linux-gnu) (push) Waiting to run
ci / test (stable-s390x, ubuntu-latest, stable, s390x-unknown-linux-gnu) (push) Waiting to run
ci / test (stable-x86, ubuntu-latest, stable, i686-unknown-linux-gnu) (push) Waiting to run
ci / test (win-gnu, windows-latest, nightly-x86_64-gnu) (push) Waiting to run
ci / test (win-msvc, windows-latest, nightly) (push) Waiting to run
ci / test (winaarch64-msvc, windows-11-arm, nightly) (push) Waiting to run
ci / wasm (push) Waiting to run
ci / rustfmt (push) Waiting to run
ci / docs (push) Waiting to run
ci / Compile Fuzz Test Targets (push) Waiting to run
ci / test (beta, ubuntu-latest, beta) (push) Failing after 1h39m58s
ci / test (nightly, ubuntu-latest, nightly) (push) Successful in 45m17s
ci / test (pinned, ubuntu-latest, 1.85.0) (push) Successful in 13m40s
ci / test (stable, ubuntu-latest, stable) (push) Successful in 2m43s
ci / test (stable-arm-gnueabihf, ubuntu-latest, stable, armv7-unknown-linux-gnueabihf) (push) Failing after 1h24m6s
ci / test (stable-aarch64, ubuntu-latest, stable, aarch64-unknown-linux-gnu) (push) Failing after 2h27m18s
ci / test (stable-arm-musleabihf, ubuntu-latest, stable, armv7-unknown-linux-musleabihf) (push) Failing after 15m14s
ci / test (stable-musl, ubuntu-latest, stable, x86_64-unknown-linux-musl) (push) Failing after 3s
* tests: fix cmd_exists for QEMU environments

QEMU user-mode has a bug where posix_spawn returns success even when
the command doesn't exist. The child exits with 127, but the parent
thinks it succeeded.

Change cmd_exists to check if the command actually ran successfully
(exit code 0), not just if spawn returned Ok.

This fixes compression tests on riscv64 and other QEMU-emulated
architectures.

Ref https://github.com/rust-lang/rust/issues/90825

* tests: remove riscv64 skip for compression tests

Remove the cfg guards that disabled lz4, brotli, and zstd tests on
riscv64. These now work with the QEMU fix.
2025-12-17 11:38:12 -05:00
xtqqczze
cd1f981bea fix: derive Default when possible
Ref https://rust-lang.github.io/rust-clippy/master/index.html#/derivable_impls
2025-11-29 14:11:38 -05:00
Andrew Gallant
57c190d56e ignore-0.4.25 2025-10-30 13:30:14 -04:00
Ian McKellar
85edf4c796 ignore: only stat .jj if we actually care
I was comparing the work being done by fd and find and noticed (with
`strace -f -c -S` calls) that fd was doing a ton of failed `statx`
calls. Upon closer inspection it was stating `.jj` even though I
was passing `--no-ignore`. Eventually I turned up this check in
`Ignore::add_child_path` that was doing stat on `.jj` regardless of
whether the options request it.

With this patch it'll only stat `.jj` if that's relevant to the query.

PR #3212
2025-10-30 13:29:58 -04:00
Andrew Gallant
36b7597693 changelog: start next section 2025-10-22 09:02:40 -04:00
Andrew Gallant
a132e56b8c pkg/brew: update tap 2025-10-22 09:01:12 -04:00
Andrew Gallant
af60c2de9d 15.1.0 2025-10-22 08:30:04 -04:00
Andrew Gallant
a63671efb0 deps: bump to grep 0.4.1 2025-10-22 08:29:19 -04:00
Andrew Gallant
2ea06d69aa grep-0.4.1 2025-10-22 08:28:53 -04:00
Andrew Gallant
85006b08d6 deps: bump to grep-printer 0.3.1 2025-10-22 08:28:32 -04:00
10 changed files with 43 additions and 70 deletions

View File

@@ -1,3 +1,13 @@
TBD
===
Unreleased changes. Release notes have not yet been written.
Bug fixes:
* [BUG #3212](https://github.com/BurntSushi/ripgrep/pull/3212):
Don't check for the existence of `.jj` when `--no-ignore` is used.
15.1.0
======
This is a small release that fixes a bug with how ripgrep handles line

6
Cargo.lock generated
View File

@@ -159,7 +159,7 @@ dependencies = [
[[package]]
name = "grep"
version = "0.4.0"
version = "0.4.1"
dependencies = [
"grep-cli",
"grep-matcher",
@@ -242,7 +242,7 @@ dependencies = [
[[package]]
name = "ignore"
version = "0.4.24"
version = "0.4.25"
dependencies = [
"bstr",
"crossbeam-channel",
@@ -388,7 +388,7 @@ checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58"
[[package]]
name = "ripgrep"
version = "15.0.0"
version = "15.1.0"
dependencies = [
"anyhow",
"bstr",

View File

@@ -1,6 +1,6 @@
[package]
name = "ripgrep"
version = "15.0.0" #:version
version = "15.1.0" #:version
authors = ["Andrew Gallant <jamslam@gmail.com>"]
description = """
ripgrep is a line-oriented search tool that recursively searches the current
@@ -52,7 +52,7 @@ members = [
[dependencies]
anyhow = "1.0.75"
bstr = "1.7.0"
grep = { version = "0.4.0", path = "crates/grep" }
grep = { version = "0.4.1", path = "crates/grep" }
ignore = { version = "0.4.24", path = "crates/ignore" }
lexopt = "0.3.0"
log = "0.4.5"

View File

@@ -229,13 +229,14 @@ pub(crate) enum GenerateMode {
}
/// Indicates how ripgrep should treat binary data.
#[derive(Debug, Eq, PartialEq)]
#[derive(Debug, Default, Eq, PartialEq)]
pub(crate) enum BinaryMode {
/// Automatically determine the binary mode to use. Essentially, when
/// a file is searched explicitly, then it will be searched using the
/// `SearchAndSuppress` strategy. Otherwise, it will be searched in a way
/// that attempts to skip binary files as much as possible. That is, once
/// a file is classified as binary, searching will immediately stop.
#[default]
Auto,
/// Search files even when they have binary data, but if a match is found,
/// suppress it and emit a warning.
@@ -251,12 +252,6 @@ pub(crate) enum BinaryMode {
AsText,
}
impl Default for BinaryMode {
fn default() -> BinaryMode {
BinaryMode::Auto
}
}
/// Indicates what kind of boundary mode to use (line or word).
#[derive(Debug, Eq, PartialEq)]
pub(crate) enum BoundaryMode {
@@ -269,10 +264,11 @@ pub(crate) enum BoundaryMode {
/// Indicates the buffer mode that ripgrep should use when printing output.
///
/// The default is `Auto`.
#[derive(Debug, Eq, PartialEq)]
#[derive(Debug, Default, Eq, PartialEq)]
pub(crate) enum BufferMode {
/// Select the buffer mode, 'line' or 'block', automatically based on
/// whether stdout is connected to a tty.
#[default]
Auto,
/// Flush the output buffer whenever a line terminator is seen.
///
@@ -287,18 +283,13 @@ pub(crate) enum BufferMode {
Block,
}
impl Default for BufferMode {
fn default() -> BufferMode {
BufferMode::Auto
}
}
/// Indicates the case mode for how to interpret all patterns given to ripgrep.
///
/// The default is `Sensitive`.
#[derive(Debug, Eq, PartialEq)]
#[derive(Debug, Default, Eq, PartialEq)]
pub(crate) enum CaseMode {
/// Patterns are matched case sensitively. i.e., `a` does not match `A`.
#[default]
Sensitive,
/// Patterns are matched case insensitively. i.e., `a` does match `A`.
Insensitive,
@@ -308,21 +299,16 @@ pub(crate) enum CaseMode {
Smart,
}
impl Default for CaseMode {
fn default() -> CaseMode {
CaseMode::Sensitive
}
}
/// Indicates whether ripgrep should include color/hyperlinks in its output.
///
/// The default is `Auto`.
#[derive(Debug, Eq, PartialEq)]
#[derive(Debug, Default, Eq, PartialEq)]
pub(crate) enum ColorChoice {
/// Color and hyperlinks will never be used.
Never,
/// Color and hyperlinks will be used only when stdout is connected to a
/// tty.
#[default]
Auto,
/// Color will always be used.
Always,
@@ -335,12 +321,6 @@ pub(crate) enum ColorChoice {
Ansi,
}
impl Default for ColorChoice {
fn default() -> ColorChoice {
ColorChoice::Auto
}
}
impl ColorChoice {
/// Convert this color choice to the corresponding termcolor type.
pub(crate) fn to_termcolor(&self) -> termcolor::ColorChoice {
@@ -529,9 +509,10 @@ impl ContextSeparator {
/// The encoding mode the searcher will use.
///
/// The default is `Auto`.
#[derive(Debug, Eq, PartialEq)]
#[derive(Debug, Default, Eq, PartialEq)]
pub(crate) enum EncodingMode {
/// Use only BOM sniffing to auto-detect an encoding.
#[default]
Auto,
/// Use an explicit encoding forcefully, but let BOM sniffing override it.
Some(grep::searcher::Encoding),
@@ -541,21 +522,16 @@ pub(crate) enum EncodingMode {
Disabled,
}
impl Default for EncodingMode {
fn default() -> EncodingMode {
EncodingMode::Auto
}
}
/// The regex engine to use.
///
/// The default is `Default`.
#[derive(Debug, Eq, PartialEq)]
#[derive(Debug, Default, Eq, PartialEq)]
pub(crate) enum EngineChoice {
/// Uses the default regex engine: Rust's `regex` crate.
///
/// (Well, technically it uses `regex-automata`, but `regex-automata` is
/// the implementation of the `regex` crate.)
#[default]
Default,
/// Dynamically select the right engine to use.
///
@@ -566,12 +542,6 @@ pub(crate) enum EngineChoice {
PCRE2,
}
impl Default for EngineChoice {
fn default() -> EngineChoice {
EngineChoice::Default
}
}
/// The field context separator to use to between metadata for each contextual
/// line.
///
@@ -651,10 +621,11 @@ pub(crate) enum LoggingMode {
/// Indicates when to use memory maps.
///
/// The default is `Auto`.
#[derive(Debug, Eq, PartialEq)]
#[derive(Debug, Default, Eq, PartialEq)]
pub(crate) enum MmapMode {
/// This instructs ripgrep to use heuristics for selecting when to and not
/// to use memory maps for searching.
#[default]
Auto,
/// This instructs ripgrep to always try memory maps when possible. (Memory
/// maps are not possible to use in all circumstances, for example, for
@@ -666,12 +637,6 @@ pub(crate) enum MmapMode {
Never,
}
impl Default for MmapMode {
fn default() -> MmapMode {
MmapMode::Auto
}
}
/// Represents a source of patterns that ripgrep should search for.
///
/// The reason to unify these is so that we can retain the order of `-f/--flag`

View File

@@ -1,6 +1,6 @@
[package]
name = "grep"
version = "0.4.0" #:version
version = "0.4.1" #:version
authors = ["Andrew Gallant <jamslam@gmail.com>"]
description = """
Fast line oriented regex searching as a library.
@@ -17,7 +17,7 @@ edition = "2024"
grep-cli = { version = "0.1.12", path = "../cli" }
grep-matcher = { version = "0.1.8", path = "../matcher" }
grep-pcre2 = { version = "0.1.9", path = "../pcre2", optional = true }
grep-printer = { version = "0.3.0", path = "../printer" }
grep-printer = { version = "0.3.1", path = "../printer" }
grep-regex = { version = "0.1.14", path = "../regex" }
grep-searcher = { version = "0.1.16", path = "../searcher" }

View File

@@ -1,6 +1,6 @@
[package]
name = "ignore"
version = "0.4.24" #:version
version = "0.4.25" #:version
authors = ["Andrew Gallant <jamslam@gmail.com>"]
description = """
A fast library for efficiently matching ignore files such as `.gitignore`

View File

@@ -256,14 +256,15 @@ impl Ignore {
/// Like add_child, but takes a full path and returns an IgnoreInner.
fn add_child_path(&self, dir: &Path) -> (IgnoreInner, Option<Error>) {
let git_type = if self.0.opts.require_git
&& (self.0.opts.git_ignore || self.0.opts.git_exclude)
{
let check_vcs_dir = self.0.opts.require_git
&& (self.0.opts.git_ignore || self.0.opts.git_exclude);
let git_type = if check_vcs_dir {
dir.join(".git").metadata().ok().map(|md| md.file_type())
} else {
None
};
let has_git = git_type.is_some() || dir.join(".jj").exists();
let has_git =
check_vcs_dir && (git_type.is_some() || dir.join(".jj").exists());
let mut errs = PartialErrorBuilder::default();
let custom_ig_matcher = if self.0.custom_ignore_filenames.is_empty() {

View File

@@ -5,10 +5,10 @@ class RipgrepBin < Formula
if OS.mac?
url "https://github.com/BurntSushi/ripgrep/releases/download/#{version}/ripgrep-#{version}-x86_64-apple-darwin.tar.gz"
sha256 "44128c733d127ddbda461e01225a68b5f9997cfe7635242a797f645ca674a71a"
sha256 "64811cb24e77cac3057d6c40b63ac9becf9082eedd54ca411b475b755d334882"
elsif OS.linux?
url "https://github.com/BurntSushi/ripgrep/releases/download/#{version}/ripgrep-#{version}-x86_64-unknown-linux-musl.tar.gz"
sha256 "253ad0fd5fef0d64cba56c70dccdacc1916d4ed70ad057cc525fcdb0c3bbd2a7"
sha256 "1c9297be4a084eea7ecaedf93eb03d058d6faae29bbc57ecdaf5063921491599"
end
conflicts_with "ripgrep"

View File

@@ -922,8 +922,6 @@ be, to a very large extent, the result of luck. Sherlock Holmes
eqnice!(expected, cmd.stdout());
});
// lz4 decompression tool doesn't work under RISC-V QEMU emulation in CI
#[cfg(not(target_arch = "riscv64"))]
rgtest!(compressed_lz4, |dir: Dir, mut cmd: TestCommand| {
if !cmd_exists("lz4") {
return;
@@ -954,8 +952,6 @@ be, to a very large extent, the result of luck. Sherlock Holmes
eqnice!(expected, cmd.stdout());
});
// brotli decompression tool doesn't work under RISC-V QEMU emulation in CI
#[cfg(not(target_arch = "riscv64"))]
rgtest!(compressed_brotli, |dir: Dir, mut cmd: TestCommand| {
if !cmd_exists("brotli") {
return;
@@ -971,8 +967,6 @@ be, to a very large extent, the result of luck. Sherlock Holmes
eqnice!(expected, cmd.stdout());
});
// zstd decompression tool doesn't work under RISC-V QEMU emulation in CI
#[cfg(not(target_arch = "riscv64"))]
rgtest!(compressed_zstd, |dir: Dir, mut cmd: TestCommand| {
if !cmd_exists("zstd") {
return;

View File

@@ -45,7 +45,10 @@ pub fn sort_lines(lines: &str) -> String {
/// Returns true if and only if the given program can be successfully executed
/// with a `--help` flag.
pub fn cmd_exists(program: &str) -> bool {
Command::new(program).arg("--help").output().is_ok()
match Command::new(program).arg("--help").output() {
Ok(output) => output.status.success(),
Err(_) => false,
}
}
/// Dir represents a directory in which tests should be run.