From b955eb772987f02bb28e20dd99ae6670a96c8791 Mon Sep 17 00:00:00 2001 From: Jake Smith Date: Fri, 17 May 2024 12:16:32 +0100 Subject: [PATCH] HPCC-31873 Suppress root scope (.::) from expanded logical files. If a logical file is passed to expandLogicalFilename that has no leading scopes, CDfsLogicalFileName::set inserts a leading .:: I am not sure that is right under any circumstances, but in particular it caused a regression to roxie package maps, where it failed to resolve a virtual superfile. Signed-off-by: Jake Smith --- common/thorhelper/roxiehelper.cpp | 4 ++-- dali/base/dautils.cpp | 4 ++-- dali/base/dautils.hpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/common/thorhelper/roxiehelper.cpp b/common/thorhelper/roxiehelper.cpp index d2425799277..5ccf4c06c82 100644 --- a/common/thorhelper/roxiehelper.cpp +++ b/common/thorhelper/roxiehelper.cpp @@ -2766,7 +2766,7 @@ StringBuffer & expandLogicalFilename(StringBuffer & logicalName, const char * fn CDfsLogicalFileName dlfn; dlfn.setAllowWild(true); dlfn.setAllowTrailingEmptyScope(true); - dlfn.set(fname+1); + dlfn.set(fname+1, false, true); logicalName.append(dlfn.get(ignoreForeignPrefix)); } else if (resolveLocally) @@ -2792,7 +2792,7 @@ StringBuffer & expandLogicalFilename(StringBuffer & logicalName, const char * fn CDfsLogicalFileName dlfn; dlfn.setAllowWild(true); dlfn.setAllowTrailingEmptyScope(true); - dlfn.set(lfn.str()); + dlfn.set(lfn.str(), false, true); logicalName.append(dlfn.get()); } return logicalName; diff --git a/dali/base/dautils.cpp b/dali/base/dautils.cpp index b69e5a1e917..622e28e3a92 100644 --- a/dali/base/dautils.cpp +++ b/dali/base/dautils.cpp @@ -873,7 +873,7 @@ bool CDfsLogicalFileName::normalizeExternal(const char * name, StringAttr &res, return true; } -void CDfsLogicalFileName::set(const char *name, bool removeForeign) +void CDfsLogicalFileName::set(const char *name, bool removeForeign, bool skipAddRootScopeIfNone) { clear(); if (!name) @@ -919,7 +919,7 @@ void CDfsLogicalFileName::set(const char *name, bool removeForeign) external = true; else { - normalizeName(name, lfn, false, true); + normalizeName(name, lfn, false, !skipAddRootScopeIfNone); if (removeForeign) { StringAttr _lfn = get(true); diff --git a/dali/base/dautils.hpp b/dali/base/dautils.hpp index a18c3542996..79d4cf599cb 100644 --- a/dali/base/dautils.hpp +++ b/dali/base/dautils.hpp @@ -71,7 +71,7 @@ class da_decl CDfsLogicalFileName ~CDfsLogicalFileName(); CDfsLogicalFileName & operator = (CDfsLogicalFileName const &from); - void set(const char *lfn, bool removeForeign=false); // throws an exception on invalid filenames + void set(const char *lfn, bool removeForeign=false, bool skipAddRootScopeIfNone=false); // throws an exception on invalid filenames bool setValidate(const char *lfn, bool removeForeign=false); // returns false for invalid filenames void set(const CDfsLogicalFileName &lfn); void set(const char *scopes,const char *tail);