From 611b02d874cc6cd84bae3f6e90261359ab0fc460 Mon Sep 17 00:00:00 2001 From: Ninad Sachania Date: Sat, 2 Nov 2024 09:41:41 +0000 Subject: [PATCH] Utilities/pkg: Print the line number of invalid entries --- Userland/Utilities/pkg/InstalledPortDatabase.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Userland/Utilities/pkg/InstalledPortDatabase.cpp b/Userland/Utilities/pkg/InstalledPortDatabase.cpp index b3f08c71868cf7..3a1828415a77a6 100644 --- a/Userland/Utilities/pkg/InstalledPortDatabase.cpp +++ b/Userland/Utilities/pkg/InstalledPortDatabase.cpp @@ -39,16 +39,18 @@ ErrorOr> InstalledPortDatabase::instantiate auto appending_database_file_descriptor = TRY(Core::File::open(path, Core::File::OpenMode::Write | Core::File::OpenMode::Append)); auto buffered_file = TRY(Core::InputBufferedFile::create(move(file))); auto buffer = TRY(ByteBuffer::create_uninitialized(PAGE_SIZE)); + int line_number = 0; HashMap ports; while (TRY(buffered_file->can_read_line())) { auto line = TRY(buffered_file->read_line(buffer)); + line_number += 1; if (line.is_empty()) continue; auto parts = line.split_view(' '); if (parts.size() < 2) { - dbgln("Invalid database entry {} (only {} parts)", line, parts.size()); + dbgln("Invalid database entry '{}' (only {} parts) on line {}", line, parts.size(), line_number); continue; } auto install_type_string = parts[0];