commit:     83325e68514d4d55554bff9439b61c03f12d4d8b
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Oct  4 11:29:43 2020 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Oct  4 11:29:43 2020 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=83325e68

qlop: deal with optionally compressed buildlogs in probe_proc

Bug: https://bugs.gentoo.org/745798
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 qlop.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/qlop.c b/qlop.c
index f8248d4..316c9b0 100644
--- a/qlop.c
+++ b/qlop.c
@@ -1232,6 +1232,20 @@ static array_t *probe_proc(array_t *atoms)
                                                continue;
                                        rpath[rpathlen] = '\0';
 
+                                       /* in bug #745798, it seems Portage 
optionally
+                                        * compresses the buildlog -- to make 
matching below
+                                        * here easier, strip such compression 
extension off
+                                        * first here, leaving .log */
+                                       if ((size_t)rpathlen > 
sizeof(".log.gz") &&
+                                                       (p = strrchr(rpath, 
'.')) != NULL &&
+                                                       p - (sizeof(".log") - 
1) > rpath &&
+                                                       strncmp(p - 
(sizeof(".log") - 1), ".log",
+                                                               sizeof(".log") 
- 1) == 0)
+                                       {
+                                               *p = '\0';
+                                               rpathlen -= rpath - p;
+                                       }
+
                                        /* check if this points to a portage 
build:
                                         * 
<somepath>/portage/<cat>/<pf>/temp/build.log
                                         * 
<somepath>/<cat>:<pf>:YYYYMMDD-HHMMSS.log */

Reply via email to