diff --git a/file-5.04-ruby-modules.patch b/file-5.04-ruby-modules.patch new file mode 100644 index 0000000..0f11263 --- /dev/null +++ b/file-5.04-ruby-modules.patch @@ -0,0 +1,40 @@ +From eebad924e62b678a54d3af05a12da2a929f5d918 Mon Sep 17 00:00:00 2001 +From: Lubomir Rintel +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.spec b/file.spec index c12b927..cf9a2dc 100644 --- a/file.spec +++ b/file.spec @@ -5,7 +5,7 @@ Summary: A utility for determining file types Name: file Version: 5.04 -Release: 2%{?dist} +Release: 3%{?dist} License: BSD Group: Applications/File Source0: ftp://ftp.astron.com/pub/file/file-%{version}.tar.gz @@ -14,6 +14,7 @@ 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 Requires: file-libs = %{version}-%{release} BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -73,6 +74,8 @@ file(1) command. %patch2 -p1 #fixes #533245 %patch3 -p1 +#fixes #562840 +%patch4 -p1 iconv -f iso-8859-1 -t utf-8 < doc/libmagic.man > doc/libmagic.man_ touch -r doc/libmagic.man doc/libmagic.man_ @@ -149,6 +152,9 @@ rm -rf $RPM_BUILD_ROOT %endif %changelog +* Tue Feb 09 2010 Daniel Novotny 5.04-3 +- fix #562840 - [PATCH] Add matches for ruby modules + * Thu Jan 28 2010 Daniel Novotny 5.04-2 - fix #533245 - segfaults on star.ulaw