similarity index 90%
rename from meta/recipes-devtools/file/file_5.45.bb
rename to meta/recipes-devtools/file/file_5.46.bb
@@ -12,10 +12,11 @@ DEPENDS = "file-replacement-native"
DEPENDS:class-native = "bzip2-replacement-native"
SRC_URI = "git://github.com/file/file.git;branch=master;protocol=https \
- file://print_c.patch \
- "
+ file://0001-Use-4-in-default-reset-previous-negative-offset-in-m.patch \
+ file://0001-PR-579-net147-Fix-stack-overrun.patch \
+ "
-SRCREV = "4cbd5c8f0851201d203755b76cb66ba991ffd8be"
+SRCREV = "c5aa4f7f8d5063fb3c37ad57bf54bb67ec641a09"
S = "${WORKDIR}/git"
inherit autotools update-alternatives
new file mode 100644
@@ -0,0 +1,33 @@
+From fc6b51aa67a11806c95363e1bec925d15b3a98a5 Mon Sep 17 00:00:00 2001
+From: Christos Zoulas <christos@zoulas.com>
+Date: Thu, 5 Dec 2024 18:35:40 +0000
+Subject: [PATCH] PR/579: net147: Fix stack overrun.
+
+Upstream-Status: Backport [https://github.com/file/file/commit/b3384a1fbfa1fee99986e5750ab8e700de4f24ad]
+Signed-off-by: Alexander Kanavin <alex@linutronix.de>
+---
+ src/readelf.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/readelf.c b/src/readelf.c
+index fe4cf541..d209d86d 100644
+--- a/src/readelf.c
++++ b/src/readelf.c
+@@ -27,7 +27,7 @@
+ #include "file.h"
+
+ #ifndef lint
+-FILE_RCSID("@(#)$File: readelf.c,v 1.196 2024/11/11 15:49:11 christos Exp $")
++FILE_RCSID("@(#)$File: readelf.c,v 1.197 2024/12/05 18:35:40 christos Exp $")
+ #endif
+
+ #ifdef BUILTIN_ELF
+@@ -1726,7 +1726,7 @@ dophn_exec(struct magic_set *ms, int clazz, int swap, int fd, off_t off,
+ Elf64_Phdr ph64;
+ const char *linking_style;
+ unsigned char nbuf[NBUFSIZE];
+- char interp[128];
++ char interp[NBUFSIZE];
+ ssize_t bufsize;
+ size_t offset, align, need = 0;
+ int pie = 0, dynamic = 0;
new file mode 100644
@@ -0,0 +1,93 @@
+From b310a0c2d3e4a1c12d579ad5c0266f1092a91340 Mon Sep 17 00:00:00 2001
+From: Christos Zoulas <christos@zoulas.com>
+Date: Wed, 27 Nov 2024 15:37:46 +0000
+Subject: [PATCH] Use +4 in default reset previous negative offset in magic in
+ zip entry
+
+Upstream-Status: Backport [https://github.com/file/file/commit/b310a0c2d3e4a1c12d579ad5c0266f1092a91340]
+Signed-off-by: Alexander Kanavin <alex@linutronix.de>
+---
+ magic/Magdir/archive | 50 +++++++++++++++++++++++---------------------
+ 1 file changed, 26 insertions(+), 24 deletions(-)
+
+diff --git a/magic/Magdir/archive b/magic/Magdir/archive
+index c8f440dc..b920f993 100644
+--- a/magic/Magdir/archive
++++ b/magic/Magdir/archive
+@@ -1,5 +1,5 @@
+ #------------------------------------------------------------------------------
+-# $File: archive,v 1.206 2024/11/26 19:39:14 christos Exp $
++# $File: archive,v 1.207 2024/11/27 15:37:46 christos Exp $
+ # archive: file(1) magic for archive formats (see also "msdos" for self-
+ # extracting compressed archives)
+ #
+@@ -1875,15 +1875,6 @@
+ >>>>>-22 string PK\005\006
+ >>>>>>(-6.l-16) string APK\x20Sig\x20Block\x2042 \b, with APK Signing Block
+
+-# Keyman Compiled Package File (keyman.com)
+-# https://help.keyman.com/developer/current-version/reference/file-types/kmp
+-# Find start of central directory
+->>>(-6.l) string PK\001\002
+-# Scan central directory for string 'kmp.json', will suffice for a
+-# package containing about 150 files
+->>>>(-6.l) search/9000 kmp.json Keyman Compiled Package File
+-!:mime application/vnd.keyman.kmp+zip
+-!:ext kmp
+
+ # Specialised zip formats which start with a member named 'mimetype'
+ # (stored uncompressed, with no 'extra field') containing the file's MIME type.
+@@ -2123,25 +2114,36 @@
+ #>30 search/100/b application/epub+zip EPUB document
+ #!:mime application/epub+zip
+
+-# Generic zip archives (Greg Roelofs, c/o zip-bugs@wkuvx1.wku.edu)
+-# Next line excludes specialized formats:
++# APK Signing Block
+ >(26.s+30) leshort !0xcafe
+ >>30 search/100/b !application/epub+zip
+->>>26 string !\x8\0\0\0mimetype Zip archive data
+-!:mime application/zip
+->>>>4 beshort x \b, at least
+->>>>4 use zipversion
+->>>>4 beshort x to extract
+->>>>8 beshort x \b, compression method=
+->>>>8 use zipcompression
+->>>>0x161 string WINZIP \b, WinZIP self-extracting
+-# APK Signing Block
+->0 default x
+->>-22 string PK\005\006
+->>>(-6.l-16) string APK\x20Sig\x20Block\x2042 Android package (APK), with APK Signing Block
++>>>26 string !\x8\0\0\0mimetype
++>>>>-22 string PK\005\006
++>>>>>(-6.l-16) string APK\x20Sig\x20Block\x2042 Android package (APK), with APK Signing Block
+ !:mime application/vnd.android.package-archive
+ !:ext apk
+
++# Keyman Compiled Package File (keyman.com)
++# https://help.keyman.com/developer/current-version/reference/file-types/kmp
++# Find start of central directory
++>>>>>(-6.l) string PK\001\002
++# Scan central directory for string 'kmp.json', will suffice for a
++# package containing about 150 files
++>>>>>>(-6.l) search/9000 kmp.json Keyman Compiled Package File
++!:mime application/vnd.keyman.kmp+zip
++!:ext kmp
++
++# Generic zip archives (Greg Roelofs, c/o zip-bugs@wkuvx1.wku.edu)
++# Next line excludes specialized formats:
++>>>>+4 default x
++>>>>>4 beshort x Zip archive data, at least
++!:mime application/zip
++>>>>>4 use zipversion
++>>>>>4 beshort x to extract
++>>>>>8 beshort x \b, compression method=
++>>>>>8 use zipcompression
++>>>>>0x161 string WINZIP \b, WinZIP self-extracting
++
+ # Zip archives (Greg Roelofs, c/o zip-bugs@wkuvx1.wku.edu)
+ 0 string PK\005\006 Zip archive data (empty)
+ !:mime application/zip
+--
+2.39.5
+
deleted file mode 100644
@@ -1,27 +0,0 @@
-From e329257b8e22362b62e6c930447ef6feadd63f32 Mon Sep 17 00:00:00 2001
-From: Joe Slater <joe.slater@windriver.com>
-Date: Mon, 7 Aug 2023 22:37:19 +0000
-Subject: [PATCH] print.c: initialize timezone data for localtime_r()
-
-The man page for localtime() points out that while it acts
-like tzset() has been called, localtime_r() might not. We
-have a local version of localtime_r() that avoids this, but
-we do not compile it.
-
-Upstream-Status: Submitted [file@astron.com]
-
-Signed-off-by: Joe Slater <joe.slater@windriver.com>
----
- src/print.c | 1 +
- 1 file changed, 1 insertion(+)
-
---- git.orig/src/print.c
-+++ git/src/print.c
-@@ -289,6 +289,7 @@ file_fmtdatetime(char *buf, size_t bsize
- goto out;
-
- if (flags & FILE_T_LOCAL) {
-+ tzset();
- tm = localtime_r(&t, &tmz);
- } else {
- tm = gmtime_r(&t, &tmz);