rpms/file/devel file-4.26-mime-encoding.patch, NONE, 1.1 file.spec, 1.80, 1.81

Daniel Novotny dnovotny at fedoraproject.org
Thu Oct 16 11:02:03 UTC 2008


Author: dnovotny

Update of /cvs/extras/rpms/file/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv6971

Modified Files:
	file.spec 
Added Files:
	file-4.26-mime-encoding.patch 
Log Message:

#465994


file-4.26-mime-encoding.patch:

--- NEW FILE file-4.26-mime-encoding.patch ---
diff -up file-4.26/src/funcs.c.mime file-4.26/src/funcs.c
--- file-4.26/src/funcs.c.mime	2008-10-14 13:07:44.000000000 +0200
+++ file-4.26/src/funcs.c	2008-10-16 11:47:01.000000000 +0200
@@ -152,6 +152,20 @@ file_badread(struct magic_set *ms)
 	file_error(ms, errno, "error reading");
 }
 
+private int mime_encoding(struct magic_set * ms, const unsigned char * buf, size_t size)
+{
+size_t dummy;
+
+if( file_looks_utf8(buf, size, NULL, &dummy) == 1 )
+{
+        if(file_printf(ms, "7bit") == -1)
+                return -1;
+} else if(file_printf(ms, "binary") == -1)
+                return -1;
+                
+return 1;                  
+}
+
 #ifndef COMPILE_ONLY
 protected int
 file_buffer(struct magic_set *ms, int fd, const char *inname, const void *buf,
@@ -187,6 +201,8 @@ file_buffer(struct magic_set *ms, int fd
 		}
 	}
 #endif
+        if (ms->flags & MAGIC_MIME_ENCODING && !(ms->flags & MAGIC_MIME_TYPE)) 
+                return mime_encoding(ms, ubuf, nb);
 
 	/* try compression stuff */
 	if ((ms->flags & MAGIC_NO_CHECK_COMPRESS) != 0 ||
@@ -206,9 +222,9 @@ file_buffer(struct magic_set *ms, int fd
 				"data") == -1)
 				return -1;
 			m = 1;
-		    }
-		}
-	    }
+		    } 
+		} 
+	    } 
 	}
 #ifdef BUILTIN_ELF
 	if ((ms->flags & MAGIC_NO_CHECK_ELF) == 0 && m == 1 &&


Index: file.spec
===================================================================
RCS file: /cvs/extras/rpms/file/devel/file.spec,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -r1.80 -r1.81
--- file.spec	7 Oct 2008 14:57:51 -0000	1.80
+++ file.spec	16 Oct 2008 11:01:33 -0000	1.81
@@ -5,13 +5,14 @@
 Summary: A utility for determining file types
 Name: file
 Version: 4.26
-Release: 2%{?dist}
+Release: 3%{?dist}
 License: BSD
 Group: Applications/File
 Source0: ftp://ftp.astron.com/pub/file/file-%{version}.tar.gz
 URL: http://www.darwinsys.com/file/
-patch0: file-4.21-pybuild.patch
-patch1: file-4.26-devdrv.patch
+Patch0: file-4.21-pybuild.patch
+Patch1: file-4.26-devdrv.patch
+Patch2: file-4.26-mime-encoding.patch
 
 Requires: file-libs = %{version}-%{release}
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -60,6 +61,8 @@
 %patch0 -p1
 #fixes #463809
 %patch1 -p1
+#fixes #465994
+%patch2 -p1
 
 iconv -f iso-8859-1 -t utf-8 < doc/libmagic.man > doc/libmagic.man_
 touch -r doc/libmagic.man doc/libmagic.man_
@@ -133,6 +136,9 @@
 %endif
 
 %changelog
+* Thu Oct 16 2008 Daniel Novotny <dnovotny at redhat.com> 4.26-3
+- fix #465994 file --mime-encoding seems broken
+
 * Tue Oct 07 2008 Daniel Novotny <dnovotny at redhat.com> 4.26-2
 - fix #463809: rpmbuild rpmfcClassify: Assertion fails on some binary files
   (false positive test on "DOS device driver" crashed file(1)




More information about the fedora-extras-commits mailing list