Skip to content

Fix: strip standalone "." directory path#2711

Closed
taeruh wants to merge 1 commit intoBurntSushi:masterfrom
taeruh:master
Closed

Fix: strip standalone "." directory path#2711
taeruh wants to merge 1 commit intoBurntSushi:masterfrom
taeruh:master

Conversation

@taeruh
Copy link
Copy Markdown

@taeruh taeruh commented Jan 11, 2024

The problem is that in Ignore::matched, the perfix "./" is stripped from files. In Ignore::matched_ignore, the directory path is then stripped from file paths. Now imagine we have a hidden file "./.foo" and pass "." as the search path. "./.foo" gets first stripped to ".foo" and then it would have been stripped to "foo".

I am not completely sure though whether this is the best way to fix it. One could also check earlier whether the directory path is "." and then change it to "./". I don't know which is the best way regarding performance; the current fix is just at the place where it breaks. What do you think?

The implications of this problem (at least the ones I noticed) are that when grepping (including hidden files and passing . as search directory) in a subdirectory a/b of a, and b has a hidden file .foo, which is ignored in a ignore file in a, the contents of .foo are shown.
I put in https://github.com/taeruh/debug_file_paths a minimal debugging example to show that.

Issue #829 is similar, but I am not sure about how much it is related.

The problem is that in Ignore::matched, the perfix "./" is stripped from
files. In Ignore::matched_ignore, the directory path is then stripped
from file paths. Now imagine we have a hidden file "./.foo" and pass "."
as the search path. "./.foo" gets first stripped to ".foo" and then it
would have been stripped to "foo".
tmccombs added a commit to tmccombs/fd that referenced this pull request Mar 14, 2024
tmccombs added a commit to tmccombs/fd that referenced this pull request Mar 14, 2024
sharkdp pushed a commit to sharkdp/fd that referenced this pull request Apr 30, 2024
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request May 6, 2024
v10.0.0

Features
- Add `dir` as an alias to `directory` when using `-t` \ `--type`, see #1460 and #1464 (@Ato2207).
- Add support for @%s date format in time filters similar to GNU date (seconds since Unix epoch for --older/--newer), see #1493 (@nabellows)
- Breaking: No longer automatically ignore `.git` when using `--hidden` with vcs ignore enabled. This reverts the change in v9.0.0. While this feature
  was often useful, it also broke some existing workflows, and there wasn't a good way to opt out of it. And there isn't really a good way for us to add
  a way to opt out of it. And you can easily get similar behavior by adding `.git/` to your global fdignore file.
    See #1457.

