]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
tools/mtd-utils: update to v2.3.1
authorShiji Yang <yangshiji66@outlook.com>
Wed, 15 Apr 2026 17:03:59 +0000 (01:03 +0800)
committerHauke Mehrtens <hauke@hauke-m.de>
Thu, 16 Apr 2026 18:45:40 +0000 (20:45 +0200)
Fixes:
  - ubifs-utils: link libmissing.a in case execinfo.h isn't present
  - ubifs-utils: common: fix memory leak in devtable.c
  - Broken check for GCC compiler versions
  - ubifs-utils: missing header file includes
  - ubifs-utils: tests: missing files in release tarball
  - mtd-tests: flash_speed: really skip destructive tests
  - mtd-tests: flash_speed: wrong error message in read_eraseblock()
  - serve_image: fix _POSIX_C_SOURCE define
  - ubiattach: fix wording in usage example
  - fsck.ubifs: don't use pointers that reference out-of-scope variables
  - fsck.ubifs: fix platform dependant `ino_t` and `loff_t` formatting
  - docfdisk.c: fix potential arithmetic overflows in partition size
  - jittertest: reject overlong file names

Changes:
  - ubirsvol: resize using all available free space if size is specified
    as 0

Upstreamed patches:
  - 001-ubifs-utils-link-libmissing.a-in-case-execinfo.h-isn.patch[1]
  - 002-ubifs-utils-common-fix-memory-leak-in-devtable.c.patch[2]
  - 004-Improve-check-for-GCC-compiler-version.patch[3]
  - 005-ubifs-utils-ubifs.h-Include-fcntl.h.patch[4]
  - 006-ubifs-utils-journal-Include-sys-stat.h.patch[5]
  - 007-ubifs-utils-extract_files-Include-linux-limits.h.patch[6]

[1] https://git.infraroot.at/mtd-utils.git/commit/?h=v2.3.1&id=8a83b306db64d6f60186d4396b0b770163b85b6e
[2] https://git.infraroot.at/mtd-utils.git/commit/?h=v2.3.1&id=2669111e3c60b8e146c174db5d2e7e9991f3dd87
[3] https://git.infraroot.at/mtd-utils.git/commit/?h=v2.3.1&id=ac0ab65ebcd7b11739986b81343457469fbb43b0
[4] https://git.infraroot.at/mtd-utils.git/commit/?h=v2.3.1&id=12bc9ad824bd8f18a5ec9c7154ad2374cf8c7ae3
[5] https://git.infraroot.at/mtd-utils.git/commit/?h=v2.3.1&id=173f9714c8da1d685bfa951d43b9310d16bbab3c
[6] https://git.infraroot.at/mtd-utils.git/commit/?h=v2.3.1&id=77981a2888c711268b0e7f32af6af159c2288e23
Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
Link: https://github.com/openwrt/openwrt/pull/22946
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
tools/mtd-utils/Makefile
tools/mtd-utils/patches/001-ubifs-utils-link-libmissing.a-in-case-execinfo.h-isn.patch [deleted file]
tools/mtd-utils/patches/002-ubifs-utils-common-fix-memory-leak-in-devtable.c.patch [deleted file]
tools/mtd-utils/patches/004-Improve-check-for-GCC-compiler-version.patch [deleted file]
tools/mtd-utils/patches/005-ubifs-utils-ubifs.h-Include-fcntl.h.patch [deleted file]
tools/mtd-utils/patches/006-ubifs-utils-journal-Include-sys-stat.h.patch [deleted file]
tools/mtd-utils/patches/007-ubifs-utils-extract_files-Include-linux-limits.h.patch [deleted file]
tools/mtd-utils/patches/130-lzma_jffs2.patch

index b94b690dab9aa4d6eabeb729b2db5e6c0bb2a3ae..5430c3445abbdcf2be3dcbbbee32f1fccb7025ac 100644 (file)
@@ -7,12 +7,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=mtd-utils
-PKG_VERSION:=2.3.0
+PKG_VERSION:=2.3.1
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=https://infraroot.at/pub/mtd/
-PKG_HASH:=2db102908b232406ccb20719c0f43b61196aef4534493419fbf98a273c598c10
+PKG_HASH:=03d9dc58ad10ea3549d9528f6b17a44d8944e18e96c0f31474f9f977078b83dc
 PKG_CPE_ID:=cpe:/a:mtd-utils_project:mtd-utils
 
 PKG_FIXUP:=autoreconf
