This case arises when listing the top directory of a bucket, and,
with proper continued enumeration, would generate a non-terminating
loop if a directory contained names which sort lexically before '/'.
Fixes: https://tracker.ceph.com/issues/41252
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
(cherry picked from commit
ca546fc53e5111052cbd7da35cb3105dde9b8bd1)
reserve += (1 + tfh->object_name().length());
tfh = tfh->parent;
}
- bool first = true;
+ int pos = 1;
path.reserve(reserve);
for (auto& s : boost::adaptors::reverse(segments)) {
- if (! first)
+ if (pos > 1) {
path += "/";
- else {
+ } else {
if (!omit_bucket && (path.front() != '/')) // pretty-print
path += "/";
- first = false;
}
path += *s;
+ ++pos;
}
return path;
}
const char* mk = get<const char*>(offset);
if (mk) {
std::string tmark{rgw_fh->relative_object_name()};
- tmark += "/";
- tmark += mk;
+ if (tmark.length() > 0)
+ tmark += "/";
+ tmark += mk;
marker = rgw_obj_key{std::move(tmark), "", ""};
}
}