[PATCH] Add ending identifier for task structure parsing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Previously, the ending identifier for parsing the task structure
member is "  }, \n". However the ending identifier is not always
as expected. "  },\n" can also be the ending identifier. For example,
if we have the following struct, the parsing will fail.

  tasks = {\n
    next = 0xffff94f8038f8838,\n
    prev = 0xffff94f8036f8838\n
  },\n

Before:
    crash> task -R tasks ffff94f8038f4000
    PID: 847      TASK: ffff94f8038f4000  CPU: 72   COMMAND: "khungtaskd"

After:
    crash> task -R tasks ffff94f8038f4000
    PID: 847      TASK: ffff94f8038f4000  CPU: 72   COMMAND: "khungtaskd"
      tasks = {
        next = 0xffff94f8038f8838,
        prev = 0xffff94f8036f8838
      },

Signed-off-by: Tao Liu <ltao@xxxxxxxxxx>
---
 task.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/task.c b/task.c
index 071c787..db2abc8 100644
--- a/task.c
+++ b/task.c
@@ -3436,7 +3436,8 @@ parse_task_thread(int argcnt, char *arglist[], struct task_context *tc) {
         while (fgets(buf, BUFSIZE, pc->tmpfile)) {
 		if (STREQ(buf, "  {\n"))
 			randomized = TRUE;
-		else if (randomized && STREQ(buf, "  }, \n"))
+		else if (randomized &&
+			 (STREQ(buf, "  }, \n") || STREQ(buf, "  },\n")))
 			randomized = FALSE;
 
 		if (strlen(lookfor2)) {
-- 
2.33.1

--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/crash-utility
Contribution Guidelines: https://github.com/crash-utility/crash/wiki




[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux