File: 0001-Always-assign-partial-when-returning-true.patch

package info (click to toggle)
xrootd-s3-http 0.4.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 612 kB
  • sloc: cpp: 7,016; sh: 597; makefile: 14
file content (49 lines) | stat: -rw-r--r-- 1,822 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
From fdf663371dffc5d8bc7b68f00061e8e3c66b340a Mon Sep 17 00:00:00 2001
From: Mattias Ellert <mattias.ellert@physics.uu.se>
Date: Sun, 8 Jun 2025 11:47:42 +0200
Subject: [PATCH] Always assign `partial` when returning `true`

[ RUN      ] FileSystemGlob.Globstar
=====> filter.glob /prefix1 /prefix2/*.txt
=====> filter.glob /prefix3/*/*.txt
=====> filter.prefix /prefix5
=====> filter.trace all
250608 01:04:48 8741 filter_Config: Will permit glob /prefix1
250608 01:04:48 8741 filter_Config: Will permit glob /prefix2/*.txt
250608 01:04:48 8741 filter_Config: Will permit glob /prefix3/*/*.txt
250608 01:04:48 8741 filter_Config: Will permit glob /prefix5/** all
250608 01:04:48 8741 filter_Initialize: FilterFileSystem initialized
250608 01:04:48 8741 FileSystemGlobGlobstar: Testing /some/path
./test/filter_tests.cc:385: Failure
Value of: partial
  Actual: true
Expected: false

[  FAILED  ] FileSystemGlob.Globstar (0 ms)
---
 src/Filter.cc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/Filter.cc b/src/Filter.cc
index f85b7f2..aca2e9c 100644
--- a/src/Filter.cc
+++ b/src/Filter.cc
@@ -434,6 +434,7 @@ bool FilterFileSystem::GlobOne(const std::filesystem::path &path,
 			// If the globstar is at the end of the glob, then we match
 			// any subsequent part of the path.
 			if (++cur_glob_component == glob.m_glob.end()) {
+				partial = false;
 				return true;
 			} else {
 				// To evaluate the globstar, we compare the remainder of the
@@ -489,6 +490,7 @@ bool FilterFileSystem::GlobOne(const std::filesystem::path &path,
 					if (GlobOne(subpath, {glob.m_match_dotfile, new_glob},
 								subpartial)) {
 						if (!subpartial && !path_prefix_has_dotfile) {
+							partial = false;
 							return true;
 						} else if (path_prefix_has_dotfile) {
 							potential_match = false;
-- 
2.49.0