Skip to content

fix: lock_packages typo#7017

Merged
waruqi merged 1 commit intoxmake-io:devfrom
qudix:dev
Nov 12, 2025
Merged

fix: lock_packages typo#7017
waruqi merged 1 commit intoxmake-io:devfrom
qudix:dev

Conversation

@qudix
Copy link
Contributor

@qudix qudix commented Nov 12, 2025

  • i dunno how this lingered for 4 years without anyone noticing, but i only got an error about it today

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @qudix, 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 addresses a critical, albeit small, typo within the lock_packages.lua module. The change rectifies an incorrect function call from so.subarch() to os.subarch(), which is essential for the package.requires_lock policy to accurately identify the system's architecture. This correction ensures the proper functioning of package dependency locking, resolving an error that had persisted for an extended period.

Highlights

  • Typo Fix: Corrected a typo in xmake/modules/private/action/require/impl/lock_packages.lua from so.subarch() to os.subarch().
  • Error Resolution: This fix resolves an error that prevented the package.requires_lock policy from correctly determining the system architecture, an issue that reportedly went unnoticed for four years.
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 fixes a long-standing typo in lock_packages.lua, changing so.subarch() to os.subarch(). This prevents a runtime error when determining the architecture for package locking. The fix is correct. I've added a suggestion to make the architecture and platform resolution more robust by asserting that a value is always found, preventing potential nil value errors during key creation.

if project.policy("package.requires_lock") then
local plat = config.plat() or os.subhost()
local arch = config.arch() or so.subarch()
local arch = config.arch() or os.subarch()
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

While this correctly fixes the typo, there's a potential for a runtime error if both config.arch() and os.subarch() return nil. This would cause arch to be nil, leading to an error on the next line when concatenating it to form the key.

To make the code more robust, you can use assert to ensure that arch gets a valid value.

A similar improvement could be applied to the plat variable on the preceding line for consistency.

        local arch = assert(config.arch() or os.subarch(), "could not determine architecture")

@waruqi waruqi added this to the v3.0.5 milestone Nov 12, 2025
@waruqi waruqi merged commit 1122e6f into xmake-io:dev Nov 12, 2025
21 of 22 checks passed
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