[file] fix #847936 - decompress bzip2 properly when using -z param

Jan Kaluža jkaluza at fedoraproject.org
Tue Aug 14 06:01:55 UTC 2012


commit 00331f323bfc78bbfac043ae7367e5079ff6755c
Author: Jan Kaluza <hanzz.k at gmail.com>
Date:   Tue Aug 14 08:00:15 2012 +0200

    fix #847936 - decompress bzip2 properly when using -z param
    
    - fix #847937 - read magic patterns also from ~/.magic.mgc

 file-5.11-compress.patch      |   13 +++++++++++++
 file-5.11-magicmgc-home.patch |   32 ++++++++++++++++++++++++++++++++
 file.spec                     |   10 +++++++++-
 3 files changed, 54 insertions(+), 1 deletions(-)
---
diff --git a/file-5.11-compress.patch b/file-5.11-compress.patch
new file mode 100644
index 0000000..04241d5
--- /dev/null
+++ b/file-5.11-compress.patch
@@ -0,0 +1,13 @@
+diff --git a/src/compress.c b/src/compress.c
+index 2b05352..ccb1cfd 100644
+--- a/src/compress.c
++++ b/src/compress.c
+@@ -183,7 +183,7 @@ sread(int fd, void *buf, size_t n, int canbepipe __attribute__ ((unused)))
+ 		goto nocheck;
+ 
+ #ifdef FIONREAD
+-	if ((canbepipe && (ioctl(fd, FIONREAD, &t) == -1)) || (t == 0)) {
++	if (canbepipe && ((ioctl(fd, FIONREAD, &t) == -1) || (t == 0))) {
+ #ifdef FD_ZERO
+ 		for (cnt = 0;; cnt++) {
+ 			fd_set check;
diff --git a/file-5.11-magicmgc-home.patch b/file-5.11-magicmgc-home.patch
new file mode 100644
index 0000000..d7e86ea
--- /dev/null
+++ b/file-5.11-magicmgc-home.patch
@@ -0,0 +1,32 @@
+diff --git a/src/magic.c b/src/magic.c
+index 7eb0441..d8c5835 100644
+--- a/src/magic.c
++++ b/src/magic.c
+@@ -101,16 +101,20 @@ get_default_magic(void)
+ 	if ((home = getenv("HOME")) == NULL)
+ 		return MAGIC;
+ 
+-	if (asprintf(&hmagicpath, "%s/.magic", home) < 0)
++	if (asprintf(&hmagicpath, "%s/.magic.mgc", home) < 0)
+ 		return MAGIC;
+-	if (stat(hmagicpath, &st) == -1)
+-		goto out;
+-	if (S_ISDIR(st.st_mode)) {
+-		free(hmagicpath);
+-		if (asprintf(&hmagicpath, "%s/%s", home, hmagic) < 0)
++	if (stat(hmagicpath, &st) == -1) {
++		if (asprintf(&hmagicpath, "%s/.magic", home) < 0)
+ 			return MAGIC;
+-		if (access(hmagicpath, R_OK) == -1)
++		if (stat(hmagicpath, &st) == -1)
+ 			goto out;
++		if (S_ISDIR(st.st_mode)) {
++			free(hmagicpath);
++			if (asprintf(&hmagicpath, "%s/%s", home, hmagic) < 0)
++				return MAGIC;
++			if (access(hmagicpath, R_OK) == -1)
++				goto out;
++		}
+ 	}
+ 
+ 	if (asprintf(&default_magic, "%s:%s", hmagicpath, MAGIC) < 0)
diff --git a/file.spec b/file.spec
index f606d20..dd03811 100644
--- a/file.spec
+++ b/file.spec
@@ -5,7 +5,7 @@
 Summary: A utility for determining file types
 Name: file
 Version: 5.11
-Release: 4%{?dist}
+Release: 5%{?dist}
 License: BSD
 Group: Applications/File
 Source0: ftp://ftp.astron.com/pub/file/file-%{version}.tar.gz
@@ -19,6 +19,8 @@ Patch4: file-python-func.patch
 Patch5: file-qed-vdi-image.patch
 Patch6: file-5.11-ia64-swap.patch
 Patch7: file-4.17-rpm-name.patch
+Patch8: file-5.11-magicmgc-home.patch
+Patch9: file-5.11-compress.patch
 URL: http://www.darwinsys.com/file/
 Requires: file-libs = %{version}-%{release}
 BuildRequires: zlib-devel
@@ -79,6 +81,8 @@ file(1) command.
 %patch5 -p1
 %patch6 -p1
 %patch7 -p1
+%patch8 -p1
+%patch9 -p1
 
 iconv -f iso-8859-1 -t utf-8 < doc/libmagic.man > doc/libmagic.man_
 touch -r doc/libmagic.man doc/libmagic.man_
@@ -154,6 +158,10 @@ cd python
 %endif
 
 %changelog
+* Tue Aug 14 2012 Jan Kaluza <jkaluza at redhat.com> - 5.11-5
+- fix #847936 - decompress bzip2 properly when using -z param
+- fix #847937 - read magic patterns also from ~/.magic.mgc
+
 * Fri Jul 27 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 5.11-4
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
 


More information about the scm-commits mailing list