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

Many shell tests do not escape regular expression meta-characters properly #5915

Open
chrisd8088 opened this issue Nov 18, 2024 · 0 comments

Comments

@chrisd8088
Copy link
Member

chrisd8088 commented Nov 18, 2024

Describe the issue

As mentioned in #5914 (comment), we have a fairly large number of places in our test suite where we perform grep(1) commands using regular expressions in which we have not fully escaped all the meta-characters like . and *.

For instance, this check in a test from t/t-migrate-export.sh aims to confirm that git lfs track outputs the expected "*.jpg" already supported message:

git lfs track "*.jpg" | grep "\"*.jpg\" already supported"

However, this would match if the message contained the string XYZjpg" already supported or Zjpg" already supported (but not jpg" already supported) because the "* matches zero or more " characters, and the . matches any character.

System environment

The examples above were performed on macOS, but should behave the same way on any platform.

Output of git lfs env

git-lfs/3.5.1 (GitHub; darwin arm64; go 1.22.1)
git version 2.47.0

Additional context

There are a significant number of these kinds of oversights in our tests' regular expressions, mostly involving meta-characters like . and *, since those are frequently used in filenames and shell wildcards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Bugs
Development

No branches or pull requests

1 participant