Date: Sat, 6 Mar 2004 18:08:50 +1100 (EST) From: Edwin Groothuis <edwin@mavetju.org> To: FreeBSD-gnats-submit@FreeBSD.org Cc: obrien@FreeBSD.org Subject: bin/63830: [patch] file(1) doesn't recognize FreeBSD 5.x executables properly Message-ID: <20040306070850.ED5306184@k7.mavetju> Resent-Message-ID: <200403060710.i267A9L1073676@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 63830 >Category: bin >Synopsis: [patch] file(1) doesn't recognize FreeBSD 5.x executables properly >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Fri Mar 05 23:10:09 PST 2004 >Closed-Date: >Last-Modified: >Originator: Edwin Groothuis >Release: FreeBSD 5.2.1-RELEASE i386 >Organization: - >Environment: System: FreeBSD k7.mavetju 5.2.1-RELEASE FreeBSD 5.2.1-RELEASE #3: Fri Feb 27 13:54:29 EST 2004 edwin@k7.mavetju:/usr/src/sys/i386/compile/k7 i386 >Description: While trying to figure out if a binary was staticly or dynamicly linked, my eye fell on... /usr/X11R6/bin/linphone: ELF 32-bit LSB executable, Intel 80386, version 1 (FreeBSD), for FreeBSD 5.0.2, dynamically linked (uses shared libs), stripped That should be 5.2.1 >How-To-Repeat: Run file /usr/bin/file on a FreeBSD 5.x machine >Fix: This is a patch against readelf.c of 3.41. I wasn't able to figure out how to use file_printf properly. Maybe the maintainer of sysutils/file could have a look at it? Informed author of file. Informed maintainer of port. Informed importer of file in the FreeBSD base system. --- readelf.c.orig Sat Mar 6 17:43:56 2004 +++ readelf.c Sat Mar 6 17:55:21 2004 @@ -280,17 +280,31 @@ * Contents is __FreeBSD_version, * whose relation to OS versions is * defined by a huge table in the - * Porters' Handbook. Happily, the - * first three digits are the version - * number, at least in versions of - * FreeBSD that use this note. + * Porters' Handbook. + * For up to 5.x, the first three + * digits are the version number. + * For 5.x and higher, the scheme + * is: <major><two digit minor> + * <0 if release branch, otherwise 1>xx */ - printf(" %d.%d", desc / 100000, - desc / 10000 % 10); - if (desc / 1000 % 10 > 0) + if (desc / 100000 < 5) { + printf(" %d.%d", desc / 100000, + desc / 10000 % 10); + if (desc / 1000 % 10 > 0) printf(".%d", desc / 1000 % 10); + } else { + printf(" %d.%d", desc / 100000, + desc / 1000 % 100); + desc %= 1000; + if (desc > 100 ) + printf("-CURRENT (rev %d)", + desc % 100 ); + else if (desc != 0) + printf(".%d", + desc / 10); + } } if (nh_namesz == 8 && >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040306070850.ED5306184>