Skip to content

Conversation

@rjernst
Copy link
Member

@rjernst rjernst commented Feb 7, 2025

FileAccessTrees operate on string paths, but use the FileSystem to normalize the path. This test assertion is trying to check backslash's aren't interpreted as an escape, but escapes happen before the path is sent to FileSystem, so here we end up passing a newline as part of a path, which fails on windows. This commit removes the assertion.

closes #121872

The only real path separators are either forward or back slash. Trying
to use something else like newline fails to even parse as a path on
windows. This commit removes testing of other separators.

closes elastic#121872
@rjernst rjernst added >test Issues or PRs that are addressing/adding tests :Core/Infra/Core Core issues without another label auto-backport Automatically create backport pull requests when merged v8.18.1 v8.19.0 v9.0.1 v9.1.0 labels Feb 7, 2025
@rjernst rjernst requested a review from prdoyle February 7, 2025 18:02
@elasticsearchmachine elasticsearchmachine added the Team:Core/Infra Meta label for core/infra team label Feb 7, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

@prdoyle
Copy link
Contributor

prdoyle commented Feb 7, 2025

I wasn't testing newline as a separator. I was testing that a backslash is not accidentally interpreted as an escape character.

@rjernst
Copy link
Member Author

rjernst commented Feb 7, 2025

Parsing of a path with a newline fails on windows. Did you mean to put a literal backslash followed by an n?

@prdoyle
Copy link
Contributor

prdoyle commented Feb 7, 2025

No, I meant a newline.

Short answer: let's delete this and forget the whole thing. 😂

Longer answer: I managed to scare myself that someone could put a backslash in one of our files someplace, and since it's so common that backslash is a separator, I worried that someone along the line would treat it as an escape. I wanted to assert that this won't happen. But I'm not sure that's a real risk, and even if it is, I'm not sure this is the right place to test for it.

@rjernst
Copy link
Member Author

rjernst commented Feb 7, 2025

I'm still not sure the test makes sense. A backslash for escaping is handled by string parsing. The filesystem doesn't interpret the escape.

Copy link
Contributor

@prdoyle prdoyle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a bit misguided and is obviously doing more harm than good.

@rjernst rjernst changed the title Remove assertion about theoretical path separators Remove assertion for escapes in FileAccessTreeTests Feb 7, 2025
@rjernst rjernst merged commit 743e5d4 into elastic:main Feb 7, 2025
17 checks passed
@prdoyle
Copy link
Contributor

prdoyle commented Feb 7, 2025

There are a lot of layers that could interpret backslashes along the chain from file contents to in-memory data structures, including the YAML parser, our own normalization logic, etc. My thinking was, putting the test here would ensure none of them trip over the backslash.

But again... this was probably misguided so let's give it the axe.

rjernst added a commit to rjernst/elasticsearch that referenced this pull request Feb 7, 2025
The only real path separators are either forward or back slash. Trying
to use something else like newline fails to even parse as a path on
windows. This commit removes testing of other separators.

closes elastic#121872
rjernst added a commit to rjernst/elasticsearch that referenced this pull request Feb 7, 2025
The only real path separators are either forward or back slash. Trying
to use something else like newline fails to even parse as a path on
windows. This commit removes testing of other separators.

closes elastic#121872
@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
8.18
8.x
9.0

rjernst added a commit to rjernst/elasticsearch that referenced this pull request Feb 7, 2025
The only real path separators are either forward or back slash. Trying
to use something else like newline fails to even parse as a path on
windows. This commit removes testing of other separators.

closes elastic#121872
elasticsearchmachine pushed a commit that referenced this pull request Feb 7, 2025
The only real path separators are either forward or back slash. Trying
to use something else like newline fails to even parse as a path on
windows. This commit removes testing of other separators.

closes #121872
elasticsearchmachine pushed a commit that referenced this pull request Feb 7, 2025
The only real path separators are either forward or back slash. Trying
to use something else like newline fails to even parse as a path on
windows. This commit removes testing of other separators.

closes #121872
elasticsearchmachine pushed a commit that referenced this pull request Feb 7, 2025
The only real path separators are either forward or back slash. Trying
to use something else like newline fails to even parse as a path on
windows. This commit removes testing of other separators.

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

Labels

auto-backport Automatically create backport pull requests when merged :Core/Infra/Core Core issues without another label Team:Core/Infra Meta label for core/infra team >test Issues or PRs that are addressing/adding tests v8.18.1 v8.19.0 v9.0.1 v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CI] FileAccessTreeTests testForwardSlashes failing

3 participants