[Crash-utility] A patch for match_file_string()

Alex Sidorenko asid at hp.com
Thu Mar 13 20:40:38 UTC 2008


Hi Dave,

on some distributions (e.g. Ubuntu) crash cannot find the live kernel image 
because of a slight mismatch between kt->proc_version and 'strings' output 
from namelist file (e.g. /boot/vmlinux-debug-2.6.22-14-generic)

Namely, kt->proc_version is LF-terminated, but there is no LF in 'strings 
vmlinux' output.

If I strip LF from the end of kt->proc_version, everything works fine

--- filesys.c.orig      2008-02-28 11:09:10.000000000 -0500
+++ filesys.c   2008-03-13 16:33:02.000000000 -0400
@@ -3689,7 +3689,10 @@
        int found;
        char command[BUFSIZE];
        FILE *pipe;
+       int slen = strlen(string);

+       if (slen && string[slen-1] == '\n')
+         string[slen-1] = '\0';

        sprintf(command, "/usr/bin/strings %s", filename);
         if ((pipe = popen(command, "r")) == NULL) {

=====================================================================

Regards,
Alex


-- 
------------------------------------------------------------------
Alexandre Sidorenko             email: alexs at hplinux.canada.hp.com
Global Solutions Engineering:   Unix Networking
Hewlett-Packard (Canada)
------------------------------------------------------------------




More information about the Crash-utility mailing list