Add quotes to prevent potential word splittings#3816
Open
zzmic wants to merge 1 commit intoBeyondDimension:developfrom
Open
Add quotes to prevent potential word splittings#3816zzmic wants to merge 1 commit intoBeyondDimension:developfrom
zzmic wants to merge 1 commit intoBeyondDimension:developfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As the title suggests, this PR includes the commit that adds quotes to several commands in
build/linux/online_install.shandbuild/linux/uninstall.shto prevent potential word splittings (related to https://www.shellcheck.net/wiki/SC2086). For instance,rm -rf $tar_pathis risky becausetar_pathis derived frombase_path, which in turn comes from user input viazenity. If the user enters a path containing spaces, the unquoted variable could be split into multiple arguments, causing the command to behave unexpectedly.如下为翻译:正如标题所示,本次PR包含在
build/linux/online_install.sh和build/linux/uninstall.sh中为多个命令添加引号的提交,以防止潜在的单词分割问题(与https://www.shellcheck.net/wiki/SC2086相关)。例如,rm -rf $tar_path存在风险,因为tar_path由base_path派生而来,而后者又来自用户通过zenity输入的路径。若用户输入的路径包含空格,未加引号的变量可能被拆分为多个参数,导致命令行为异常。