Date: Mon, 29 Jul 2002 00:14:00 -0700 (PDT) From: Miguel Angel Vicente Serrano <miguelangel@cic.es> To: freebsd-gnats-submit@FreeBSD.org Subject: misc/41107: file(1) command shows incorrect data (signal #) when working with core files Message-ID: <200207290714.g6T7E0Uc002727@www.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 41107 >Category: misc >Synopsis: file(1) command shows incorrect data (signal #) when working with core files >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Jul 29 00:20:02 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Miguel Angel Vicente Serrano >Release: 4.5 RELEASE >Organization: CICSA (Spain) >Environment: FreeBSD personal.sistemas.com 4.5-RELEASE FreeBSD 4.5-RELEASE #0: Mon Jan 28 14:31:56 GMT 2002 murray@builder.freebsdmall.com:/usr/src/sys/compile/GENERIC i386 >Description: when we run "file corefile" we get an incorrect information about signal number which caused the core (always shows the number 4477762). /usr/share/misc/magic file has information about the offset of the signal and the name of the program in the core file. Perhaps these offsets are wrong in the case of FreeBSD's core files, but are good for Linux's cores. >How-To-Repeat: we can create some core files, for instance: sleep 300 & kill -3 $! we have sleep.core file (the signal can be 3, 4, 5, 6, 7, 8, 10, 11 or 12) we run "file sleep.core" and get this: sleep.core: ELF 32-bit LSB core file (signal 4477762), Intel 80386, version 1 (FreeBSD), from 'sleep' as you can see the signal number is wrong (must be 3, the one used with kill) >Fix: we create a temporal copy of "magic" file in /tmp directory: cd /tmp cp /usr/share/misc/magic . we work with this temporal copy of "magic" file we must change two lines, so the offsets of the signal and the program are right replace the line #6752 >Release-Note: >Audit-Trail: >Unformatted: >>>(0x38+0xcc) string >\0 of '%s' with this one >>>(0x38+0x15c) string >\0 of '%s' replace the line #6753 >>>(0x38+0x10) lelong >0 (signal %d), with this one >>>(0x38+0x28) lelong >0 (signal %d), we write a magic.mgc file: file -C -m magic we install the new pre-parsed version of magic file: mv /usr/share/misc/magic.mgc /usr/share/misc/magic.mgc.old mv magic.mgc /usr/share/misc we run "file sleep.core" and get this: sleep.core: ELF 32-bit LSB core file of 'sleep' (signal 3), Intel 80386, version 1 (FreeBSD), from 'sleep' as you can see the signal number is right (the one used with kill) and the name of the program is shown (LSB core file of 'sleep') To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200207290714.g6T7E0Uc002727>