fix: don't call check_section() in filesystem ctor (fixes gh #183)

This regression was introduced in the v0.7.3 release and caused each
section header to be read from the filesystem image at mount time,
defeating the purpose of the section index.
This commit is contained in:
Marcus Holland-Moritz 2023-12-27 22:07:31 +01:00
parent dc904ba730
commit 67a4de0d52

View File

@ -524,11 +524,17 @@ filesystem_<LoggerPolicy>::filesystem_(
section_map sections;
while (auto s = parser.next_section()) {
check_section(*s);
if (s->type() == section_type::BLOCK) {
// Don't use check_section() here because it'll trigger the lazy
// section to load, defeating the purpose of the section index.
// See github issue #183.
LOG_DEBUG << "section " << s->name() << " @ " << s->start() << " ["
<< s->length() << " bytes]";
cache.insert(*s);
} else {
check_section(*s);
if (!s->check_fast(*mm_)) {
DWARFS_THROW(runtime_error, "checksum error in section: " + s->name());
}