txy-21 opened a new pull request, #4076:
URL: https://github.com/apache/nuttx-apps/pull/4076

   ## Summary
   
     * Why: the zipfs file system of nuttx reads and writes zip archives with
       libarchive, and nuttx-apps has no libarchive. The nuttx pull request is 
opened right after this one and will be linked here.
     * What: new directory system/libarchive, with the Kconfig, Makefile,
       CMakeLists.txt, Make.defs and config.h files, and 13 patch files.
     * How:
       - The libarchive source is not in the repository. When UTILS_LIBARCHIVE 
is
         enabled, the Make build downloads libarchive-3.7.7.zip at the context
         step, and the CMake build fetches it with FetchContent. Then every file
         that matches 0*.patch is applied, in the order of its name.
       - 0001 fixes names that clash with stdio.h and a redefined MAX_SIGNO.
         0002 to 0013 make parts of libarchive optional (Unicode normalization,
         error strings, PPMd, Windows paths, Mac extensions, encryption, 
symbolic
         links, ZIP64, the ZIP xl field), fix the handling of the normalization
         flags, and remove a signed/unsigned comparison warning of newer clang.
         Patch files are used because the source is downloaded.
       - UTILS_LIBARCHIVE depends on FILE_STREAM. The command line programs
         (bsdunzip, bsdtar, bsdcat, cpio, minitar, tarfilter) are separate
         options.
     * The 28 commits keep their original authors. Commits 1 to 15 are the 
history
       of the Kconfig, config.h and build files, commit 16 makes the build apply
       every numbered patch, and commits 17 to 28 add the patch files 0002 to
       0013. Their subjects repeat those of the Kconfig commits.
     * Related: apache/nuttx-apps#3318 was closed. It proposed the same 
libarchive
       port.
   
   ## Impact
   
     * Is new feature added? Is existing feature changed? YES. The library is 
new.
       No existing option or code changes.
     * Impact on user (will user need to adapt to change)? NO. UTILS_LIBARCHIVE 
is
       off by default.
     * Impact on build (will build process change)? NO for the existing
       configurations. YES when UTILS_LIBARCHIVE is enabled, because the build
       downloads libarchive from GitHub. After a build, changing the 
configuration
       and running "make" again can fail, because the Makefile extracts the zip 
file
       again and applies the patches a second time. "make distclean" and 
removing
       the extracted libarchive directory fix it.
     * Impact on hardware (will arch(s) / board(s) / driver(s) change)? NO.
     * Impact on documentation (is update required / provided)? NO. The nuttx 
pull
       request documents zipfs.
     * Impact on security (any sort of implications)? YES. libarchive is third
       party code that parses archives, and the option for encrypted entries is 
off
       by default.
     * Impact on compatibility (backward/forward/interoperability)? NO.
     * Anything else to consider or add? The question whether UTILS_LIBARCHIVE
       should depend on ALLOW_BSD_COMPONENTS was asked in #3318, and I did not
       find an answer. The Kconfig does not have that dependency.
   
   ## Testing
   
     I confirm that changes are verified on local setup and works as intended:
     * Build Host(s): Linux 7.0.0-34-generic x86_64, Intel i7-14700,
       gcc (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0, GNU Make 4.3, CMake 3.28.3,
       Ninja 1.11.1.
     * Target(s): sim:zipfs, with the nuttx pull request. Real hardware was not
       tested.
     * The 28 commits were replayed on nuttx-apps 72937e7f86f and built with 
nuttx
       e9eefaa0e9a plus the nuttx pull request. Make and CMake with Ninja both
       download libarchive and zlib, apply the 13 patches, and build sim:zipfs
       without errors or warnings. In the CMake build, libarchive has 1442 
files,
       no .rej file, and the string UTILS_LIBARCHIVE_ZIP64 appears 7 times in
       libarchive/archive_read_support_format_zip.c.
   
     Testing logs before change: not applicable, the directory is new.
   
     Testing logs after change (the nuttx binary built by CMake with Ninja), NSH
     session as printed:
   
   <details><summary>after</summary>
   
   ```
   nsh> mount -t hostfs -o fs=/tmp/zh.GX1FlK/host /host
   nsh> mount -t zipfs -o /host/test.zip /zip
   nsh> echo ---ls-zip
   ---ls-zip
   nsh> ls /zip
   /zip:
    a/
    a/1
    a/2
    top.txt
    文件.txt
   nsh> echo ---cat-top
   ---cat-top
   nsh> cat /zip/top.txt
   top level file
   nsh> echo ---cat-a1
   ---cat-a1
   nsh> cat /zip/a/1
   this is zipfs test 1
   nsh> echo ---cat-utf8
   ---cat-utf8
   nsh> cat /zip/文件.txt
   utf8 name file
   nsh> echo ---ls-l-top
   ---ls-l-top
   nsh> ls -l /zip/top.txt
    -rw-rw-r--          15 2026-11-17 12:18 /zip/top.txt
   nsh> umount /zip
   nsh> echo done
   done
   nsh> poweroff
   ```
   
   </details>
   
     Not tested: real hardware, ostest, other architectures, the command line
     programs (they were not built or run), and an encrypted archive. The nine
     libarchive options (default, all on, each alone) were built before the last
     rebase onto the current master, and the default and the all-on builds read 
an
     archive in the simulator.
   
   ## PR verification Self-Check
   
     * [x] This PR introduces only one functional change.
     * [x] I have updated all required description fields above.
     * [ ] My PR adheres to Contributing 
[Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md) and 
[Documentation](https://nuttx.apache.org/docs/latest/contributing/index.html) 
(git commit title and message, coding standard, etc).
     * [x] My PR is still work in progress (not ready for review).
     * [ ] My PR is ready for review and can be safely merged into a codebase.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to