Skip to content

Commit

Permalink
HPCC-29721 replicatedir not set if config dir ends with path seperator
Browse files Browse the repository at this point in the history
Causing unittest CDaliDFSStressTests testDFSRename failures.

Signed-off-by: Jake Smith <jake.smith@lexisnexisrisk.com>
  • Loading branch information
jakesmith committed Oct 30, 2023
1 parent 2ccb10e commit e4c9272
Showing 1 changed file with 22 additions and 16 deletions.
38 changes: 22 additions & 16 deletions dali/base/dafdesc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1721,7 +1721,10 @@ class CFileDescriptor: public CFileDescriptorBase, implements ISuperFileDescrip
if (!sc)
sc = getPathSepChar(dirname);
StringBuffer tmp;
tmp.append(queryBaseDirectory(grp_unknown, 0, SepCharBaseOs(sc))).append(sc).append(s);
tmp.append(queryBaseDirectory(grp_unknown, 0, SepCharBaseOs(sc)));
if (sc != tmp.charAt(tmp.length()-1))
tmp.append(sc);
tmp.append(s);
directory.set(tmp.str());
}
else
Expand Down Expand Up @@ -2934,30 +2937,33 @@ bool setReplicateDir(const char *dir,StringBuffer &out,bool isrep,const char *ba
unsigned count = 0;
unsigned i;
for (i=0;d[i]&&dir[i]&&(d[i]==dir[i]);i++)
if (isPathSepChar(dir[i])) {
{
if (isPathSepChar(dir[i]))
{
match = i;
count++;
}
}
const char *r = repDir?repDir:queryBaseDirectory(grp_unknown, isrep ? 1 : 0,os);
if (d[i]==0) {
if ((dir[i]==0)||isPathSepChar(dir[i])) {
if (d[i]==0)
{
if (dir[i]==0)
{
out.append(r);
return true;
}
else if (isPathSepChar(dir[i])) // should mean that the last char of d was not a pathsepchar
{
out.append(r).append(dir+i);
return true;
}
}
else if (count) { // this is a bit of a kludge to handle roxie backup
const char *s = r;
const char *b = s;
while (s&&*s) {
if (isPathSepChar(*s)) {
if (--count==0) {
out.append(s-b,b).append(dir+match);
return true;
}
}
s++;
else if (i>0 && isPathSepChar(d[i-1])) // implies dir[i-1] is also a pathsepchar
{
out.append(r).append(dir+i);
return true;
}
}

return false;
}

Expand Down

0 comments on commit e4c9272

Please sign in to comment.