Skip to content

update tbox for process/argv#6998

Merged
waruqi merged 1 commit intodevfrom
args
Nov 7, 2025
Merged

update tbox for process/argv#6998
waruqi merged 1 commit intodevfrom
args

Conversation

@waruqi
Copy link
Member

@waruqi waruqi commented Nov 5, 2025

@waruqi waruqi added this to the v3.0.5 milestone Nov 5, 2025
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @waruqi, 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 focuses on updating the tbox subproject to a more recent version. This update is crucial for incorporating improvements or fixes, particularly concerning the handling of process arguments (process/argv), which is a common requirement for robust application development. By updating this core dependency, the project ensures it benefits from the latest enhancements provided by tbox in this specific area.

Highlights

  • tbox Subproject Update: The tbox subproject reference has been updated to a newer commit (9bb164af89169f9194be766375d954b0578831c) from its previous version (33d38b9a71c835c5e0c5385cb950491b4780ca28). This update is specifically aimed at addressing aspects related to process/argv handling, as indicated by the pull request title.
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 updates the tbox submodule to a new commit. This is a standard dependency update, and the change itself simply modifies the commit pointer for the submodule. As there are no source code changes within this repository's diff, I have no specific feedback or suggestions.

@MacroModel
Copy link

windows还有一个规则,argv0不能包含双引号

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Windows also has a rule that argv0 cannot contain double quotes.

@waruqi
Copy link
Member Author

waruqi commented Nov 6, 2025

windows还有一个规则,argv0不能包含双引号

那 arg0 带空格怎么搞,没引号,执行就跪了。。

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Windows also has a rule that argv0 cannot contain double quotes

What to do if arg0 contains spaces? Without quotation marks, execution will fail. .

@MacroModel
Copy link

MacroModel commented Nov 6, 2025

windows还有一个规则,argv0不能包含双引号

那 arg0 带空格怎么搞,没引号,执行就跪了。。

意思是最外层能加双引号表示一个arg,但是argv0内部无法使用转义\",会导致双引号位置误判(与后续的双引号位置匹配),导致argv0与预期的错误,甚至整个命令行的错误。这个我逆向CommandLineToArgvW看到的,你可以简单测一下。

@waruqi
Copy link
Member Author

waruqi commented Nov 6, 2025

windows还有一个规则,argv0不能包含双引号

那 arg0 带空格怎么搞,没引号,执行就跪了。。

意思是最外层能加双引号表示一个arg,但是argv0内部无法使用转义\",会导致双引号位置误判(与后续的双引号位置匹配),导致argv0与预期的错误,甚至整个命令行的错误。这个我逆向CommandLineToArgvW看到的,你可以简单测一下。

argv0 是文件名路径,win 下路径原本就不可能带 ", 是无效路径符号,所以统一处理转义时候,argv0 是不可能遇到内部带有 " 字符的。没必要额外处理什么。

如果你 argv0 内部带上 " , 即使转义处理正确,也不是有效路径,执行不起来的。

image

@MacroModel
Copy link

MacroModel commented Nov 6, 2025

windows还有一个规则,argv0不能包含双引号

那 arg0 带空格怎么搞,没引号,执行就跪了。。

意思是最外层能加双引号表示一个arg,但是argv0内部无法使用转义\",会导致双引号位置误判(与后续的双引号位置匹配),导致argv0与预期的错误,甚至整个命令行的错误。这个我逆向CommandLineToArgvW看到的,你可以简单测一下。

argv0 是文件名路径,win 下路径原本就不可能带 ", 是无效路径符号,所以统一处理转义时候,argv0 是不可能遇到内部带有 " 字符的。没必要额外处理什么。

如果你 argv0 内部带上 " , 即使转义处理正确,也不是有效路径,执行不起来的。

image

问题windows上argv0可以自定义啊,意思就是argv0传入直接报错就行,做一层防御

@waruqi
Copy link
Member Author

waruqi commented Nov 6, 2025

问题windows上argv0可以自定义啊,意思就是argv0传入“直接报错就行,做一层防御

感觉没啥必要,就算我不报错,传入 ",最终执行进程的时候,还是会报错的,一样的。

对于 tbox 这边,只能处理返回值,报错,就是创建 process 返回 null,这跟直接丢 " 给 CreateProcess 最后执行失败,一样是返回 null。

也就是做不做提前检测,对于 tb_process_init 来说是没有任何变化的,都是返回 null

要想提示更加明显的错误信息,只能在 lua 上层做,那这个额外处理的,还得分平台处理,不仅不好维护,而且还影响性能,每次启进程,还得多做一次 argv0 查找操作。没啥必要。

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Windows also has a rule that argv0 cannot contain double quotes.

What to do if arg0 contains spaces? Without quotation marks, execution will fail. .

This means that double quotes can be added to the outermost layer to represent an arg, but the escape \" cannot be used inside argv0, which will lead to misjudgment of the position of the double quotes, resulting in argv0 and expected errors. I reversed CommandLineToArgvW and saw this.

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Windows also has a rule that argv0 cannot contain double quotes.

What to do if arg0 contains spaces? Without quotation marks, execution will fail. .

It means that double quotes can be added to the outermost layer to represent an arg, but the escape \" cannot be used inside argv0, which will lead to misjudgment of the double quote position (matching the subsequent double quote position), resulting in argv0 and expected errors, or even errors in the entire command line. I reversed CommandLineToArgvW to see this, you can simply test it.

argv0 is the file name path. It is impossible for the path under win to contain ", which is an invalid path symbol. Therefore, when escaping is processed uniformly, it is impossible for argv0 to encounter characters containing " inside. No need to do anything extra.

If you have " inside argv0, even if the escape processing is correct, it is not a valid path and cannot be executed.

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Problem: argv0 can be customized on Windows, which means that if argv0 is passed in, "just report an error directly and provide a layer of defense."

It feels unnecessary. Even if I don't report an error and pass in ", an error will still be reported when the process is finally executed. It's the same.

For tbox, we can only handle the return value and report an error, that is, the creation process returns null. This is the same as directly throwing " to CreateProcess and the final execution fails, which returns null.

That is to say, whether or not early detection is performed, there is no change for tb_process_init, and null is returned.

If you want to prompt a more obvious error message, you can only do it in the upper layer of Lua. This extra processing will also be handled by the platform. It is not only difficult to maintain, but also affects performance. Every time you start the process, you have to do an extra argv0 search operation. No need.

@waruqi waruqi merged commit 268d1b9 into dev Nov 7, 2025
44 checks passed
@waruqi waruqi deleted the args branch November 18, 2025 07:50
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.

3 participants