Bugfixes
- Respect NO_COLOR environment variable with `--list-details` option. (#1455)
- Fix bug that would cause hidden files to be included despite gitignore rules
  if search path is "." (#1461, BurntSushi/ripgrep#2711).
- aarch64 builds now use 64k page sizes with jemalloc. This fixes issues on some systems, such as ARM Macs that
  have a larger system page size than the system that the binary was built on. (#1547)
- Address [CVE-2024-24576](https://blog.rust-lang.org/2024/04/09/cve-2024-24576.html), by increasing minimum rust version.

Changes
- Minimum supported rust version is now 1.77.2

On pkgsrc this has been reverted as CVE-2024-24576 only affects Windows.
scottames pushed a commit to scottames/dots that referenced this pull request May 17, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [sharkdp/fd](https://togithub.com/sharkdp/fd) | major | `v9.0.0` ->
`v10.1.0` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>sharkdp/fd (sharkdp/fd)</summary>

### [`v10.1.0`](https://togithub.com/sharkdp/fd/releases/tag/v10.1.0)

[Compare
Source](https://togithub.com/sharkdp/fd/compare/v10.0.0...v10.1.0)

#### Features

- Allow passing an optional argument to `--strip-cwd-prefix` of
"always", "never", or "auto". to force whether the cwd prefix is
stripped or not.
- Add a `--format` option which allows using a format template for
direct ouput similar to the template used for `--exec`.
([#&#8203;1043](https://togithub.com/sharkdp/fd/issues/1043))

#### Bugfixes

- Fix aarch64 page size again. This time it should actually work.
([#&#8203;1085](https://togithub.com/sharkdp/fd/issues/1085),
[#&#8203;1549](https://togithub.com/sharkdp/fd/issues/1549))
([@&#8203;tavianator](https://togithub.com/tavianator))

#### Other

- aarch64-apple-darwin target added to builds on the release page. Note
that this is a tier 2 rust target.

###
[`v10.0.0`](https://togithub.com/sharkdp/fd/blob/HEAD/CHANGELOG.md#v1000)

[Compare
Source](https://togithub.com/sharkdp/fd/compare/v9.0.0...v10.0.0)

#### Features

- Add `dir` as an alias to `directory` when using `-t` \ `--type`, see
[#&#8203;1460](https://togithub.com/sharkdp/fd/issues/1460) and
[#&#8203;1464](https://togithub.com/sharkdp/fd/issues/1464)
([@&#8203;Ato2207](https://togithub.com/Ato2207)).
- Add support for @&#8203;%s date format in time filters similar to GNU
date (seconds since Unix epoch for --older/--newer), see
[#&#8203;1493](https://togithub.com/sharkdp/fd/issues/1493)
([@&#8203;nabellows](https://togithub.com/nabellows))
- Breaking: No longer automatically ignore `.git` when using `--hidden`
with vcs ignore enabled. This reverts the change in v9.0.0. While this
feature
was often useful, it also broke some existing workflows, and there
wasn't a good way to opt out of it. And there isn't really a good way
for us to add
a way to opt out of it. And you can easily get similar behavior by
adding `.git/` to your global fdignore file.
    See [#&#8203;1457](https://togithub.com/sharkdp/fd/issues/1457).

#### Bugfixes

- Respect NO_COLOR environment variable with `--list-details` option.
([#&#8203;1455](https://togithub.com/sharkdp/fd/issues/1455))
- Fix bug that would cause hidden files to be included despite gitignore
rules
if search path is "."
([#&#8203;1461](https://togithub.com/sharkdp/fd/issues/1461),
[BurntSushi/ripgrep#2711](https://togithub.com/BurntSushi/ripgrep/issues/2711)).
- aarch64 builds now use 64k page sizes with jemalloc. This fixes issues
on some systems, such as ARM Macs that
have a larger system page size than the system that the binary was built
on. ([#&#8203;1547](https://togithub.com/sharkdp/fd/issues/1547))
- Address
[CVE-2024-24576](https://blog.rust-lang.org/2024/04/09/cve-2024-24576.html),
by increasing minimum rust version.

#### Changes

-   Minimum supported rust version is now 1.77.2

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 4pm on thursday" in timezone
America/Los_Angeles, Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/scottames/dots).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zNTEuMiIsInVwZGF0ZWRJblZlciI6IjM3LjM1MS4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiXX0=-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: scottames-github-bot[bot] <162828115+scottames-github-bot[bot]@users.noreply.github.com>
@BurntSushi BurntSushi added the rollup A PR that has been merged with many others in a rollup. label Jul 11, 2025
BurntSushi added a commit that referenced this pull request Jul 27, 2025
Note that this isn't a regression test. In particular, this didn't fail
with ripgrep 14.1.1. I couldn't figure out how to turn what the OP gave
me into a failing test.

With #829 fixed, if the OP can provide a better regression test, it
might make sense to re-investigate this.

Closes #2711
BurntSushi added a commit that referenced this pull request Sep 10, 2025
Note that this isn't a regression test. In particular, this didn't fail
with ripgrep 14.1.1. I couldn't figure out how to turn what the OP gave
me into a failing test.

With #829 fixed, if the OP can provide a better regression test, it
might make sense to re-investigate this.

Closes #2711
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rollup A PR that has been merged with many others in a rollup.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants