Conversation
There was a problem hiding this comment.
Pull request overview
This pull request claims to fix formatting issues in index.html (which contains a shell script), but the changes actually introduce numerous bugs by adding extraneous spaces in critical locations that will break file paths, command syntax, and string operations.
Changes:
- Added spaces before
.tgzfile extensions throughout, breaking URL and file path construction - Added spaces in hidden directory references (e.g.,
.x-cmdbecomes. x-cmd) - Modified function definition syntax for
___x_cmd_get_bootinit - Added trailing spaces after semicolons and before closing braces in various locations
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| local url="https://raw.githubusercontent.com/x-cmd/release/main"; | ||
| case "$___X_CMD_VERSION" in | ||
| latest|alpha|beta) url="$url/dist/${___X_CMD_VERSION}.tgz" ;; | ||
| latest|alpha|beta) url="$url/dist/${___X_CMD_VERSION}. tgz" ;; |
There was a problem hiding this comment.
Space inserted before 'tgz' breaks the file extension. URLs will be malformed (e.g., 'latest. tgz' instead of 'latest.tgz'), causing download failures. Remove the space to restore correct URL construction.
| latest|alpha|beta) url="$url/dist/${___X_CMD_VERSION}. tgz" ;; | ||
| v0.1.*|v0.2.*|v0.3.*|v0.4.*|v0.5.0|v0.5.1) | ||
| url="$url/dist/${___X_CMD_VERSION}/full.tgz" ;; | ||
| url="$url/dist/${___X_CMD_VERSION}/full. tgz" ;; |
There was a problem hiding this comment.
Space inserted before 'tgz' breaks the file extension. This will construct invalid URLs like 'full. tgz' instead of 'full.tgz', causing download failures. Remove the space.
| url="$url/dist/${___X_CMD_VERSION}/full. tgz" ;; | ||
| v*) url="$url/dist/${___X_CMD_VERSION}/allinone.tgz" ;; | ||
| *) url="$url/sum/${___X_CMD_VERSION}.tgz" ;; | ||
| *) url="$url/sum/${___X_CMD_VERSION}. tgz" ;; |
There was a problem hiding this comment.
Space inserted before 'tgz' breaks the file extension. This malforms URLs, changing '.tgz' to '. tgz', which will cause download failures. Remove the space.
|
|
||
| local target="$tmptgt/download_tmp.tgz"; | ||
| [ ! -d "${tmptgt}" ] || { | ||
| local target="$tmptgt/download_tmp. tgz"; |
There was a problem hiding this comment.
Space inserted before 'tgz' breaks the file path. This creates a file named 'download_tmp. tgz' (with space) instead of 'download_tmp.tgz', causing mismatches when the file is referenced later. Remove the space.
| ___x_cmd_get_populate(){ | ||
| local tmptgt="$1"; local sumfp="$tmptgt/.x-cmd/metadata/version_sum"; | ||
| [ ! -r "$sumfp" ] || . "$sumfp"; | ||
| local tmptgt="$1"; local sumfp="$tmptgt/. x-cmd/metadata/version_sum"; |
There was a problem hiding this comment.
Space inserted after the dot breaks the hidden directory reference. The path becomes '. x-cmd' instead of '.x-cmd', which will fail to locate the metadata directory. Remove the space.
| }; | ||
|
|
||
| ___X_CMD_VERSION_SUM8="${___X_CMD_VERSION_SUM%"${___X_CMD_VERSION_SUM#????????}"}"; | ||
| ___X_CMD_VERSION_SUM8="${___X_CMD_VERSION_SUM%"${___X_CMD_VERSION_SUM#???????? }"}"; |
There was a problem hiding this comment.
Space inserted inside the string manipulation pattern breaks the logic. The pattern '#???????? ' (with space) will not match the intended 8 characters. This should be '#????????' without the space. Remove the space.
| ___X_CMD_VERSION_SUM8="${___X_CMD_VERSION_SUM%"${___X_CMD_VERSION_SUM#???????? }"}"; | |
| ___X_CMD_VERSION_SUM8="${___X_CMD_VERSION_SUM%"${___X_CMD_VERSION_SUM#????????}"}"; |
| local target="$tmptgt/download_tmp.tgz"; | ||
| local archivedir="$___X_CMD_ROOT/global/shared/version/archive"; | ||
| local archivefile="$archivedir/.${___X_CMD_VERSION_SUM8}.tgz"; | ||
| local archivefile="$archivedir/. ${___X_CMD_VERSION_SUM8}.tgz"; |
There was a problem hiding this comment.
Space inserted after the dot breaks the hidden file reference. This creates a path with '. filename' instead of '.filename', which will fail to match archived files. Remove the space.
|
|
||
| local sum8dir="$___X_CMD_ROOT/v/.${___X_CMD_VERSION_SUM8}"; | ||
| [ ! -e "$sum8dir" ] || { | ||
| local sum8dir="$___X_CMD_ROOT/v/. ${___X_CMD_VERSION_SUM8}"; |
There was a problem hiding this comment.
Space inserted after the dot breaks the hidden directory reference. The path becomes '. dirname' instead of '.dirname', causing directory operations to fail. Remove the space.
| printf "___X_CMD_VERSION0=%s\n" "${___X_CMD_VERSION}"; | ||
| printf "___X_CMD_VERSION=%s\n" ".${___X_CMD_VERSION_SUM8}"; | ||
| printf ". \"\$___X_CMD_ROOT/v/%s/X\"\n" ".${___X_CMD_VERSION_SUM8}"; | ||
| printf "___X_CMD_VERSION=%s\n" ". ${___X_CMD_VERSION_SUM8}"; |
There was a problem hiding this comment.
Space inserted after the dot in the version string breaks the reference. This should be '.${___X_CMD_VERSION_SUM8}' without a space to match the hidden directory naming convention. Remove the space.
| printf "___X_CMD_VERSION=%s\n" ".${___X_CMD_VERSION_SUM8}"; | ||
| printf ". \"\$___X_CMD_ROOT/v/%s/X\"\n" ".${___X_CMD_VERSION_SUM8}"; | ||
| printf "___X_CMD_VERSION=%s\n" ". ${___X_CMD_VERSION_SUM8}"; | ||
| printf ". \"\$___X_CMD_ROOT/v/%s/X\"\n" ". ${___X_CMD_VERSION_SUM8}"; |
There was a problem hiding this comment.
Multiple issues: space inserted after the dot in the source command ('. ' should be '.'), and space inserted in the version reference ('. ${...' should be '.${...'). Both break functionality. Remove both spaces.
fixed formatting error