Skip to content

Improve targz and add tarxz pack format#7366

Merged
waruqi merged 6 commits intodevfrom
gz
Mar 3, 2026
Merged

Improve targz and add tarxz pack format#7366
waruqi merged 6 commits intodevfrom
gz

Conversation

@waruqi
Copy link
Member

@waruqi waruqi commented Mar 3, 2026

@waruqi waruqi added this to the v3.0.8 milestone Mar 3, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly expands the packaging capabilities of the system by introducing new tarxz and srctarxz formats. It also refines the existing targz archiving logic, making it more adaptable to different operating systems and compression tools, thereby improving the overall reliability and flexibility of the packaging process.

Highlights

  • New Packaging Formats: Introduced support for tarxz and srctarxz as new packaging formats, expanding the system's archiving capabilities.
  • Improved targz Archiving: Enhanced the targz archiving process, particularly for Windows platforms, by improving compression handling and 7z integration.
  • Robust Archiving Logic: Improved the robustness of gzip and tar archiving by dynamically checking for tool capabilities (like gzip --keep and tar --force-local) and adding better error handling.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • tests/plugins/pack/console/xmake.lua
    • Added tarxz and srctarxz to the list of supported formats for testing.
  • xmake/modules/utils/archive/archive.lua
    • Modified _archive_using_7z to explicitly specify archive types (-tgzip, -ttar, -txz) based on file extension.
    • Updated _archive_using_gzip to dynamically detect and use the --keep option for gzip if available.
    • Refactored _archive_using_tar to improve compression handling, add --force-local support for tar on Windows, and include robust error handling for the _archive_tarfile call.
    • Updated _archive_tarfile and the main archivers table to allow 7z as an alternative archiver for .xz, .gz, and .tar files.
  • xmake/plugins/pack/main.lua
    • Removed extraneous blank lines at the end of the file.
  • xmake/plugins/pack/srctarxz/main.lua
    • Added a new plugin to handle the srctarxz packaging format.
  • xmake/plugins/pack/tarxz/main.lua
    • Added a new plugin to handle the tarxz packaging format.
  • xmake/plugins/pack/xmake.lua
    • Included tarxz and srctarxz in the list of valid format options for the pack task.
  • xmake/plugins/pack/xpack.lua
    • Extended the inputkind, outputkind, and extension mappings to recognize and support the new tarxz and srctarxz formats.
Activity
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for tarxz and srctarxz packaging formats and improves the existing targz implementation. While the changes enhance handling of tar, gzip, and 7z archivers, a high-severity argument injection vulnerability was identified in the tar archiving logic, potentially leading to arbitrary command execution via malicious exclude patterns. Furthermore, a logic bug in gzip and xz archiving functions incorrectly passes the output archive file as an input argument. For improved maintainability, consider refactoring a series of if statements into a lookup table.


-- archive it
os.vrunv(tar.program, argv, {curdir = opt.curdir})
os.vrunv(program, argv, {curdir = opt.curdir})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-high high

The tar command is executed with arguments that include user-supplied exclude patterns. Because the --exclude= flag and the pattern are passed as separate arguments (at lines 296-297), tar will interpret any pattern starting with a hyphen as a new command-line option. An attacker could provide a malicious pattern like --checkpoint-action=exec=id to achieve arbitrary command execution when xmake pack is run.

To remediate this, combine the flag and the pattern into a single argument: table.insert(argv, "--exclude=" .. exclude).

@luadebug
Copy link
Member

luadebug commented Mar 3, 2026

Can we have .conda?
My bad, it seems already produced and working.

@waruqi waruqi merged commit 83dcecd into dev Mar 3, 2026
73 of 74 checks passed
@waruqi waruqi deleted the gz branch March 3, 2026 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants