Skip to content

Commit

Permalink
fix: don't call check_section() in filesystem ctor (fixes gh #183)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mhx committed Dec 28, 2023
1 parent 7cc60d0 commit 9c12f68
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/dwarfs/filesystem_v2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down

0 comments on commit 9c12f68

Please sign in to comment.