diff --git a/tools/mtd-utils/patches/001-ubifs-utils-link-libmissing.a-in-case-execinfo.h-isn.patch b/tools/mtd-utils/patches/001-ubifs-utils-link-libmissing.a-in-case-execinfo.h-isn.patch
deleted file mode 100644 (file)
index e43e34f..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-From 8a83b306db64d6f60186d4396b0b770163b85b6e Mon Sep 17 00:00:00 2001
-From: Ross Burton <ross.burton@arm.com>
-Date: Wed, 26 Feb 2025 18:24:00 +0000
-Subject: ubifs-utils: link libmissing.a in case execinfo.h isn't present
-
-On musl execinfo.h doesn't exist, but ubifs-utils uses backtrace() when
-reporting errors.  This results in build failures under musl.
-
-Handily, libmissing.a already exists with a stub implementation of
-backtrace().
-
-Guard the execinfo.h include and if it isn't available instead include
-libmissing.h, and link to libmissing.a to provide backtrace() if needed.
-
-Signed-off-by: Ross Burton <ross.burton@arm.com>
-Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>
-Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
----
- ubifs-utils/Makemodule.am | 4 ++--
- ubifs-utils/common/defs.h | 5 ++++-
- 2 files changed, 6 insertions(+), 3 deletions(-)
-
---- a/ubifs-utils/Makemodule.am
-+++ b/ubifs-utils/Makemodule.am
-@@ -72,7 +72,7 @@ mkfs_ubifs_SOURCES = \
-       ubifs-utils/mkfs.ubifs/mkfs.ubifs.c
- mkfs_ubifs_LDADD = libmtd.a libubi.a $(ZLIB_LIBS) $(LZO_LIBS) $(ZSTD_LIBS) $(UUID_LIBS) $(LIBSELINUX_LIBS) $(OPENSSL_LIBS) \
--                 $(DUMP_STACK_LD) $(ASAN_LIBS) -lm -lpthread
-+                 $(DUMP_STACK_LD) $(ASAN_LIBS) -lm -lpthread libmissing.a
- mkfs_ubifs_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_CFLAGS) $(LZO_CFLAGS) $(ZSTD_CFLAGS) $(UUID_CFLAGS) $(LIBSELINUX_CFLAGS) \
-       -I$(top_srcdir)/ubi-utils/include -I$(top_srcdir)/ubifs-utils/common -I $(top_srcdir)/ubifs-utils/libubifs
-@@ -90,7 +90,7 @@ fsck_ubifs_SOURCES = \
-       ubifs-utils/fsck.ubifs/handle_disconnected.c
- fsck_ubifs_LDADD = libmtd.a libubi.a $(ZLIB_LIBS) $(LZO_LIBS) $(ZSTD_LIBS) $(UUID_LIBS) $(LIBSELINUX_LIBS) $(OPENSSL_LIBS) \
--                 $(DUMP_STACK_LD) $(ASAN_LIBS) -lm -lpthread
-+                 $(DUMP_STACK_LD) $(ASAN_LIBS) -lm -lpthread libmissing.a
- fsck_ubifs_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_CFLAGS) $(LZO_CFLAGS) $(ZSTD_CFLAGS) $(UUID_CFLAGS) $(LIBSELINUX_CFLAGS) \
-       -I$(top_srcdir)/ubi-utils/include -I$(top_srcdir)/ubifs-utils/common -I $(top_srcdir)/ubifs-utils/libubifs \
-       -I$(top_srcdir)/ubifs-utils/fsck.ubifs
---- a/ubifs-utils/common/defs.h
-+++ b/ubifs-utils/common/defs.h
-@@ -13,8 +13,11 @@
- #include <errno.h>
- #include <time.h>
- #include <assert.h>
-+#if HAVE_EXECINFO_H
- #include <execinfo.h>
--
-+#else
-+#include "libmissing.h"
-+#endif
- #include "ubifs.h"
- /* common.h requires the PROGRAM_NAME macro */
diff --git a/tools/mtd-utils/patches/002-ubifs-utils-common-fix-memory-leak-in-devtable.c.patch b/tools/mtd-utils/patches/002-ubifs-utils-common-fix-memory-leak-in-devtable.c.patch
deleted file mode 100644 (file)
index 4daaf45..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-From 2669111e3c60b8e146c174db5d2e7e9991f3dd87 Mon Sep 17 00:00:00 2001
-From: AntonMoryakov <ant.v.moryakov@gmail.com>
-Date: Thu, 24 Apr 2025 21:19:22 +0300
-Subject: ubifs-utils: common: fix memory leak in devtable.c
-
-Report of the static analyzer:
-Dynamic memory, referenced by 'line', is allocated at devtable.c:356
-by calling function 'getline' and lost at devtable.c:388.
-(line: while (getline(&line, &len, f) != -1) {)
-
-Correct explained:
-Now line is freed in any exit scenario via out_close which eliminates this error.
-
-Triggers found by static analyzer Svace.
-
-Signed-off-by: Anton Moryakov <ant.v.moryakov@gmail.co
-Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>
-Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
----
- ubifs-utils/common/devtable.c | 1 +
- 1 file changed, 1 insertion(+)
-
---- a/ubifs-utils/common/devtable.c
-+++ b/ubifs-utils/common/devtable.c
-@@ -392,6 +392,7 @@ int parse_devtable(const char *tbl_file)
- out_close:
-       fclose(f);
-+      free(line);
-       free_devtable_info();
-       return -1;
- }
diff --git a/tools/mtd-utils/patches/004-Improve-check-for-GCC-compiler-version.patch b/tools/mtd-utils/patches/004-Improve-check-for-GCC-compiler-version.patch
deleted file mode 100644 (file)
index 5b1870b..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-From ac0ab65ebcd7b11739986b81343457469fbb43b0 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Sat, 22 Mar 2025 21:01:32 -0700
-Subject: Improve check for GCC compiler version
-
-When using unreleased compiler has version like
-15.0.1 and that test fails because __GNUC_MINOR__ < 1
-becomes true, therefore check for full version string
-which is more rubust.
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
----
- ubifs-utils/common/atomic.h | 6 +++++-
- 1 file changed, 5 insertions(+), 1 deletion(-)
-
---- a/ubifs-utils/common/atomic.h
-+++ b/ubifs-utils/common/atomic.h
-@@ -2,8 +2,12 @@
- #ifndef __ATOMIC_H__
- #define __ATOMIC_H__
-+#define GCC_VERSION (__GNUC__ * 10000 \
-+                     + __GNUC_MINOR__ * 100 \
-+                     + __GNUC_PATCHLEVEL__)
-+
- /* Check GCC version, just to be safe */
--#if !defined(__GNUC__) || (__GNUC__ < 4) || (__GNUC_MINOR__ < 1)
-+#if GCC_VERSION < 40100
- # error atomic.h works only with GCC newer than version 4.1
- #endif /* GNUC >= 4.1 */
diff --git a/tools/mtd-utils/patches/005-ubifs-utils-ubifs.h-Include-fcntl.h.patch b/tools/mtd-utils/patches/005-ubifs-utils-ubifs.h-Include-fcntl.h.patch
deleted file mode 100644 (file)
index 0bba423..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-From 12bc9ad824bd8f18a5ec9c7154ad2374cf8c7ae3 Mon Sep 17 00:00:00 2001
-From: Fabio Estevam <festevam@gmail.com>
-Date: Wed, 19 Feb 2025 10:02:41 -0300
-Subject: ubifs-utils: ubifs.h: Include <fcntl.h>
-
-Include the <fcntl.h> header file to fix the following error
-when building with musl:
-
-| In file included from ../git/ubifs-utils/common/compr.c:42:
-| ../git/ubifs-utils/libubifs/ubifs.h:313:9: error: unknown type name 'loff_t'; did you mean 'off_t'?
-|   313 |         loff_t ui_size;
-|       |         ^~~~~~
-|       |         off_t
-| ../git/ubifs-utils/libubifs/ubifs.h:1341:9: error: unknown type name 'loff_t'; did you mean 'off_t'?
-|  1341 |         loff_t i_size;
-|       |         ^~~~~~
-|       |         off_t
-| ../git/ubifs-utils/libubifs/ubifs.h:1342:9: error: unknown type name 'loff_t'; did you mean 'off_t'?
-|  1342 |         loff_t d_size;
-|       |         ^~~~~~
-|       |         off_t
-| ../git/ubifs-utils/libubifs/ubifs.h:1899:44: error: unknown type name 'loff_t'; did you mean 'off_t'?
-|  1899 |                              int deletion, loff_t new_size);
-|       |                                            ^~~~~~
-|       |                                            off_t
-| make: *** [Makefile:4878: ubifs-utils/common/mkfs_ubifs-compr.o] Error 1
-
-Signed-off-by: Fabio Estevam <festevam@gmail.com>
-Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>
-Reviewed-by: Khem Raj <raj.khem@gmail.com>
-Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
----
- ubifs-utils/libubifs/ubifs.h | 1 +
- 1 file changed, 1 insertion(+)
-
---- a/ubifs-utils/libubifs/ubifs.h
-+++ b/ubifs-utils/libubifs/ubifs.h
-@@ -11,6 +11,7 @@
- #ifndef __UBIFS_H__
- #define __UBIFS_H__
-+#include <fcntl.h>
- #include <string.h>
- #include "linux_types.h"
diff --git a/tools/mtd-utils/patches/006-ubifs-utils-journal-Include-sys-stat.h.patch b/tools/mtd-utils/patches/006-ubifs-utils-journal-Include-sys-stat.h.patch
deleted file mode 100644 (file)
index b43cef8..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-From 173f9714c8da1d685bfa951d43b9310d16bbab3c Mon Sep 17 00:00:00 2001
-From: Fabio Estevam <festevam@gmail.com>
-Date: Wed, 19 Feb 2025 10:02:42 -0300
-Subject: ubifs-utils: journal: Include <sys/stat.h>
-
-Include the <sys/stat.h> header file to fix the following error
-when building with musl:
-
-| ../git/ubifs-utils/libubifs/journal.c: In function 'ubifs_get_dent_type':
-| ../git/ubifs-utils/libubifs/journal.c:414:24: error: 'S_IFMT' undeclared (first use in this function)
-|   414 |         switch (mode & S_IFMT) {
-|       |                        ^~~~~~
-| ../git/ubifs-utils/libubifs/journal.c:414:24: note: each undeclared identifier is reported only once for each function it appears in
-| ../git/ubifs-utils/libubifs/journal.c:415:14: error: 'S_IFREG' undeclared (first use in this function)
-|   415 |         case S_IFREG:
-
-Signed-off-by: Fabio Estevam <festevam@gmail.com>
-Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>
-Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
----
- ubifs-utils/libubifs/journal.c | 1 +
- 1 file changed, 1 insertion(+)
-
---- a/ubifs-utils/libubifs/journal.c
-+++ b/ubifs-utils/libubifs/journal.c
-@@ -46,6 +46,7 @@
-  * all the nodes.
-  */
-+#include <sys/stat.h>
- #include "bitops.h"
- #include "kmem.h"
- #include "ubifs.h"
diff --git a/tools/mtd-utils/patches/007-ubifs-utils-extract_files-Include-linux-limits.h.patch b/tools/mtd-utils/patches/007-ubifs-utils-extract_files-Include-linux-limits.h.patch
deleted file mode 100644 (file)
index 1e99ab6..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-From 77981a2888c711268b0e7f32af6af159c2288e23 Mon Sep 17 00:00:00 2001
-From: Fabio Estevam <festevam@gmail.com>
-Date: Wed, 19 Feb 2025 10:02:44 -0300
-Subject: ubifs-utils: extract_files: Include <linux/limits.h>
-
-Include <linux/limits.h> to fix the following build error when building
-with musl:
-
-| ../git/ubifs-utils/fsck.ubifs/extract_files.c: In function 'parse_ino_node':
-| ../git/ubifs-utils/fsck.ubifs/extract_files.c:144:47: error: 'XATTR_LIST_MAX' undeclared (first use in this function)
-|   144 |         if (ino_node->xnms + ino_node->xcnt > XATTR_LIST_MAX) {
-|       |                                               ^~~~~~~~~~~~~~
-| ../git/ubifs-utils/fsck.ubifs/extract_files.c:144:47: note: each undeclared identifier is reported only once for each function it appears in
-| make: *** [Makefile:4374: ubifs-utils/fsck.ubifs/fsck_ubifs-extract_files.o] Error 1
-
-Signed-off-by: Fabio Estevam <festevam@gmail.com>
-Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>
-Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
----
- ubifs-utils/fsck.ubifs/extract_files.c | 2 ++
- 1 file changed, 2 insertions(+)
-
---- a/ubifs-utils/fsck.ubifs/extract_files.c
-+++ b/ubifs-utils/fsck.ubifs/extract_files.c
-@@ -10,6 +10,8 @@
- #include <getopt.h>
- #include <sys/stat.h>
-+#include <linux/limits.h>
-+
- #include "linux_err.h"
- #include "bitops.h"
- #include "kmem.h"
index f4981cce0e0ac18ac4ea2f9835547e3acabd88e8..df77502720aebffbb03671f7799fb9425868158b 100644 (file)
  AM_CONDITIONAL([WITH_XATTR], [test "x$with_xattr" = "xyes"])
  AM_CONDITIONAL([WITH_SELINUX], [test "x$with_selinux" = "xyes"])
  AM_CONDITIONAL([WITH_CRYPTO], [test "x$with_crypto" = "xyes"])
-@@ -339,6 +344,7 @@ AC_MSG_RESULT([
+@@ -340,6 +345,7 @@ AC_MSG_RESULT([
        lzo support:       ${with_lzo}
        zlib support:      ${with_zlib}
        zstd support:      ${with_zstd}