From 696c70ae13cff6551823c0bfd9de7a0ad80da8e8 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 10 Jun 2015 08:02:29 +0200 Subject: [PATCH] COPKGManager: show debug lines on founded bad packages It seems some innocent packages could be filtered but without plausible reason and this should be indicated. --- src/gui/opkg_manager.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/gui/opkg_manager.cpp b/src/gui/opkg_manager.cpp index a5990aba2..ea6e917e9 100644 --- a/src/gui/opkg_manager.cpp +++ b/src/gui/opkg_manager.cpp @@ -324,22 +324,32 @@ static std::string bad_pattern[] = { bool COPKGManager::badpackage(std::string &s) { int i; + string st = ""; for (i = 0; !bad_pattern[i].empty(); i++) { - std::string p = bad_pattern[i]; + string p = bad_pattern[i]; size_t patlen = p.length() - 1; + bool res = false; /* poor man's regex :-) only supported are "^" and "$" */ if (p.substr(patlen, 1) == "$") { /* match at end */ if (s.rfind(p.substr(0, patlen)) == (s.length() - patlen)) - return true; + res = true; } else if (p.substr(0, 1) == "^") { /* match at beginning */ if (s.find(p.substr(1)) == 0) - return true; + res = true; } else { /* match everywhere */ if (s.find(p) != std::string::npos) - return true; + res = true; } + if (res) + st += p + " "; } + + if (!st.empty()){ + dprintf(DEBUG_NORMAL, "[COPKGManager] [%s - %d] found bad package => %s [filtered with %s]\n", __func__, __LINE__, s.c_str(), st.c_str()); + return true; + } + return false; }