Possibly caused by https://github.com/spring-projects/spring-framework/commit/0eb66789edd6122ab4f395b5a76d23255c0da337
simple app here https://github.com/spencergibb/path-matching-regression
With boot 2.7/framework 5.3 [file:/[pathtorepo]/configdir/subdir/]
is returned from matchingDirectories.
In boot 3 snap and framework 6, an empty list is returned.
Original method is here https://github.com/spring-cloud/spring-cloud-config/blob/670bdd7b5d8d8ad1dd53be914063cc6534205e24/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/support/AbstractScmAccessor.java#L256-L270
Failing tests are https://github.com/spring-cloud/spring-cloud-config/blob/670bdd7b5d8d8ad1dd53be914063cc6534205e24/spring-cloud-config-server/src/test/java/org/springframework/cloud/config/server/environment/JGitEnvironmentRepositoryTests.java#L168-L177
and
https://github.com/spring-cloud/spring-cloud-config/blob/670bdd7b5d8d8ad1dd53be914063cc6534205e24/spring-cloud-config-server/src/test/java/org/springframework/cloud/config/server/environment/JGitEnvironmentRepositoryIntegrationTests.java#L234-L246
/cc @bclozel @jhoeller @sbrannen @ryanjbaxter
Comment From: sbrannen
I imagine this is due to the change in d21eea7de4259a1b0636d132406091905b9755cf, since we explicitly only return "regular files" as a result of that.
@wilkinsona had reported a regression in that we started returning directories and had not done so before.
And now this issue is claiming that we did previously return directories and no longer do.
So these two claims seem to contradict, but perhaps it's due to a nuance in the patterns that are used.
Comment From: sbrannen
I just confirmed that removing Files.isRegularFile(path)
from the isMatchingFile
predicate in PathMatchingResourcePatternResolver.doFindPathMatchingFileResources()
allows the configdir/subdir
to be found again (as was to be expected).
So if we revert that change, we'll need to investigate a different solution to the issue raised by @wilkinsona.
Comment From: wilkinsona
https://github.com/spring-projects/spring-boot/commit/7eb8abbda86da7a456148cfae7d5f2cd466bbf9a is the change that I had to make when the behaviour first changed and https://github.com/spring-projects/spring-boot/commit/03b3a772c9d1b8157ee15c935bd3fdb86c073cb3 is the change after https://github.com/spring-projects/spring-framework/commit/d21eea7de4259a1b0636d132406091905b9755cf. Hopefully the tests that were affected show the patterns that were involved.
Comment From: sbrannen
It looks like the difference between returning directories and not is that a pattern like subdir/**
now (in Framework 6) returns subdir/
as a matching resource; whereas, in Framework 5.3.x and prior subdir/**
did not match against subdir/
.
Comment From: sbrannen
Update: I do not have time to resolve this issue before the 6.0 RC2 release tomorrow; however, I have checked in tests that verify the status quo for 5.3.x
and merged those to main
(with failing tests @Disabled
) in 004875670b1e4476c9ffe4030f3b455c45e35f97.
The disabled tests should help us to sort out the differences between 5.3.x
and main
.