Re: [PATCH] Fix junk values when run crash on a .gz file

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

 



On Tue, 2011-12-06 at 09:50 -0500, Dave Anderson wrote:
> 
> ----- Original Message -----
> > On Mon, 2011-12-05 at 15:03 -0500, Dave Anderson wrote:
> > > 
> > > ----- Original Message -----
> > > >
> > > > So I guess the proper thing to do would be to check for the FNAME bit
> > > > in the FLG byte, and if it's not set, I guess we could either accept
> > > > the file without prejudice, or print a message indicating that the
> > > > name has been stripped and that -f should be used.
> > > 
> > > I wasn't aware of "gzip -n" or "gzip --no-name" when I wrote the
> > > original function.  How does the attached patch work for you?
> > > Instead of either suggestion above, it will just print a NOTE if
> > > you don't use "-f".
> > > 
> > > Dave
> > > 
> > Hi Dave,
> > 
> > The attached patch works for me. It prints the file name is unknown. How
> > about printing the file name is unknown and -f should be used as u
> > mentioned in the previous mail.
> 
> OK, will do -- queued for crash-6.0.2.
> 
> Thanks
>   Dave
> 

Hi Dave,

A return statement is missing in the if condition when a .gz file header
contains no filename. Request you to include the same.

--- crash-6.0.1/symbols.c.orig
+++ crash-6.0.1/symbols.c
@@ -2983,6 +2983,8 @@ is_compressed_kernel(char *file, char **
 #define GZIP  (1)
 #define BZIP2 (2)
 
+#define FNAME (1 << 3)
+
        if ((fd = open(file, O_RDONLY)) < 0)
                return FALSE;
 
@@ -2995,7 +2997,12 @@ is_compressed_kernel(char *file, char **
        type = 0;
 
        if ((header[0] == 0x1f) && (header[1] == 0x8b) && (header[2] ==
8)) {
-               if (!STRNEQ((char *)&header[10], "vmlinux") && 
+               if (!(header[3] & FNAME)) {
+                       if (!(st->flags & FORCE_DEBUGINFO))
+                               error(NOTE, "%s: "
+                                   "original filename unknown\n\n",
+                                       file);
				return FALSE;----> to be included.
+               } else if (!STRNEQ((char *)&header[10], "vmlinux") && 
                    !(st->flags & FORCE_DEBUGINFO)) {
                        error(INFO, "%s: compressed file name does not "
                            "start with \"vmlinux\"\n", &header[10]);

Regards,
Aruna


--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/crash-utility


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

 

Powered by Linux