Skip to content

Commit

Permalink
Merge branch 'master' into maint/vasil.pashov/include-what-you-use
Browse files Browse the repository at this point in the history
  • Loading branch information
vasil-pashov authored Apr 18, 2024
2 parents e389647 + 2799e94 commit e917454
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 21 deletions.
10 changes: 0 additions & 10 deletions cpp/CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,6 @@
"name": "linux-debug",
"inherits": ["common_vcpkg", "linux"]
},
{
"name": "linux-debug-clang",
"inherits": ["common_vcpkg", "linux"],
"cacheVariables": {
"CMAKE_C_COMPILER": "clang",
"CMAKE_CXX_COMPILER": "clang++",
"STATIC_LINK_STD_LIB": "OFF"
}
},
{
"name": "linux-conda-debug",
"inherits": ["common_conda", "linux"]
Expand Down Expand Up @@ -155,7 +146,6 @@
{"name": "windows-cl-conda-debug", "configurePreset": "windows-cl-conda-debug", "targets": "arcticdb_ext" },
{"name": "windows-cl-conda-release", "configurePreset": "windows-cl-conda-release", "targets": "arcticdb_ext" },
{"name": "linux-debug", "configurePreset": "linux-debug", "targets": "arcticdb_ext" },
{"name": "linux-debug-clang", "configurePreset": "linux-debug-clang", "targets": "arcticdb_ext" },
{"name": "linux-release", "configurePreset": "linux-release", "targets": "arcticdb_ext" },
{"name": "linux-conda-debug", "configurePreset": "linux-conda-debug", "targets": "arcticdb_ext" },
{"name": "linux-conda-release", "configurePreset": "linux-conda-release", "targets": "arcticdb_ext" },
Expand Down
7 changes: 4 additions & 3 deletions cpp/arcticdb/storage/lmdb/lmdb_storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,11 @@ void LmdbStorage::do_iterate_type(KeyType key_type, const IterateTypeVisitor& vi
}
}

bool LmdbStorage::do_is_path_valid(const std::string_view pathString) const {
bool LmdbStorage::do_is_path_valid(const std::string_view pathString ARCTICDB_UNUSED) const {
#ifdef _WIN32
// Note that \ and / are valid characters as they will create subdirectories which are expected to work.
// The filenames such as COM1, LPT1, AUX, CON etc. are reserved but not strictly disallowed by Windows as directory names.
// Therefore, paths with these names are allowed.
std::string_view invalid_win32_chars = "<>:\"|?*";
auto found = pathString.find_first_of(invalid_win32_chars);
if (found != std::string::npos) {
Expand All @@ -267,8 +270,6 @@ bool LmdbStorage::do_is_path_valid(const std::string_view pathString) const {
if (!pathString.empty() && (pathString.back() == '.' || std::isspace(pathString.back()))) {
return false;
}
#else
(void) pathString; // suppress -Werror=unused-parameter
#endif
return true;
}
Expand Down
11 changes: 5 additions & 6 deletions cpp/arcticdb/util/name_validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,11 @@ void verify_library_path_part(const std::string& library_part, char delim) {

void verify_library_path_on_write(const Store* store, const StringId& library_path) {
verify_name("library name", library_path, true, UNSUPPORTED_S3_CHARS);
if(!store->is_path_valid(library_path)) {
user_input::raise<ErrorCode::E_INVALID_CHAR_IN_NAME>(
"The library name contains unsupported chars. Library Name: {}",
library_path
);
}
user_input::check<ErrorCode::E_INVALID_CHAR_IN_NAME>(
store->is_path_valid(library_path),
"The library name contains unsupported chars. Library Name: {}",
library_path
);
}

}
3 changes: 2 additions & 1 deletion python/arcticdb/adapters/azure_library_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ def __init__(self, uri: str, encoding_version: EncodingVersion, *args, **kwargs)
super().__init__(uri, self._encoding_version)

def __repr__(self):
return "azure(endpoint=%s, container=%s)" % (self._endpoint, self._container)
censored_endpoint = re.sub(r"AccountKey=.+?;", "AccountKey=...;", self._endpoint)
return "azure(endpoint=%s, container=%s)" % (censored_endpoint, self._container)

@property
def config_library(self):
Expand Down
6 changes: 6 additions & 0 deletions python/tests/integration/arcticdb/test_arctic.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,12 @@ def test_delete_date_range(arctic_library):
assert lib["symbol"].version == 1


def test_azure_repr_body_censored(arctic_library):
ac_library_repr = repr(arctic_library)
if "AccountKey=" in ac_library_repr:
assert "AccountKey=..." in ac_library_repr.split(";")


def _test_mongo_repr_body(mongo_storage: MongoDatabase):
# The arctic_uri has the PrefixingLibraryAdapterDecorator logic in it, so use mongo_uri
ac = Arctic(f"{mongo_storage.mongo_uri}/?maxPoolSize=10")
Expand Down
2 changes: 1 addition & 1 deletion python/tests/integration/arcticdb/test_lmdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def test_lmdb_malloc_trim(lmdb_storage):
lib._nvs.trim()

@pytest.mark.skipif(sys.platform != "win32", reason="Non Windows platforms have different file path name restrictions")
@pytest.mark.parametrize("invalid_lib_name", ["lib?1", "lib:1", "lib|1", "lib.", "lib "])
@pytest.mark.parametrize("invalid_lib_name", ["lib?1", "lib:1", "lib|1", "lib\"1", "lib.", "lib "])
def test_invalid_lmdb_lib_name_windows(lmdb_storage, invalid_lib_name):
ac = lmdb_storage.create_arctic()
with pytest.raises(UserInputException) as e:
Expand Down

0 comments on commit e917454

Please sign in to comment.