diff --git a/README.md b/README.md index 16d4988..62ffebc 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,7 @@ # file +The file command is used to identify a particular file according to the type of data contained by the file. +File can identify many different file types, including ELF binaries, system libraries, RPM packages, and different graphics formats. + +You should install the file package, since the file command is such a useful utility. + diff --git a/file-4.21-pybuild.patch b/file-4.21-pybuild.patch new file mode 100644 index 0000000..ed835d7 --- /dev/null +++ b/file-4.21-pybuild.patch @@ -0,0 +1,14 @@ +diff -up file-4.21/python/setup.py.pybuild file-4.21/python/setup.py +--- file-4.21/python/setup.py.pybuild 2007-12-11 09:40:29.000000000 +0100 ++++ file-4.21/python/setup.py 2007-12-11 09:40:59.000000000 +0100 +@@ -3,8 +3,8 @@ from distutils.core import setup, Extens + + magic_module = Extension('magic', + libraries = ['magic'], +- library_dirs = ['./','../','../src','/usr/lib/'], +- include_dirs = ['./','../','../src','/usr/include/'], ++ library_dirs = ['./','../','../src','../src/.libs','/usr/lib/'], ++ include_dirs = ['./','../','../src','../src/.libs','/usr/include/'], + sources = ['py_magic.c']) + + setup (name = 'Magic file extensions', diff --git a/file-5.00-devdrv.patch b/file-5.00-devdrv.patch new file mode 100644 index 0000000..188a301 --- /dev/null +++ b/file-5.00-devdrv.patch @@ -0,0 +1,47 @@ +diff -up file-5.00/magic/Magdir/msdos.devdrv file-5.00/magic/Magdir/msdos +--- file-5.00/magic/Magdir/msdos.devdrv 2009-02-09 14:35:12.000000000 +0100 ++++ file-5.00/magic/Magdir/msdos 2009-02-09 14:37:32.000000000 +0100 +@@ -294,22 +294,37 @@ + >10 string >\x23 + >>10 string !\x2e + >>>17 string <\x5B +->>>>10 string x \b, name: %.8s +-#UDMA.SYS KEYB.SYS CMD640X2.SYS ++>>>>10 string CMD640X2.SYS \b, name: %.8s ++#UDMA.SYS + >10 string <\x41 + >>12 string >\x40 + >>>10 string !$ +->>>>12 string x \b, name: %.8s +-#BTCDROM.SYS ASPICD.SYS ++>>>>12 string UDMA.SYS \b, name: %.8s ++#CMD640X2.SYS ++>10 string <\x41 ++>>12 string >\x40 ++>>>10 string !$ ++>>>>12 string CMD640X2.SYS \b, name: %.8s ++#KEYB.SYS ++>10 string <\x41 ++>>12 string >\x40 ++>>>10 string !$ ++>>>>12 string KEYB.SYS \b, name: %.8s ++#BTCDROM.SYS ++>22 string >\x40 ++>>22 string <\x5B ++>>>23 string <\x5B ++>>>>22 string BTCDROM.SYS \b, name: %.8s ++#ASPICD.SYS + >22 string >\x40 + >>22 string <\x5B + >>>23 string <\x5B +->>>>22 string x \b, name: %.8s ++>>>>22 string ASPICD.SYS \b, name: %.8s + #ATAPICD.SYS + >76 string \0 + >>77 string >\x40 + >>>77 string <\x5B +->>>>77 string x \b, name: %.8s ++>>>>77 string ATAPICD.SYS \b, name: %.8s + # test too generic ? + 0 byte 0x8c DOS executable (COM) + # updated by Joerg Jenderek at Oct 2008 diff --git a/file-5.00-mdmp.patch b/file-5.00-mdmp.patch new file mode 100644 index 0000000..f8f318c --- /dev/null +++ b/file-5.00-mdmp.patch @@ -0,0 +1,10 @@ +diff -up file-5.00/magic/Magdir/misctools.mdmp file-5.00/magic/Magdir/misctools +--- file-5.00/magic/Magdir/misctools.mdmp 2009-04-16 15:29:06.000000000 +0200 ++++ file-5.00/magic/Magdir/misctools 2009-04-16 15:32:23.000000000 +0200 +@@ -19,3 +19,6 @@ + # Extension: .lo + # Submitted by: Abel Cheung + 0 search/80 .lo\ -\ a\ libtool\ object\ file libtool object file ++ ++# From: Daniel Novotny ++0 string MDMP\x93\xA7 MDMP crash report data diff --git a/file-5.04-core-trim.patch b/file-5.04-core-trim.patch new file mode 100644 index 0000000..731cf9c --- /dev/null +++ b/file-5.04-core-trim.patch @@ -0,0 +1,28 @@ +--- file-4.26.OLD/src/readelf.c 2008-07-26 17:03:55.000000000 +0200 ++++ file-4.26/src/readelf.c 2008-12-03 17:16:57.000000000 +0100 +@@ -738,6 +738,25 @@ core: + /* + * Well, that worked. + */ ++ ++ /* ++ * Try next offsets, in case this match is ++ * in the middle of a string. ++ */ ++ size_t k; ++ for (k = i + 1 ; k < NOFFSETS ; k++) { ++ if (prpsoffsets(k) >= prpsoffsets(i)) ++ continue; ++ size_t no; ++ int adjust = 1; ++ for (no = doff + prpsoffsets(k); ++ no < doff + prpsoffsets(i); no++) ++ adjust = adjust ++ && isprint(nbuf[no]); ++ if (adjust) ++ i = k; ++ } ++ + cname = (unsigned char *) + &nbuf[doff + prpsoffsets(i)]; + for (cp = cname; *cp && isprint(*cp); cp++) diff --git a/file-5.04-html-regression.patch b/file-5.04-html-regression.patch new file mode 100644 index 0000000..9be36c9 --- /dev/null +++ b/file-5.04-html-regression.patch @@ -0,0 +1,44 @@ +diff --git a/magic/Magdir/sgml b/magic/Magdir/sgml +index 0a57375..1dceba5 100644 +--- a/magic/Magdir/sgml ++++ b/magic/Magdir/sgml +@@ -34,21 +34,13 @@ + # HyperText Markup Language (HTML) is an SGML document type, + # from Daniel Quinlan (quinlan@yggdrasil.com) + # adapted to string extenstions by Anthon van der Neut +Date: Fri, 5 Feb 2010 13:19:48 +0100 +Subject: [PATCH] Add matches for ruby modules + +Similar to what's already done for Perl. Existing rules only match shebangs, +which is not useful in most cases. This was tested to yield no false +positives when run against every perl and python source file I could find +on my system (260 CPAN modules and 59 Python modules). Produces a couple +of false negatives for a couple of files from 30 Ruby gems I have +installed, but is still an improvement over existing rules. (Ruby is +used to construct DSLs quite often, it would be really tricky to match +those). +--- + magic/Magdir/ruby | 12 ++++++++++++ + 1 files changed, 12 insertions(+), 0 deletions(-) + +diff --git a/magic/Magdir/ruby b/magic/Magdir/ruby +index 7030295..be1786c 100644 +--- a/magic/Magdir/ruby ++++ b/magic/Magdir/ruby +@@ -14,3 +14,15 @@ + !:mime text/x-ruby + 0 search/1 #!\ /usr/bin/env\ ruby Ruby script text executable + !:mime text/x-ruby ++ ++# What looks like ruby, but does not have a shebang ++# (modules and such) ++# From: Lubomir Rintel ++0 regex \^[\ \t]*require[\ \t]'[A-Za-z_\/]+' ++>0 regex include\ [A-Z]|def\ [a-z]|\ do$ ++>>0 regex \^[\ \t]*end([\ \t]*[;#].*)?$ Ruby script text ++!:mime text/x-ruby ++0 regex \^[\ \t]*(class|module)[\ \t][A-Z] ++>0 regex (modul|includ)e\ [A-Z]|def\ [a-z] ++>>0 regex \^[\ \t]*end([\ \t]*[;#].*)?$ Ruby module source text ++!:mime text/x-ruby +-- +1.6.6 + diff --git a/file-5.04-ulaw-segfault.patch b/file-5.04-ulaw-segfault.patch new file mode 100644 index 0000000..0f2fba2 --- /dev/null +++ b/file-5.04-ulaw-segfault.patch @@ -0,0 +1,11 @@ +diff -up file-5.04/src/softmagic.c.segfault file-5.04/src/softmagic.c +--- file-5.04/src/softmagic.c.segfault 2009-10-19 15:10:20.000000000 +0200 ++++ file-5.04/src/softmagic.c 2010-01-28 15:28:20.000000000 +0100 +@@ -946,6 +946,7 @@ mcopy(struct magic_set *ms, union VALUET + end = last = (const char *)s + nbytes; + /* mget() guarantees buf <= last */ + for (lines = linecnt, b = buf; lines && ++ b < end && c < end && + ((b = CAST(const char *, + memchr(c = b, '\n', CAST(size_t, (end - b))))) + || (b = CAST(const char *, diff --git a/file-5.04-zmachine-magic-update.patch b/file-5.04-zmachine-magic-update.patch new file mode 100644 index 0000000..e5d0a42 --- /dev/null +++ b/file-5.04-zmachine-magic-update.patch @@ -0,0 +1,30 @@ +diff --git a/magic/Magdir/adventure b/magic/Magdir/adventure +index 5087ce6..a693213 100644 +--- a/magic/Magdir/adventure ++++ b/magic/Magdir/adventure +@@ -18,17 +18,14 @@ + #------------------------------------------------------------------------------ + # Z-machine: file(1) magic for Z-machine binaries. + # +-# This will match ${TEX_BASE}/texmf/omega/ocp/char2uni/inbig5.ocp which +-# appears to be a version-0 Z-machine binary. +-# +-# The (false match) message is to correct that behavior. Perhaps it is +-# not needed. +-# +-16 belong&0xfe00f0f0 0x3030 Infocom game data +->0 ubyte 0 (false match) +->0 ubyte >0 (Z-machine %d, +->>2 ubeshort x Release %d / +->>18 string >\0 Serial %.6s) ++# The first byte is the Z-machine version number, which is always between ++# 1 and 8. ++0 ubyte >0 ++>0 ubyte <9 ++>>16 belong&0xfe00f0f0 0x3030 Infocom game data ++>>>0 ubyte >0 (Z-machine %d, ++>>>>2 ubeshort x Release %d / ++>>>>18 string >\0 Serial %.6s) + + #------------------------------------------------------------------------------ + # Glulx: file(1) magic for Glulx binaries. diff --git a/file-magic_local b/file-magic_local new file mode 100644 index 0000000..6e8eda3 --- /dev/null +++ b/file-magic_local @@ -0,0 +1,2 @@ +# Localstuff: file(1) magic(5) for locally observed files +# global magic file is /usr/share/misc/magic(.mgc) diff --git a/file.spec b/file.spec new file mode 100644 index 0000000..e80161a --- /dev/null +++ b/file.spec @@ -0,0 +1,292 @@ +%define pymagic_version 0.1 +Name: file +Version: 5.18 +Release: 1mamba +Summary: An utility for determining file types +Group: Applications/File +Vendor: openmamba +Distribution: openmamba +Packager: Silvan Calarco +URL: http://www.darwinsys.com/file +Source0: ftp://ftp.astron.com/pub/file/file-%{version}.tar.gz +Source1: file-magic_local +Patch0: file-4.21-pybuild.patch +Patch1: file-5.00-devdrv.patch +Patch2: file-5.00-mdmp.patch +Patch3: file-5.04-ulaw-segfault.patch +Patch4: file-5.04-ruby-modules.patch +Patch5: file-5.04-core-trim.patch +Patch6: file-5.04-html-regression.patch +Patch7: file-5.04-zmachine-magic-update.patch +License: BSD +## AUTOBUILDREQ-BEGIN +BuildRequires: glibc-devel +BuildRequires: libz-devel +## AUTOBUILDREQ-END +%if "%{stage1}" != "1" +BuildRequires: libpython-devel +%endif +Requires: libmagic = %{?epoch:%epoch:}%{version}-%{release} +BuildRoot: %{_tmppath}/%{name}-%{version}-root + +%description +The file command is used to identify a particular file according to the type of data contained by the file. +File can identify many different file types, including ELF binaries, system libraries, RPM packages, and different graphics formats. + +You should install the file package, since the file command is such a useful utility. + +%package -n libmagic +Summary: A library used by the file utility for determinig file types +Group: Development/Libraries + +%description -n libmagic +The file command is used to identify a particular file according to the type of data contained by the file. +File can identify many different file types, including ELF binaries, system libraries, RPM packages, and different graphics formats. + +This package contains the libmagic library. + +%package -n libmagic-devel +Summary: The development files for application which use file +Group: Development/Libraries +Requires: libmagic = %{?epoch:%epoch:}%{version}-%{release} +Obsoletes: file-devel +Provides: file-devel = %{?epoch:%epoch:}%{version}-%{release} + +%description -n libmagic-devel +The file command is used to identify a particular file according to the type of data contained by the file. +File can identify many different file types, including ELF binaries, system libraries, RPM packages, and different graphics formats. + +This package contains static libraries and header files need for development. + +%if "%{stage1}" != "1" +%package -n python-magic +Summary: Python bindings for the libmagic API +Group: Development/Libraries/Python +Requires: libmagic = %{?epoch:%epoch:}%{version}-%{release} +Requires: python >= %python_version + +%description -n python-magic +The file command is used to identify a particular file according to the type of data contained by the file. +File can identify many different file types, including ELF binaries, system libraries, RPM packages, and different graphics formats. + +This package contains the Python bindings to allow access to the libmagic API. +%endif + +%prep +%setup -q +#%patch0 -p1 +#463809 +#%patch1 -p1 +#485835 +#%patch2 -p1 +#533245 +#%patch3 -p1 +#562840 +#%patch4 -p1 +#566305 +#%patch5 -p1 +#%patch6 -p1 +#%patch7 -p1 + +for p in $(find . -name "*.py"); do + sed -i 's|#!/usr/local/bin/python2.1|#!%{__python}|' $p + sed -i 's|#!/usr/local/bin/python|#!%{__python}|' $p +done + +iconv -f iso-8859-1 -t utf-8 < doc/libmagic.man > doc/libmagic.man_ +touch -r doc/libmagic.man doc/libmagic.man_ +mv doc/libmagic.man_ doc/libmagic.man + +%build +%configure --enable-fsect-man5 +%make + +cd python +CFLAGS="%{optflags}" %{__python} setup.py build + +%install +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" +%makeoldinstall + +install -D -m 0644 %{S:1} %{buildroot}%{_sysconfdir}/magic + +mkdir -p %{buildroot}%{_datadir}/file +cat magic/Magdir/* > %{buildroot}%{_datadir}/misc/magic +ln -s misc/magic %{buildroot}%{_datadir}/magic +#ln -s file/magic.mime %{buildroot}%{_datadir}/magic.mime +ln -s ../magic %{buildroot}%{_datadir}/file/magic + +%if "%{stage1}" != "1" +cd python +%{__python} setup.py install -O1 --skip-build --root %{buildroot} +%endif + +%clean +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + +%post -p /sbin/ldconfig +%postun -p /sbin/ldconfig + +%files +%defattr(-,root,root) +%{_bindir}/file +%{_mandir}/man1/* +#%{_mandir}/man4/* +%{_mandir}/man5/magic.5.gz +%{_datadir}/file/magic +%{_datadir}/magic +%{_datadir}/misc/magic +%{_datadir}/misc/magic.mgc +%doc ChangeLog MAINT README + +%files -n libmagic +%defattr(-,root,root) +%{_sysconfdir}/magic +%{_libdir}/libmagic.so.* + +%files -n libmagic-devel +%defattr(-,root,root) +%{_includedir}/magic.h +%{_libdir}/libmagic.la +%{_libdir}/libmagic.so +%{_mandir}/man3/* + +%if "%{stage1}" != "1" +%files -n python-magic +%defattr(-,root,root) +%{python_sitearch}/Magic_file_extensions-*-py%{python_version}.egg-info +%{python_sitearch}/magic.py* +%doc python/README COPYING python/example.py +%endif + +%changelog +* Thu Mar 27 2014 Automatic Build System 5.18-1mamba +- automatic version update by autodist + +* Thu Feb 13 2014 Automatic Build System 5.17-1mamba +- automatic version update by autodist + +* Mon Dec 02 2013 Automatic Build System 5.16-1mamba +- automatic version update by autodist + +* Tue Sep 24 2013 Automatic Build System 5.15-1mamba +- automatic version update by autodist + +* Mon Mar 25 2013 Automatic Build System 5.14-1mamba +- automatic version update by autodist + +* Fri Feb 22 2013 Automatic Build System 5.13-1mamba +- automatic version update by autodist + +* Sun Jan 13 2013 Automatic Build System 5.12-1mamba +- automatic version update by autodist + +* Wed Feb 22 2012 Automatic Build System 5.11-1mamba +- automatic version update by autodist + +* Sat Dec 31 2011 Automatic Build System 5.10-1mamba +- automatic version update by autodist + +* Sat Sep 17 2011 Automatic Build System 5.09-1mamba +- automatic version update by autodist + +* Thu Aug 04 2011 Automatic Build System 5.08-1mamba +- automatic version update by autodist + +* Thu May 12 2011 Automatic Build System 5.07-1mamba +- automatic update by autodist + +* Fri Apr 15 2011 Automatic Build System 5.06-1mamba +- automatic update by autodist + +* Thu Feb 17 2011 Automatic Build System 5.05-1mamba +- automatic update by autodist + +* Thu Aug 05 2010 Silvan Calarco 5.04-4mamba +- port from devel-gil to devel +- replaced occurrencies of python26 missing macros and requirements into python + +* Tue Jul 27 2010 gil 5.04-3mamba +- added new sub package python-magic +- edit spec file + +* Thu Jul 01 2010 gil 5.04-2mamba +- rebuilt (milestone 1) + +* Sat Jan 23 2010 Automatic Build System 5.04-1mamba +- automatic update to 5.04 by autodist + +* Thu May 07 2009 Automatic Build System 5.03-1mamba +- update to 5.03 + +* Thu Feb 05 2009 Silvan Calarco 5.00-1mamba +- automatic update to 5.00 by autodist + +* Mon Sep 01 2008 Silvan Calarco 4.26-1mamba +- update to 4.26 + +* Sat Jul 05 2008 Silvan Calarco 4.25-1mamba +- update to 4.25 + +* Tue Jun 03 2008 Silvan Calarco 4.24-1mamba +- update to 4.24 + +* Mon Dec 31 2007 Aleph0 4.23-1mamba +- update to 4.23 + +* Fri Dec 28 2007 Aleph0 4.22-1mamba +- update to 4.22 + +* Fri May 25 2007 Aleph0 4.21-1mamba +- update to 4.21 + +* Fri Mar 02 2007 Davide Madrisan 4.20-1qilnx +- update to version 4.20 by autospec (security update) + +* Sun Jan 28 2007 Silvan Calarco 4.19-2qilnx +- put libmagic into a separate package + +* Thu Dec 14 2006 Davide Madrisan 4.19-1qilnx +- update to version 4.19 by autospec +- added %{_sysconfdir}/magic +- man page for libmagic moved to the devel package + +* Thu Nov 02 2006 Davide Madrisan 4.18-1qilnx +- update to version 4.18 by autospec + +* Fri Mar 17 2006 Davide Madrisan 4.17-1qilnx +- update to version 4.17 by autospec + +* Thu Sep 29 2005 Stefano Cotta Ramusino 4.15-1qilnx +- update to version 4.15 by autospec + +* Wed Jun 29 2005 Davide Madrisan 4.14-1qilnx +- update to version 4.14 by autospec + +* Mon May 02 2005 Davide Madrisan 4.13-1qilnx +- update to version 4.13 by autospec + +* Tue Dec 14 2004 Davide Madrisan 4.12-1qilnx +- update to version 4.12 by autospec +- also fixes security issue QSA-2004-062 + +* Tue Nov 23 2004 Davide Madrisan 4.11-1qilnx +- update to version 4.11 by autospec + +* Tue Jul 27 2004 Davide Madrisan 4.10-1qilnx +- update to 4.10 + +* Thu Apr 08 2004 Davide Madrisan 4.09-1qilnx +- new version rebuild + +* Wed Mar 24 2004 Davide Madrisan 4.08-1qilnx +- new version rebuild + +* Wed Feb 25 2004 Davide Madrisan 4.07-1qilnx +- new version rebuild + +* Mon Apr 14 2003 Mirko Cortillaro 4.02-1qilnx +- modified file list + +* Fri Apr 04 2003 Mirko Cortillaro +- write a spec file for file