[file] fix #772651 - decrease strength of newly added "C source" patterns
Jan Kaluža
jkaluza at fedoraproject.org
Tue Jan 10 07:49:39 UTC 2012
commit 7c6382d524ddaeab0af892e72297ac841e0448be
Author: Jan Kaluza <hanzz.k at gmail.com>
Date: Tue Jan 10 08:45:22 2012 +0100
fix #772651 - decrease strength of newly added "C source" patterns
file-5.10-strength.patch | 60 ++++++++++++++++++++++++++++++++++++++++++++++
file.spec | 7 ++++-
2 files changed, 66 insertions(+), 1 deletions(-)
---
diff --git a/file-5.10-strength.patch b/file-5.10-strength.patch
new file mode 100644
index 0000000..738b189
--- /dev/null
+++ b/file-5.10-strength.patch
@@ -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
+
+
+
diff --git a/file.spec b/file.spec
index f3665b6..7cf300a 100644
--- a/file.spec
+++ b/file.spec
@@ -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 at redhat.com> - 5.10-4
+- fix #772651 - decrease strength of newly added "C source" patterns
+
* Tue Jan 03 2012 Jan Kaluza <jkaluza at 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
More information about the scm-commits
mailing list