Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't search in ZIP and tar.gz files #918

Closed
kenorb opened this issue May 11, 2018 · 3 comments
Closed

Can't search in ZIP and tar.gz files #918

kenorb opened this issue May 11, 2018 · 3 comments
Labels
bug A bug. question An issue that is lacking clarity on one or more points.

Comments

@kenorb
Copy link

kenorb commented May 11, 2018

What version of ripgrep are you using?

$ rg --version
ripgrep 0.8.1
-SIMD -AVX

What operating system are you using ripgrep on?

$ macosver 
ProductBuildVersion 17C2120
ProductCopyright 1983-2017 Apple Inc.
ProductName Mac OS X
ProductUserVisibleVersion 10.13.2
ProductVersion 10.13.2

If this is a bug, what are the steps to reproduce the behavior?

$ echo test > test
$ zip test.zip test
  adding: test (stored 0%)
$ tar zcvf test.tar.gz test
a test
$ gzip test
$ rg -z test
./test.gz
1:test
 $ rg -zl test
test.gz

What is the actual behavior?

No .zip or .tar.gz are searched.

If this is a bug, what is the expected behavior?

Should search in .zip and .tar.gz files.

@BurntSushi
Copy link
Owner

The documentation states:

Search in compressed files. Currently gz, bz2, xz, and lzma files are
supported. This option expects the decompression binaries to be available in
your PATH.

So this is expected behavior. ripgrep does not advertise support for searching through tar archives.

@BurntSushi BurntSushi added the invalid An issue that is not actually a bug or a feature that already exists. label May 12, 2018
@kenorb
Copy link
Author

kenorb commented May 12, 2018

I thought --search-zip arg is self-explanatory. And also thought .tar.gz is included as part of .gz.

And at the end, .tar is just plain binary file, so this works:

$ rg -a test test.tar.gz
1?(?Ztest.tar??A

but this not:

$ rg -z -a test test.tar.gz

So if this is as expected, can we keep it open as part of the feature request?

@BurntSushi
Copy link
Owner

That's because tar archives are explicitly skipped:

if is_tar_archive(path) {
debug!("{}: skipping tar archive", path.display());
return None;
}

I admit, it does seem like rg -z -a test test.tar.gz should work.

@BurntSushi BurntSushi reopened this May 12, 2018
@BurntSushi BurntSushi added bug A bug. question An issue that is lacking clarity on one or more points. and removed invalid An issue that is not actually a bug or a feature that already exists. labels Jun 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug. question An issue that is lacking clarity on one or more points.
Projects
None yet
Development

No branches or pull requests

2 participants