Browse Source

Cherry-pick some fixes from upstream. Closes: #1100712

Christoph Biedl 1 month ago
parent
commit
206d9ce702

+ 76 - 0
debian/patches/1742485595.FILE5_46-68-g5089651f.fix-openstreetmap-christoph-biedl.patch

@@ -0,0 +1,76 @@
+Subject: Fix OpenStreetMap (Christoph Biedl)
+Origin: upstream, commit FILE5_46-68-g5089651f <https://github.com/file/file/commit/FILE5_46-68-g5089651f>
+Author: Christos Zoulas <christos@zoulas.com>
+Date: Thu Mar 20 15:46:35 2025 +0000
+
+--- a/magic/Magdir/sgml
++++ b/magic/Magdir/sgml
+@@ -15,7 +15,10 @@
+ !:mime	image/svg+xml
+ !:ext   svg
+ 
++0	string/t		\<?xml\ version=
++!:strength +40
+ >14	regex		['"\ \t]*[0-9.]+['"\ \t]*
++
+ # Sitemap file
+ >>19	search/4096	\<urlset		XML Sitemap document text
+ !:mime	application/xml-sitemap
+@@ -37,9 +40,7 @@
+ # xhtml
+ >19	search/4096/cWbt	\<!doctype\ html	XHTML document text
+ >>15	string		>\0	(version %.3s)
+-!:strength + 15
+ !:mime	application/xhtml+xml
+-
+ >19	search/4096/cWbt	\<html\ xmlns=		XHTML document text
+ >>15	string		>\0	(version %.3s)
+ !:mime	application/xhtml+xml
+@@ -57,14 +58,11 @@
+ # avoid misdetection as JavaScript
+ 0	string/cWt	\<!doctype\ html	HTML document text
+ !:mime	text/html
+-!:strength + 30
+ 0	string/ct	\<html>	HTML document text
+ !:mime	text/html
+-!:strength + 30
+ 0	string/ct	\<!--
+ >&0	search/4096/cWt	\<!doctype\ html	HTML document text
+ !:mime	text/html
+-!:strength + 30
+ >&0	search/4096/ct	\<html>	HTML document text
+ !:mime	text/html
+ 
+@@ -127,13 +125,21 @@
+ 0	search/1/cwt	\<?xml			XML document text
+ !:mime	text/xml
+ !:strength + 30
++0	string/t		\<?xml\ version\ "	XML
++!:mime	text/xml
++!:strength + 30
+ 0	string/t		\<?xml\ version="	XML
+ !:mime	text/xml
+ !:strength + 30
+ >15	string/t	>\0			%.3s document text
+ >>23	search/1	\<xsl:stylesheet	(XSL stylesheet)
+ >>24	search/1	\<xsl:stylesheet	(XSL stylesheet)
+-
++0	string/t	\<?xml\ version='	XML
++!:mime	text/xml
++!:strength + 30
++>15	string/t	>\0			%.3s document text
++>>23	search/1	\<xsl:stylesheet	(XSL stylesheet)
++>>24	search/1	\<xsl:stylesheet	(XSL stylesheet)
+ 0	search/1/wt	\<?XML			broken XML document text
+ !:mime	text/xml
+ !:strength - 10
+--- /dev/null
++++ b/tests/osm.result
+@@ -0,0 +1 @@
++OpenStreetMap XML data, ASCII text
+--- /dev/null
++++ b/tests/osm.testfile
+@@ -0,0 +1,3 @@
++<?xml version="1.0" encoding="UTF-8"?>
++<osm version="0.6" generator="CGImap 0.0.2">
++</osm>

+ 15 - 0
debian/patches/1742492756.FILE5_46-69-g280e121f.remove-superfluous-christoph-biedl.patch

@@ -0,0 +1,15 @@
+Subject: Remove superfluous (Christoph Biedl)
+Origin: upstream, commit FILE5_46-69-g280e121f <https://github.com/file/file/commit/FILE5_46-69-g280e121f>
+Author: Christos Zoulas <christos@zoulas.com>
+Date: Thu Mar 20 17:45:56 2025 +0000
+
+--- a/magic/Magdir/zip
++++ b/magic/Magdir/zip
+@@ -17,7 +17,6 @@
+ >>6	leshort		x		\b, extract using at least
+ >>6	use		zipversion
+ # This is DOS date like: ledate 21:00:48 19 Dec 2001 != DOS 00:00 1 Jan 2010 ~ 0000213C
+->>12	ulelong		x		\b, last modified
+ >>14	lemsdosdate	x		\b, last modified %s
+ >>12	lemsdostime	x		%s
+ # uncompressed size of 1st entry; FFffFFff means real value stored in ZIP64 record

+ 71 - 0
debian/patches/1742492810.FILE5_46-70-g4e2c7d3d.fix-msdosdate-endianess.patch

@@ -0,0 +1,71 @@
+Subject: Fix msdosdate endianness
+Origin: upstream, commit FILE5_46-70-g4e2c7d3d <https://github.com/file/file/commit/FILE5_46-70-g4e2c7d3d>
+Author: Christos Zoulas <christos@zoulas.com>
+Date: Thu Mar 20 17:46:50 2025 +0000
+Bug-Debian: https://bugs.debian.org/1100712
+
+    - fix msdosdate endianness
+    - remove day of the week as some platforms miscalculate it.
+    (Christoph Biedl)
+
+FIXME:
+- Adjust subject and patch file name
+
+--- a/src/print.c
++++ b/src/print.c
+@@ -354,7 +354,7 @@
+ 	tm.tm_mon = ((v >> 5) & 0xf) - 1;
+ 	tm.tm_year = (v >> 9) + 80;
+ 
+-	if (strftime(buf, bsize, "%a, %b %d %Y", &tm) == 0)
++	if (strftime(buf, bsize, "%b %d %Y", &tm) == 0)
+ 		goto out;
+ 
+ 	return buf;
+--- a/src/softmagic.c
++++ b/src/softmagic.c
+@@ -1042,6 +1042,14 @@
+ 		return FILE_LEDOUBLE;
+ 	case FILE_LEDOUBLE:
+ 		return FILE_BEDOUBLE;
++	case FILE_BEMSDOSDATE:
++		return FILE_LEMSDOSDATE;
++	case FILE_LEMSDOSDATE:
++		return FILE_BEMSDOSDATE;
++	case FILE_BEMSDOSTIME:
++		return FILE_LEMSDOSTIME;
++	case FILE_LEMSDOSTIME:
++		return FILE_BEMSDOSTIME;
+ 	default:
+ 		return type;
+ 	}
+@@ -1159,11 +1167,7 @@
+ 		return 1;
+ 	case FILE_SHORT:
+ 	case FILE_MSDOSDATE:
+-	case FILE_LEMSDOSDATE:
+-	case FILE_BEMSDOSDATE:
+ 	case FILE_MSDOSTIME:
+-	case FILE_LEMSDOSTIME:
+-	case FILE_BEMSDOSTIME:
+ 		if (cvt_16(p, m) == -1)
+ 			goto out;
+ 		return 1;
+@@ -1217,6 +1221,8 @@
+ 		return 1;
+ 	}
+ 	case FILE_BESHORT:
++	case FILE_BEMSDOSDATE:
++	case FILE_BEMSDOSTIME:
+ 		p->h = CAST(short, BE16(p->hs));
+ 		if (cvt_16(p, m) == -1)
+ 			goto out;
+@@ -1237,6 +1243,8 @@
+ 			goto out;
+ 		return 1;
+ 	case FILE_LESHORT:
++	case FILE_LEMSDOSDATE:
++	case FILE_LEMSDOSTIME:
+ 		p->h = CAST(short, LE16(p->hs));
+ 		if (cvt_16(p, m) == -1)
+ 			goto out;

+ 3 - 0
debian/patches/series

@@ -2,6 +2,9 @@
 
 # cherry-picked commits. Keep in upstream's chronological order
 1741021322.FILE5_46-55-gff9ba253.use-unsigned-byte-christoph-biedl.patch
+1742485595.FILE5_46-68-g5089651f.fix-openstreetmap-christoph-biedl.patch
+1742492756.FILE5_46-69-g280e121f.remove-superfluous-christoph-biedl.patch
+1742492810.FILE5_46-70-g4e2c7d3d.fix-msdosdate-endianess.patch
 
 # patches that should go upstream
 upstream.disable.att3b.patch