fix #772651 - decrease strength of newly added "C source" patterns

This commit is contained in:
Jan Kaluza 2012-01-10 08:45:22 +01:00
parent 5ad4a2e5f5
commit 7c6382d524
2 changed files with 66 additions and 1 deletions

60
file-5.10-strength.patch Normal file
View File

@ -0,0 +1,60 @@
diff --git a/magic/Magdir/c-lang b/magic/Magdir/c-lang
index 0665627..fdefa8c 100644
--- a/magic/Magdir/c-lang
+++ b/magic/Magdir/c-lang
@@ -6,26 +6,36 @@
# BCPL
0 search/8192 "libhdr" BCPL source text
!:mime text/x-bcpl
+!:strength / 2
0 search/8192 "LIBHDR" BCPL source text
!:mime text/x-bcpl
+!:strength / 2
# C
0 regex \^#include C source text
!:mime text/x-c
+!:strength / 2
0 regex \^char C source text
!:mime text/x-c
+!:strength / 2
0 regex \^double C source text
!:mime text/x-c
+!:strength / 2
0 regex \^extern C source text
!:mime text/x-c
+!:strength / 2
0 regex \^float C source text
!:mime text/x-c
+!:strength / 2
0 regex \^struct C source text
!:mime text/x-c
+!:strength / 2
0 regex \^union C source text
!:mime text/x-c
+!:strength / 2
0 search/8192 main( C source text
!:mime text/x-c
+!:strength / 2
# C++
# The strength of these rules is increased so they beat the C rules above
diff --git a/magic/Magdir/perl b/magic/Magdir/perl
index e11f2ab..b02b2c2 100644
--- a/magic/Magdir/perl
+++ b/magic/Magdir/perl
@@ -28,10 +28,14 @@
# check the first line
0 search/1 package
>0 regex \^package[\ \t]+[0-9A-Za-z_:]+\ *; Perl5 module source text
+# to be tried before C source
+!:strength + 5
# not 'p', check other lines
0 search/1 !p
>0 regex \^package[\ \t]+[0-9A-Za-z_:]+\ *;
>>0 regex \^1\ *;|\^(use|sub|my)\ .*[(;{=] Perl5 module source text
+# to be tried before C source
+!:strength + 40

View File

@ -5,7 +5,7 @@
Summary: A utility for determining file types
Name: file
Version: 5.10
Release: 3%{?dist}
Release: 4%{?dist}
License: BSD
Group: Applications/File
Source0: ftp://ftp.astron.com/pub/file/file-%{version}.tar.gz
@ -13,6 +13,7 @@ Source0: ftp://ftp.astron.com/pub/file/file-%{version}.tar.gz
Patch0: file-localmagic.patch
# sent upstream
Patch1: file-tnef.patch
Patch2: file-5.10-strength.patch
URL: http://www.darwinsys.com/file/
Requires: file-libs = %{version}-%{release}
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -68,6 +69,7 @@ file(1) command.
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
iconv -f iso-8859-1 -t utf-8 < doc/libmagic.man > doc/libmagic.man_
touch -r doc/libmagic.man doc/libmagic.man_
@ -152,6 +154,9 @@ rm -rf $RPM_BUILD_ROOT
%endif
%changelog
* Tue Jan 10 2012 Jan Kaluza <jkaluza@redhat.com> - 5.10-4
- fix #772651 - decrease strength of newly added "C source" patterns
* Tue Jan 03 2012 Jan Kaluza <jkaluza@redhat.com> - 5.10-3
- fix #771292 - do not show 'using regular magic file' warning for /etc/magic,
because this file is not supposed to be compiled