Package init
This commit is contained in:
commit
599d24a4d8
64
0000-file-localmagic.patch
Normal file
64
0000-file-localmagic.patch
Normal file
@ -0,0 +1,64 @@
|
||||
From f25107f625e88726e8ae9d4963573b5a0dda8f4c Mon Sep 17 00:00:00 2001
|
||||
From: Jan Kaluza <hanzz.k@gmail.com>
|
||||
Date: Thu, 15 Dec 2011 16:15:41 +0100
|
||||
Subject: [PATCH] file-localmagic.patch
|
||||
|
||||
Upstream says it's up to distributions to add a way to support local-magic.
|
||||
|
||||
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||
---
|
||||
magic/magic.local | 3 +++
|
||||
src/Makefile.am | 2 +-
|
||||
src/Makefile.in | 2 +-
|
||||
src/apprentice.c | 2 +-
|
||||
4 files changed, 6 insertions(+), 3 deletions(-)
|
||||
create mode 100644 magic/magic.local
|
||||
|
||||
diff --git a/magic/magic.local b/magic/magic.local
|
||||
new file mode 100644
|
||||
index 0000000..283a863
|
||||
--- /dev/null
|
||||
+++ b/magic/magic.local
|
||||
@@ -0,0 +1,3 @@
|
||||
+# Magic local data for file(1) command.
|
||||
+# Insert here your local magic data. Format is described in magic(5).
|
||||
+
|
||||
diff --git a/src/Makefile.am b/src/Makefile.am
|
||||
index 155aec4..0f22539 100644
|
||||
--- a/src/Makefile.am
|
||||
+++ b/src/Makefile.am
|
||||
@@ -1,4 +1,4 @@
|
||||
-MAGIC = $(pkgdatadir)/magic
|
||||
+MAGIC = /etc/magic:$(pkgdatadir)/magic
|
||||
lib_LTLIBRARIES = libmagic.la
|
||||
nodist_include_HEADERS = magic.h
|
||||
|
||||
diff --git a/src/Makefile.in b/src/Makefile.in
|
||||
index b6eeb20..78dce55 100644
|
||||
--- a/src/Makefile.in
|
||||
+++ b/src/Makefile.in
|
||||
@@ -337,7 +337,7 @@ target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
-MAGIC = $(pkgdatadir)/magic
|
||||
+MAGIC = /etc/magic:$(pkgdatadir)/magic
|
||||
lib_LTLIBRARIES = libmagic.la
|
||||
nodist_include_HEADERS = magic.h
|
||||
AM_CPPFLAGS = -DMAGIC='"$(MAGIC)"'
|
||||
diff --git a/src/apprentice.c b/src/apprentice.c
|
||||
index e395854..ecc1214 100644
|
||||
--- a/src/apprentice.c
|
||||
+++ b/src/apprentice.c
|
||||
@@ -454,7 +454,7 @@ apprentice_1(struct magic_set *ms, const char *fn, int action)
|
||||
if (map == (struct magic_map *)-1)
|
||||
return -1;
|
||||
if (map == NULL) {
|
||||
- if (ms->flags & MAGIC_CHECK)
|
||||
+ if (ms->flags & MAGIC_CHECK && strcmp("/etc/magic", fn) != 0)
|
||||
file_magwarn(ms, "using regular magic file `%s'", fn);
|
||||
map = apprentice_load(ms, fn, action);
|
||||
if (map == NULL)
|
||||
--
|
||||
2.5.5
|
||||
|
||||
12
0001-file-4.17-rpm-name.patch
Normal file
12
0001-file-4.17-rpm-name.patch
Normal file
@ -0,0 +1,12 @@
|
||||
diff --git a/magic/Magdir/rpm b/magic/Magdir/rpm
|
||||
index 9a795f8..31db083 100644
|
||||
--- a/magic/Magdir/rpm
|
||||
+++ b/magic/Magdir/rpm
|
||||
@@ -29,6 +29,7 @@
|
||||
>>8 beshort 17 SuperH
|
||||
>>8 beshort 18 Xtensa
|
||||
>>8 beshort 255 noarch
|
||||
+>>10 string x %s
|
||||
|
||||
#delta RPM Daniel Novotny (dnovotny@redhat.com)
|
||||
0 string drpm Delta RPM
|
||||
10
0002-file-5.04-volume_key.patch
Normal file
10
0002-file-5.04-volume_key.patch
Normal file
@ -0,0 +1,10 @@
|
||||
diff --git a/magic/Magdir/securitycerts b/magic/Magdir/securitycerts
|
||||
index 8785dd8..1c340be 100644
|
||||
--- a/magic/Magdir/securitycerts
|
||||
+++ b/magic/Magdir/securitycerts
|
||||
@@ -4,3 +4,5 @@
|
||||
0 search/1 -----BEGIN\ CERTIFICATE------ RFC1421 Security Certificate text
|
||||
0 search/1 -----BEGIN\ NEW\ CERTIFICATE RFC1421 Security Certificate Signing Request text
|
||||
0 belong 0xedfeedfe Sun 'jks' Java Keystore File data
|
||||
+
|
||||
+0 string \0volume_key volume_key escrow packet
|
||||
35
0003-file-5.34-readelf.patch
Normal file
35
0003-file-5.34-readelf.patch
Normal file
@ -0,0 +1,35 @@
|
||||
From 9ec8a9d418059f6a2db0a8b5dd9c3242b4ab8b0a Mon Sep 17 00:00:00 2001
|
||||
From: Kamil Dudka <kdudka@redhat.com>
|
||||
Date: Thu, 26 Jul 2018 17:39:05 +0200
|
||||
Subject: [PATCH] magic: fix printing of details about ELF binaries
|
||||
|
||||
This commit fixes a regression introduced by the following commit:
|
||||
https://github.com/file/file/commit/e2adab14
|
||||
|
||||
Without this patch:
|
||||
/usr/bin/curl: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV)
|
||||
/usr/bin/true: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=57291d41021b27733e8eb00ee1e561a98c11e2d2, stripped
|
||||
|
||||
With this patch:
|
||||
/usr/bin/curl: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=fd7ce380cd8dff1f52c1a4c1f3d8635cb20dda23, stripped, too many notes (256)
|
||||
/usr/bin/true: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=57291d41021b27733e8eb00ee1e561a98c11e2d2, stripped
|
||||
---
|
||||
src/funcs.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/funcs.c b/src/funcs.c
|
||||
index 0bf92fe1..4ddf5afe 100644
|
||||
--- a/src/funcs.c
|
||||
+++ b/src/funcs.c
|
||||
@@ -268,7 +268,7 @@ file_buffer(struct magic_set *ms, int fd, const char *inname __attribute__ ((__u
|
||||
|
||||
rv = file_tryelf(ms, &b);
|
||||
rbuf = file_pop_buffer(ms, pb);
|
||||
- if (rv != 1) {
|
||||
+ if (rv == -1) {
|
||||
free(rbuf);
|
||||
rbuf = NULL;
|
||||
}
|
||||
--
|
||||
2.14.4
|
||||
|
||||
29
6000-fix-leak-on-error-found-by-coverity.patch
Normal file
29
6000-fix-leak-on-error-found-by-coverity.patch
Normal file
@ -0,0 +1,29 @@
|
||||
From e0805be4909e47dac47bab9d0caf3725da43e645 Mon Sep 17 00:00:00 2001
|
||||
From: Christos Zoulas <christos@zoulas.com>
|
||||
Date: Wed, 1 Aug 2018 09:59:45 +0000
|
||||
Subject: [PATCH 015/185] fix leak on error, found by coverity.
|
||||
|
||||
---
|
||||
src/compress.c | 5 +++++--
|
||||
1 file changed, 4 insertions(+), 1 deletions(-)
|
||||
|
||||
diff --git a/src/compress.c b/src/compress.c
|
||||
index 5d565d5..ec26595 100644
|
||||
--- a/src/compress.c
|
||||
+++ b/src/compress.c
|
||||
@@ -264,8 +264,11 @@ file_zmagic(struct magic_set *ms, const struct buffer *b, const char *name)
|
||||
* XXX: If file_buffer fails here, we overwrite
|
||||
* the compressed text. FIXME.
|
||||
*/
|
||||
- if (file_buffer(ms, -1, NULL, buf, nbytes) == -1)
|
||||
+ if (file_buffer(ms, -1, NULL, buf, nbytes) == -1) {
|
||||
+ if (file_pop_buffer(ms, pb) != NULL)
|
||||
+ abort();
|
||||
goto error;
|
||||
+ }
|
||||
if ((rbuf = file_pop_buffer(ms, pb)) != NULL) {
|
||||
if (file_printf(ms, "%s", rbuf) == -1) {
|
||||
free(rbuf);
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
46
6001-PR-25-cbiedl-Avoid-strength-underflow.patch
Normal file
46
6001-PR-25-cbiedl-Avoid-strength-underflow.patch
Normal file
@ -0,0 +1,46 @@
|
||||
From b54c273435c873b1446730c1d2c609bece2c2f22 Mon Sep 17 00:00:00 2001
|
||||
From: Christos Zoulas <christos@zoulas.com>
|
||||
Date: Sat, 11 Aug 2018 12:17:37 +0000
|
||||
Subject: [PATCH 043/185] PR/25: cbiedl: Avoid strength underflow.
|
||||
|
||||
---
|
||||
src/apprentice.c | 9 ++++++-----
|
||||
1 file changed, 5 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/apprentice.c b/src/apprentice.c
|
||||
index 45cf2a9..4d8a3de 100644
|
||||
--- a/src/apprentice.c
|
||||
+++ b/src/apprentice.c
|
||||
@@ -841,7 +841,8 @@ private size_t
|
||||
apprentice_magic_strength(const struct magic *m)
|
||||
{
|
||||
#define MULT 10
|
||||
- size_t ts, v, val = 2 * MULT; /* baseline strength */
|
||||
+ size_t ts, v;
|
||||
+ ssize_t val = 2 * MULT; /* baseline strength */
|
||||
|
||||
switch (m->type) {
|
||||
case FILE_DEFAULT: /* make sure this sorts last */
|
||||
@@ -947,9 +948,6 @@ apprentice_magic_strength(const struct magic *m)
|
||||
abort();
|
||||
}
|
||||
|
||||
- if (val == 0) /* ensure we only return 0 for FILE_DEFAULT */
|
||||
- val = 1;
|
||||
-
|
||||
switch (m->factor_op) {
|
||||
case FILE_FACTOR_OP_NONE:
|
||||
break;
|
||||
@@ -969,6 +967,9 @@ apprentice_magic_strength(const struct magic *m)
|
||||
abort();
|
||||
}
|
||||
|
||||
+ if (val <= 0) /* ensure we only return 0 for FILE_DEFAULT */
|
||||
+ val = 1;
|
||||
+
|
||||
/*
|
||||
* Magic entries with no description get a bonus because they depend
|
||||
* on subsequent magic entries to print something.
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
@ -0,0 +1,76 @@
|
||||
From 3a6f62e2b7a8929b2869a58864cb3e78b0583782 Mon Sep 17 00:00:00 2001
|
||||
From: Christos Zoulas <christos@zoulas.com>
|
||||
Date: Thu, 14 Feb 2019 00:25:59 +0000
|
||||
Subject: [PATCH 143/185] Fix indirect offset overflow calculation (B. Watson)
|
||||
|
||||
---
|
||||
src/softmagic.c | 24 +++++++++++++++++++++---
|
||||
1 file changed, 20 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/softmagic.c b/src/softmagic.c
|
||||
index 1612a56..7ecad2a 100644
|
||||
--- a/src/softmagic.c
|
||||
+++ b/src/softmagic.c
|
||||
@@ -1528,39 +1528,57 @@ mget(struct magic_set *ms, struct magic *m, const struct buffer *b,
|
||||
if (m->in_op & FILE_OPINDIRECT) {
|
||||
const union VALUETYPE *q = CAST(const union VALUETYPE *,
|
||||
((const void *)(s + offset + off)));
|
||||
- if (OFFSET_OOB(nbytes, offset + off, sizeof(*q)))
|
||||
- return 0;
|
||||
switch (cvt_flip(m->in_type, flip)) {
|
||||
case FILE_BYTE:
|
||||
+ if (OFFSET_OOB(nbytes, offset + off, 1))
|
||||
+ return 0;
|
||||
off = SEXT(sgn,8,q->b);
|
||||
break;
|
||||
case FILE_SHORT:
|
||||
+ if (OFFSET_OOB(nbytes, offset + off, 2))
|
||||
+ return 0;
|
||||
off = SEXT(sgn,16,q->h);
|
||||
break;
|
||||
case FILE_BESHORT:
|
||||
+ if (OFFSET_OOB(nbytes, offset + off, 2))
|
||||
+ return 0;
|
||||
off = SEXT(sgn,16,BE16(q));
|
||||
break;
|
||||
case FILE_LESHORT:
|
||||
+ if (OFFSET_OOB(nbytes, offset + off, 2))
|
||||
+ return 0;
|
||||
off = SEXT(sgn,16,LE16(q));
|
||||
break;
|
||||
case FILE_LONG:
|
||||
+ if (OFFSET_OOB(nbytes, offset + off, 4))
|
||||
+ return 0;
|
||||
off = SEXT(sgn,32,q->l);
|
||||
break;
|
||||
case FILE_BELONG:
|
||||
case FILE_BEID3:
|
||||
+ if (OFFSET_OOB(nbytes, offset + off, 4))
|
||||
+ return 0;
|
||||
off = SEXT(sgn,32,BE32(q));
|
||||
break;
|
||||
case FILE_LEID3:
|
||||
case FILE_LELONG:
|
||||
+ if (OFFSET_OOB(nbytes, offset + off, 4))
|
||||
+ return 0;
|
||||
off = SEXT(sgn,32,LE32(q));
|
||||
break;
|
||||
case FILE_MELONG:
|
||||
+ if (OFFSET_OOB(nbytes, offset + off, 4))
|
||||
+ return 0;
|
||||
off = SEXT(sgn,32,ME32(q));
|
||||
break;
|
||||
case FILE_BEQUAD:
|
||||
+ if (OFFSET_OOB(nbytes, offset + off, 8))
|
||||
+ return 0;
|
||||
off = SEXT(sgn,64,BE64(q));
|
||||
break;
|
||||
case FILE_LEQUAD:
|
||||
+ if (OFFSET_OOB(nbytes, offset + off, 8))
|
||||
+ return 0;
|
||||
off = SEXT(sgn,64,LE64(q));
|
||||
break;
|
||||
default:
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
BIN
file-5.34.tar.gz
Normal file
BIN
file-5.34.tar.gz
Normal file
Binary file not shown.
173
file.spec
Normal file
173
file.spec
Normal file
@ -0,0 +1,173 @@
|
||||
Name: file
|
||||
Version: 5.34
|
||||
Release: 6
|
||||
Summary: A tool to identify the type of a particular file type
|
||||
License: BSD
|
||||
URL: http://www.darwinsys.com/file/
|
||||
Source0: ftp://ftp.astron.com/pub/file/file-%{version}.tar.gz
|
||||
|
||||
Patch0: 0000-file-localmagic.patch
|
||||
|
||||
Patch1: 0001-file-4.17-rpm-name.patch
|
||||
Patch2: 0002-file-5.04-volume_key.patch
|
||||
|
||||
Patch6000: 6000-fix-leak-on-error-found-by-coverity.patch
|
||||
Patch6001: 6001-PR-25-cbiedl-Avoid-strength-underflow.patch
|
||||
Patch6002: 6002-Fix-indirect-offset-overflow-calculation-B.-Watson.patch
|
||||
|
||||
Patch3: 0003-file-5.34-readelf.patch
|
||||
|
||||
Requires: %{name}-libs = %{version}-%{release}
|
||||
BuildRequires: autoconf automake libtool git zlib-devel
|
||||
|
||||
%description
|
||||
The program checks to see if the file is empty,or if
|
||||
its some sort of special file. Any known file types
|
||||
appropriate to the system you are running on (sockets,
|
||||
symbolic links, or named pipes (FIFOs) on those systems
|
||||
that implement them) are intuited if they are defined
|
||||
in the system header file
|
||||
|
||||
%package libs
|
||||
Summary: Libraries for applications that use libmagic
|
||||
License: BSD
|
||||
|
||||
%description libs
|
||||
This package contains libraries for applications that use libmagic.
|
||||
|
||||
%package devel
|
||||
Summary: Libraries and header files for file development
|
||||
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
|
||||
Provides: %{name}-static %{name}-static%{?_isa}
|
||||
Obsoletes: %{name}-static
|
||||
|
||||
%description devel
|
||||
This package contains files needed to develop applications that use
|
||||
file header files and libmagic library
|
||||
|
||||
%package help
|
||||
Summary: Including man files for file
|
||||
Requires: man
|
||||
|
||||
%description help
|
||||
This contains man files for the using of file
|
||||
|
||||
%package -n python2-magic
|
||||
Summary: Python 2 bindings for the libmagic API
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
BuildRequires: python2-devel
|
||||
BuildArch: noarch
|
||||
%{?python_provide:%python_provide python2-magic}
|
||||
|
||||
%description -n python2-magic
|
||||
This package contains the Python 2 bindings to access the libmagic
|
||||
API. The libmagic library is also used by the familiar file(1) command.
|
||||
|
||||
%package -n python3-magic
|
||||
Summary: Python 3 bindings for the libmagic API
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
BuildRequires: python3-devel
|
||||
BuildArch: noarch
|
||||
|
||||
%description -n python3-magic
|
||||
This package contains the Python 3 bindings to access to the libmagic
|
||||
API. The libmagic library is also used by the familiar file(1) command.
|
||||
|
||||
%prep
|
||||
%autosetup -p1 -S git
|
||||
|
||||
iconv doc/libmagic.man -f iso-8859-1 -t utf-8 -o doc/libmagic.man_
|
||||
touch -r doc/libmagic.man doc/libmagic.man_
|
||||
mv doc/libmagic.man_ doc/libmagic.man
|
||||
|
||||
rm -rf %{py3dir}
|
||||
cp -dR python %{py3dir}
|
||||
|
||||
%build
|
||||
autoreconf -fi
|
||||
|
||||
CFLAGS="%{optflags} -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE" \
|
||||
%configure --enable-fsect-man5 --disable-rpath --enable-static
|
||||
sed -i 's/^hardcode_libdir_flag_spec=.*/hardcode_libdir_flag_spec=""/g' libtool
|
||||
sed -i 's/^runpath_var=LD_RUN_PATH/runpath_var=DIE_RPATH_DIE/g' libtool
|
||||
export LD_LIBRARY_PATH=%{_builddir}/%{name}-%{version}/src/.libs
|
||||
make %{?_smp_mflags} V=1
|
||||
cd python
|
||||
CFLAGS="%{optflags}" %{__python2} setup.py build
|
||||
cd %{py3dir}
|
||||
CFLAGS="%{optflags}" %{__python3} setup.py build
|
||||
|
||||
%install
|
||||
cd ${RPM_BUILD_ROOT}
|
||||
mkdir -p .%{_bindir} .%{_sysconfdir} .%{_mandir}/man1 .%{_mandir}/man5 .%{_datadir}/misc .%{_datadir}/file
|
||||
cd -
|
||||
|
||||
%make_install
|
||||
rm -f ${RPM_BUILD_ROOT}%{_libdir}/*.la
|
||||
cp -dR ./magic/magic.local ${RPM_BUILD_ROOT}%{_sysconfdir}/magic
|
||||
cat magic/Magdir/* > ${RPM_BUILD_ROOT}%{_datadir}/misc/magic
|
||||
ln -s misc/magic ${RPM_BUILD_ROOT}%{_datadir}/magic
|
||||
ln -s ../magic ${RPM_BUILD_ROOT}%{_datadir}/file/magic
|
||||
|
||||
cd python
|
||||
%{__python2} setup.py install -O1 --skip-build --root ${RPM_BUILD_ROOT}
|
||||
cd %{py3dir}
|
||||
%{__python3} setup.py install -O1 --skip-build --root ${RPM_BUILD_ROOT}
|
||||
%{__install} -d ${RPM_BUILD_ROOT}%{_datadir}/%{name}
|
||||
|
||||
%ldconfig_scriptlets libs
|
||||
|
||||
%files
|
||||
%doc ChangeLog README
|
||||
%license COPYING
|
||||
%config(noreplace) %{_sysconfdir}/magic
|
||||
%{_bindir}/*
|
||||
|
||||
%files libs
|
||||
%doc ChangeLog README
|
||||
%license COPYING
|
||||
%{_libdir}/*so.*
|
||||
%{_datadir}/magic*
|
||||
%{_datadir}/file
|
||||
%{_datadir}/misc/*
|
||||
|
||||
%files devel
|
||||
%{_libdir}/*.so
|
||||
%{_libdir}/libmagic.a
|
||||
%{_includedir}/magic.h
|
||||
|
||||
%files help
|
||||
%{_mandir}/man*
|
||||
|
||||
%files -n python2-magic
|
||||
%doc python/README.md python/example.py
|
||||
%{!?_licensedir:%global license %%doc}
|
||||
%license COPYING
|
||||
%{python2_sitelib}/magic.py
|
||||
%{python2_sitelib}/magic.pyc
|
||||
%{python2_sitelib}/magic.pyo
|
||||
%{python2_sitelib}/*egg-info
|
||||
|
||||
%files -n python3-magic
|
||||
%doc python/README.md python/example.py
|
||||
%{!?_licensedir:%global license %%doc}
|
||||
%license COPYING
|
||||
%{python3_sitelib}/magic.py
|
||||
%{python3_sitelib}/*egg-info
|
||||
%{python3_sitelib}/__pycache__/*
|
||||
|
||||
%changelog
|
||||
* Wed Sep 11 2019 huangzheng <huangzheng22@huawei.com> - 5.34-6
|
||||
- Type:enhancement
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESC:openEuler Debranding, build libs package again
|
||||
|
||||
* Mon Sep 9 2019 huangzheng <huangzheng22@huawei.com> - 5.34-5
|
||||
- Type:enhancement
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESC:openEuler Debranding
|
||||
|
||||
* Tue Aug 20 2019 zhanghaibo <ted.zhang@huawei.com> - 5.34-4
|
||||
- correct patch name
|
||||
Loading…
x
Reference in New Issue
Block a user