From owner-freebsd-bugs Mon Jul 29 0:20:17 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 204D337B401 for ; Mon, 29 Jul 2002 00:20:04 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 26ABC43E6E for ; Mon, 29 Jul 2002 00:20:03 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g6T7K2JU088911 for ; Mon, 29 Jul 2002 00:20:02 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g6T7K2Ps088910; Mon, 29 Jul 2002 00:20:02 -0700 (PDT) Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 382A237B400 for ; Mon, 29 Jul 2002 00:14:02 -0700 (PDT) Received: from www.freebsd.org (www.FreeBSD.org [216.136.204.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id D4D3243E31 for ; Mon, 29 Jul 2002 00:14:01 -0700 (PDT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.12.4/8.12.4) with ESMTP id g6T7E0OT002729 for ; Mon, 29 Jul 2002 00:14:00 -0700 (PDT) (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.12.4/8.12.4/Submit) id g6T7E0Uc002727; Mon, 29 Jul 2002 00:14:00 -0700 (PDT) Message-Id: <200207290714.g6T7E0Uc002727@www.freebsd.org> Date: Mon, 29 Jul 2002 00:14:00 -0700 (PDT) From: Miguel Angel Vicente Serrano To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: misc/41107: file(1) command shows incorrect data (signal #) when working with core files Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >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