- Resolves: #208880 - Pointless file(1) error message while detecting ELF

64-bit file thanks to <jakub@redhat.com> for patch
- Resolves: #214992 - file-devel should own %_includedir/* %_libdir/lib*.so
- Resolves: #203548 - a -devel package should be split out for libmagic
- upgrade to new upstream 4.19
- patch revision and cleaning
- split package to file, file-devel and file-libs
This commit is contained in:
Martin Bacovsky 2007-01-09 19:23:02 +00:00
parent 17b3db3b95
commit ed9eb9f487
7 changed files with 274 additions and 17 deletions

View File

@ -1 +1 @@
file-4.17.tar.gz
file-4.19.tar.gz

60
file-4.19-ELF.patch Normal file
View File

@ -0,0 +1,60 @@
--- file-4.19/src/readelf.c.ELF 2007-01-09 19:47:26.000000000 +0100
+++ file-4.19/src/readelf.c 2007-01-09 19:50:35.000000000 +0100
@@ -45,7 +45,7 @@
off_t, int *);
#endif
private int dophn_exec(struct magic_set *, int, int, int, off_t, int, size_t,
- off_t, int *);
+ off_t, int *, int);
private int doshn(struct magic_set *, int, int, int, off_t, int, size_t, int *);
private size_t donote(struct magic_set *, unsigned char *, size_t, size_t, int,
int, size_t, int *);
@@ -785,7 +785,7 @@
*/
private int
dophn_exec(struct magic_set *ms, int class, int swap, int fd, off_t off,
- int num, size_t size, off_t fsize, int *flags)
+ int num, size_t size, off_t fsize, int *flags, int sh_num)
{
Elf32_Phdr ph32;
Elf64_Phdr ph64;
@@ -854,6 +854,19 @@
return -1;
align = 4;
}
+ /* If we have a section header table, handle note
+ sections just in doshn. Handling them also here
+ means that for executables we print the note content
+ twice and, more importantly, don't handle
+ strip -o created debuginfo files correctly.
+ They have PT_NOTE header, but the actual note
+ content is not present in the debuginfo file,
+ only in the original stripped executable or library.
+ The corresponding .note.* section is SHT_NOBITS
+ rather than SHT_NOTE, so doshn will not look
+ at it. */
+ if (sh_num)
+ break;
/*
* This is a PT_NOTE section; loop through all the notes
* in the section.
@@ -960,7 +973,8 @@
fd, (off_t)getu32(swap, elfhdr.e_phoff),
getu16(swap, elfhdr.e_phnum),
(size_t)getu16(swap, elfhdr.e_phentsize),
- fsize, &flags)
+ fsize, &flags,
+ getu16(swap, elfhdr.e_shnum))
== -1)
return -1;
}
@@ -1001,7 +1015,8 @@
(off_t)elf_getu64(swap, elfhdr.e_phoff),
getu16(swap, elfhdr.e_phnum),
(size_t)getu16(swap, elfhdr.e_phentsize),
- fsize, &flags) == -1)
+ fsize, &flags,
+ getu16(swap, elfhdr.e_shnum)) == -1)
return -1;
}
if (doshn(ms, class, swap, fd,

20
file-4.19-debian.patch Normal file
View File

@ -0,0 +1,20 @@
--- file-4.19/src/magic.c.debian 2007-01-09 17:40:50.000000000 +0100
+++ file-4.19/src/magic.c 2007-01-09 17:42:29.000000000 +0100
@@ -238,7 +238,7 @@
int fd = 0;
int rv = -1;
unsigned char *buf;
- struct stat sb;
+ struct stat sb, *st = &sb;
ssize_t nbytes = 0; /* number of bytes read from a datafile */
int ispipe = 0;
@@ -253,7 +253,7 @@
if (file_reset(ms) == -1)
goto done;
- switch (file_fsmagic(ms, inname, &sb)) {
+ switch (file_fsmagic(ms, inname, st)) {
case -1: /* error */
goto done;
case 0: /* nothing found */

122
file-4.19-magic.patch Normal file
View File

@ -0,0 +1,122 @@
--- file-4.19/magic/Magdir/revision.magic 2007-01-09 17:49:30.000000000 +0100
+++ file-4.19/magic/Magdir/revision 2007-01-09 17:59:01.000000000 +0100
@@ -3,3 +3,9 @@
# file(1) magic for revision control files
# From Hendrik Scholz <hendrik@scholz.net>
0 string /1\ :pserver: cvs password text file
+
+
+# Subversion (SVN) dumps
+# Uwe Zeisberger <zeisberg@informatik.uni-freiburg.de>
+0 string SVN-fs-dump-format-version: Subversion dumpfile
+>28 string >\0 (version: %s)
--- file-4.19/magic/Magdir/images.magic 2007-01-09 17:49:12.000000000 +0100
+++ file-4.19/magic/Magdir/images 2007-01-09 17:57:07.000000000 +0100
@@ -524,6 +524,12 @@
0 belong 0x0e031301 Hierarchical Data Format (version 4) data
0 string \211HDF\r\n\032 Hierarchical Data Format (version 5) data
+# The boot loaders syslinux and isolinux use a RLE based image format
+# called SLL16 to store splash screens.
+0 lelong 0x1413f33d Syslinux SLL16 image data,
+>4 leshort >0 %hd x
+>6 leshort >0 %hd
+
# From: Tobias Burnus <burnus@net-b.de>
# Xara (for a while: Corel Xara) is a graphic package, see
# http://www.xara.com/ for Windows and as GPL application for
--- file-4.19/magic/Magdir/apple.magic 2007-01-09 17:48:49.000000000 +0100
+++ file-4.19/magic/Magdir/apple 2007-01-09 17:54:25.000000000 +0100
@@ -10,6 +10,23 @@
0 belong 0x00051600 AppleSingle encoded Macintosh file
0 belong 0x00051607 AppleDouble encoded Macintosh file
+# Apple Emulator 2IMG format
+#
+0 string 2IMG Apple ][ 2IMG Disk Image
+>4 string XGS! \b, XGS
+>4 string CTKG \b, Catakig
+>4 string ShIm \b, Sheppy's ImageMaker
+>4 string WOOF \b, Sweet 16
+>4 string B2TR \b, Bernie ][ the Rescue
+>4 string !nfc \b, ASIMOV2
+>4 string x \b, Unknown Format
+>0xc byte 00 \b, DOS 3.3 sector order
+>>0x10 byte 00 \b, Volume 254
+>>0x10 byte&0x7f x \b, Volume %u
+>0xc byte 01 \b, ProDOS sector order
+>>0x14 short x \b, %u Blocks
+>0xc byte 02 \b, NIB data
+
# magic for Newton PDA package formats
# from Ruda Moura <ruda@helllabs.org>
0 string package0 Newton package, NOS 1.x,
--- file-4.19/magic/magic.mime.magic 2007-01-09 17:49:55.000000000 +0100
+++ file-4.19/magic/magic.mime 2007-01-09 18:08:43.000000000 +0100
@@ -193,7 +193,7 @@
0 beshort 0x4De1 audio/MP4A-LATM
# MPEG Layer 3 sound files
-0 beshort &0xffe0 audio/mpeg
+0 beshort&0xfffe =0xfffa audio/mpeg
#MP3 with ID3 tag
0 string ID3 audio/mpeg
# Ogg/Vorbis
@@ -397,16 +397,14 @@
#
# from Daniel Quinlan <quinlan@yggdrasil.com>
#
-0 string \<HEAD text/html
-0 string \<head text/html
-0 string \<TITLE text/html
-0 string \<title text/html
-0 string \<html text/html
-0 string \<HTML text/html
+0 string/cB \<!DOCTYPE\ html text/html
+0 string/cb \<head text/html
+0 string/cb \<title text/html
+0 string/bc \<html text/html
0 string \<!-- text/html
-0 string \<h1 text/html
-0 string \<H1 text/html
-0 string/c \<!doctype\ html text/html
+0 string/c \<h1 text/html
+
+0 string \<?xml text/xml
#------------------------------------------------------------------------------
# images: file(1) magic for image formats (see also "c-lang" for XPM bitmaps)
@@ -469,7 +467,7 @@
0 beshort 0xffd8 image/jpeg
# PC bitmaps (OS/2, Windoze BMP files) (Greg Roelofs, newt@uchicago.edu)
-0 string BM image/bmp
+0 string BM image/x-ms-bmp
#>14 byte 12 (OS/2 1.x format)
#>14 byte 64 (OS/2 2.x format)
#>14 byte 40 (Windows 3.x format)
@@ -924,6 +922,12 @@
0 string fLaC audio/x-flac
0 string CWS application/x-shockwave-flash
+
+# Gnumeric spreadsheet
+# This entry is only semi-helpful, as Gnumeric compresses its files, so
+# they will ordinarily reported as "compressed", but at least -z helps
+39 string =<gmr:Workbook application/x-gnumeric
+
# Hangul Document Files:
# Reversed-engineered HWP magic numbers
# From: Won-Kyu Park <wkpark@kldp.org>
--- file-4.19/src/fsmagic.c.magic 2007-01-09 17:47:35.000000000 +0100
+++ file-4.19/src/fsmagic.c 2007-01-09 17:51:23.000000000 +0100
@@ -92,7 +92,8 @@
if (file_printf(ms, "cannot open `%s' (%s)",
fn, strerror(errno)) == -1)
return -1;
- return 1;
+ ms->haderr++;
+ return -1;
}
if ((ms->flags & MAGIC_MIME) != 0) {

22
file-4.19-oracle.patch Normal file
View File

@ -0,0 +1,22 @@
--- file-4.19/magic/Magdir/filesystems.oracle 2007-01-09 18:14:04.000000000 +0100
+++ file-4.19/magic/Magdir/filesystems 2007-01-09 18:15:15.000000000 +0100
@@ -979,6 +979,19 @@
>>>>>>>>&0 bedate =0 full dump
>>>>>>>>&0 bedate !0 incremental since: %s
+# Oracle Clustered Filesystem - Aaron Botsis <redhat@digitalmafia.org>
+8 string OracleCFS Oracle Clustered Filesystem,
+>4 long x rev %d
+>0 long x \b.%d,
+>560 string x label: %.64s,
+>136 string x mountpoint: %.128s
+
+# Oracle ASM tagged volume - Aaron Botsis <redhat@digitalmafia.org>
+32 string ORCLDISK Oracle ASM Volume,
+>40 string x Disk Name: %0.12s
+32 string ORCLCLRD Oracle ASM Volume (cleared),
+>40 string x Disk Name: %0.12s
+
# VMS backup savesets - gerardo.cacciari@gmail.com
# had to comment out GEM Image and G3 raw data entries due to conflict
#0 byte x

View File

@ -2,27 +2,28 @@
Summary: A utility for determining file types.
Name: file
Version: 4.17
Release: 8
Version: 4.19
Release: 1%{?dist}
License: distributable
Group: Applications/File
Source0: ftp://ftp.astron.com/pub/file/file-%{version}.tar.gz
URL: http://www.darwinsys.com/file/
Patch1: file-4.10-debian.patch
Patch1: file-4.19-debian.patch
Patch2: file-selinux.patch
Patch3: file-4.17-magic.patch
Patch3: file-4.19-magic.patch
Patch5: file-4.13-fsdump.patch
Patch6: file-4.13-quick.patch
Patch8: file-4.15-berkeley.patch
Patch12: file-4.16-xen.patch
Patch13: file-4.17-init-mem.patch
Patch14: file-4.17-wctype-header.patch
Patch15: file-4.17-mp3_flac.patch
Patch16: file-4.17-oracle.patch
Patch16: file-4.19-oracle.patch
Patch17: file-4.17-clamav.patch
Patch18: file-4.17-powerpoint.patch
Patch19: file-4.17-empty.patch
Patch20: file-4.17-bash.patch
Patch21: file-4.19-ELF.patch
#Patch19: file-4.17-empty.patch
Requires: file-libs = %{version}
BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: zlib-devel
@ -35,6 +36,23 @@ different graphics formats.
You should install the file package, since the file command is such a
useful utility.
%package libs
Summary: Libraries for applications using libmagic
Group: Applications/File
%description libs
Libraries for applications using the bzip2 compression format.
%package devel
Summary: Libraries and header files for file development
Group: Applications/File
Requires: %{name} = %{version}
%description devel
The file-devel package contains the header files and libmagic library
necessary for developing programs using libmagic.
%prep
%setup -q
%patch1 -p1 -b .debian
@ -44,14 +62,12 @@ useful utility.
%patch6 -p1 -b .quick
%patch8 -p1 -b .berkeley
%patch12 -p1 -b .xen
%patch13 -p1 -b .mem
%patch14 -p1 -b .wctype
%patch15 -p1 -b .mp3
%patch16 -p1 -b .oracle
%patch17 -p1 -b .clamav
%patch18 -p1 -b .powerpoint
%patch19 -p1 -b .empty
#%patch19 -p1 -b .empty
%patch20 -p1 -b .bash
%patch21 -p1 -b .ELF
iconv -f iso-8859-1 -t utf-8 < doc/libmagic.man > doc/libmagic.man_
mv doc/libmagic.man_ doc/libmagic.man
@ -92,11 +108,28 @@ rm -rf $RPM_BUILD_ROOT
%{_datadir}/misc/*
%{_mandir}/man[15]/*
%{_includedir}/magic.h
%files libs
%defattr(-,root,root)
%{_libdir}/*so.*
%{_mandir}/man3/*
%{_libdir}/libmagic.*
%files devel
%defattr(0644, root, root, 0755)
%attr(755,root,root) %{_libdir}/*.a
%attr(755,root,root) %{_libdir}/*.so
%{_includedir}/magic.h
%changelog
* Tue Jan 9 2007 Martin Bacovsky <mbacovsk@redhat.com> - 4.19-1.fc7
- Resolves: #208880 - Pointless file(1) error message while detecting ELF 64-bit file
thanks to <jakub@redhat.com> for patch
- Resolves: #214992 - file-devel should own %_includedir/* %_libdir/lib*.so
- Resolves: #203548 - a -devel package should be split out for libmagic
- upgrade to new upstream 4.19
- patch revision and cleaning
- split package to file, file-devel and file-libs
* Wed Aug 23 2006 Martin Bacovsky <mbacovsky@redhat.com> - 4.17-8
- fix recognition of perl script with embed awk (#203610)

View File

@ -1 +1 @@
50919c65e0181423d66bb25d7fe7b0fd file-4.17.tar.gz
a61ef3aa8339d5987148089afde25f60 file-4.19.tar.gz