This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit 3697a1fe0835d016434a27e5b794b6129b29375c
Author: zhengyu16 <[email protected]>
AuthorDate: Tue Jan 20 14:40:29 2026 +0800

    bugfix:Fix handling of normalization flags
    
    Problem:
    After mounting, files could not be found due to a failure in string 
conversion.
    This issue occurred when `CONFIG_UTILS_LIBARCHIVE_UNICODE_NORMALIZATION` is 
disabled:
    - The `SCONV_NORMALIZATION_C` and `SCONV_NORMALIZATION_D` flags
      were still being set in some cases, even though
      `archive_string_normalize_C` and `archive_string_normalize_D` are 
disabled.
    - This caused the `setup_converter` function to skip adding the
      `strncat_from_utf8_to_utf8` converter.
    - As a result, no converter was added, and `nconverter` was set to 0, 
leading to the failure.
    
    Signed-off-by: zhengyu16 <[email protected]>
    Signed-off-by: tengshuangshuang <[email protected]>
---
 .../0006-fix-handling-of-normalization-flags.patch | 36 ++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/system/libarchive/0006-fix-handling-of-normalization-flags.patch 
b/system/libarchive/0006-fix-handling-of-normalization-flags.patch
new file mode 100644
index 000000000..ac1f1a564
--- /dev/null
+++ b/system/libarchive/0006-fix-handling-of-normalization-flags.patch
@@ -0,0 +1,36 @@
+diff --git a/libarchive/archive_string.c b/libarchive/archive_string.c
+index b481d153..04aa04b0 100644
+--- a/libarchive/archive_string.c
++++ b/libarchive/archive_string.c
+@@ -1233,6 +1233,7 @@ create_sconv_object(const char *fc, const char *tc,
+        * comparing to find out the same filenames that we normalize
+        * that to be NFD ourselves.
+        */
++#ifdef CONFIG_UTILS_LIBARCHIVE_UNICODE_NORMALIZATION
+       if ((flag & SCONV_FROM_CHARSET) &&
+           (flag & (SCONV_FROM_UTF16 | SCONV_FROM_UTF8))) {
+ #if defined(__APPLE__)
+@@ -1265,6 +1266,7 @@ create_sconv_object(const char *fc, const char *tc,
+           (flag & SCONV_TO_UTF8))
+               flag |= SCONV_NORMALIZATION_D;
+ #endif
++#endif /* CONFIG_UTILS_LIBARCHIVE_UNICODE_NORMALIZATION */
+ 
+ #if defined(HAVE_ICONV)
+       sc->cd_w = (iconv_t)-1;
+@@ -1883,6 +1885,7 @@ archive_string_conversion_set_opt(struct 
archive_string_conv *sc, int opt)
+               }
+ #endif
+               break;
++#ifdef CONFIG_UTILS_LIBARCHIVE_UNICODE_NORMALIZATION
+       case SCONV_SET_OPT_NORMALIZATION_C:
+               if ((sc->flag & SCONV_NORMALIZATION_C) == 0) {
+                       sc->flag |= SCONV_NORMALIZATION_C;
+@@ -1909,6 +1912,7 @@ archive_string_conversion_set_opt(struct 
archive_string_conv *sc, int opt)
+                       setup_converter(sc);
+               }
+               break;
++#endif /* CONFIG_UTILS_LIBARCHIVE_UNICODE_NORMALIZATION */
+       default:
+               break;
+       }

Reply via email to