From d89ad6b94f691fde52faab380bf92f7d555adce3 Mon Sep 17 00:00:00 2001 From: Marcus Holland-Moritz Date: Sun, 25 Aug 2024 14:06:22 +0200 Subject: [PATCH] chore(filesystem_extractor): add more debug/trace logging --- src/utility/filesystem_extractor.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/utility/filesystem_extractor.cpp b/src/utility/filesystem_extractor.cpp index 3014431b1..6c7e85853 100644 --- a/src/utility/filesystem_extractor.cpp +++ b/src/utility/filesystem_extractor.cpp @@ -113,6 +113,8 @@ class filesystem_extractor_ final : public filesystem_extractor::impl { void open_archive(std::filesystem::path const& output, std::string const& format) override { + LOG_DEBUG << "opening archive file in " << format << " format"; + a_ = ::archive_write_new(); check_result(::archive_write_set_format_by_name(a_, format.c_str())); @@ -140,6 +142,8 @@ class filesystem_extractor_ final : public filesystem_extractor::impl { iot_ = std::make_unique( [this, &os, fd = pipefd_[0]] { pump(os, fd); }); + LOG_DEBUG << "opening archive stream in " << format << " format"; + a_ = ::archive_write_new(); check_result(::archive_write_set_format_by_name(a_, format.c_str())); @@ -162,17 +166,22 @@ class filesystem_extractor_ final : public filesystem_extractor::impl { void close() override { if (a_) { + LOG_DEBUG << "closing archive"; check_result(::archive_write_close(a_)); + LOG_TRACE << "freeing archive"; ::archive_write_free(a_); a_ = nullptr; } if (iot_) { + LOG_TRACE << "closing pipe[1]"; closefd(pipefd_[1]); + LOG_TRACE << "joining I/O thread"; iot_->join(); iot_.reset(); + LOG_TRACE << "closing pipe[0]"; closefd(pipefd_[0]); } } @@ -200,6 +209,8 @@ class filesystem_extractor_ final : public filesystem_extractor::impl { // Flawfinder: ignore auto rv = ::read(fd, buf.data(), buf.size()); + LOG_TRACE << "read() returned " << rv; + if (rv <= 0) { if (rv < 0) { LOG_ERROR << "read(): " << ::strerror(errno);