Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 22 additions & 20 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
else

___x_cmd_inner_cd(){
command cd "$@" || return $?;
command cd "$@" || return $? ;
};

fi;
Expand All @@ -22,15 +22,15 @@

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" ;;

Copilot AI Jan 16, 2026

Copy link

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
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" ;;

Copilot AI Jan 16, 2026

Copy link

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
v*) url="$url/dist/${___X_CMD_VERSION}/allinone.tgz" ;;
*) url="$url/sum/${___X_CMD_VERSION}.tgz" ;;
*) url="$url/sum/${___X_CMD_VERSION}. tgz" ;;

Copilot AI Jan 16, 2026

Copy link

Choose a reason for hiding this comment

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

Space inserted before 'tgz' breaks the file extension. This malforms URLs, changing '.tgz' to '. tgz', which will cause download failures. Remove the space.

Copilot uses AI. Check for mistakes.
esac;

local target="$tmptgt/download_tmp.tgz";
[ ! -d "${tmptgt}" ] || {
local target="$tmptgt/download_tmp. tgz";

Copilot AI Jan 16, 2026

Copy link

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
[ ! -d "${tmptgt}" ] || {
___x_cmd_get_log "Folder already existed ==> There must be other process is installing x-cmd ==> $tmptgt";
return 1;
};
Expand All @@ -45,35 +45,35 @@
command wget -O "$target" "$url" 2>/dev/null;
fi || {
command rm -rf "$tmptgt";
___x_cmd_get_log "Fail to download from: $url";
___x_cmd_get_log "Fail to download from: $url";
exit 1;
};

___x_cmd_get_log "Download SUCCESS: $target ( size: $(command wc -c "$target" 2>/dev/null | command awk '{print ((int($1) + 1023 ) / 1024); }') KB )";
___x_cmd_get_log "Download SUCCESS: $target ( size: $(command wc -c "$target" 2>/dev/null | command awk '{print ((int($1) + 1023 ) / 1024); }') KB )";
command touch "$tmptgt/setup.log";
command tar vxf "$target" 2>>"$tmptgt/setup.log" 1>&2;
);
};

___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";

Copilot AI Jan 16, 2026

Copy link

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
[ ! -r "$sumfp" ] || . "$sumfp";

Copilot AI Jan 16, 2026

Copy link

Choose a reason for hiding this comment

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

Space inserted after the dot (source command) may cause shell syntax errors. The source command should be '. "$sumfp"' without a space between the dot and the argument. Remove the space.

Suggested change
[ ! -r "$sumfp" ] || . "$sumfp";
[ ! -r "$sumfp" ] || . "$sumfp";

Copilot uses AI. Check for mistakes.
[ -n "$___X_CMD_VERSION_SUM" ] || {
___x_cmd_get_log "Fail to get version sum from: $sumfp";
return 1;
};

___X_CMD_VERSION_SUM8="${___X_CMD_VERSION_SUM%"${___X_CMD_VERSION_SUM#????????}"}";
___X_CMD_VERSION_SUM8="${___X_CMD_VERSION_SUM%"${___X_CMD_VERSION_SUM#???????? }"}";

Copilot AI Jan 16, 2026

Copy link

Choose a reason for hiding this comment

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

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.

Suggested change
___X_CMD_VERSION_SUM8="${___X_CMD_VERSION_SUM%"${___X_CMD_VERSION_SUM#???????? }"}";
___X_CMD_VERSION_SUM8="${___X_CMD_VERSION_SUM%"${___X_CMD_VERSION_SUM#????????}"}";

Copilot uses AI. Check for mistakes.

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";

Copilot AI Jan 16, 2026

Copy link

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
command mkdir -p "$archivedir";
command mv -f "$target" "$archivefile";
___x_cmd_get_log "Archival SUCCESS: $target";

local sum8dir="$___X_CMD_ROOT/v/.${___X_CMD_VERSION_SUM8}";
[ ! -e "$sum8dir" ] || {
local sum8dir="$___X_CMD_ROOT/v/. ${___X_CMD_VERSION_SUM8}";

Copilot AI Jan 16, 2026

Copy link

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
[ ! -e "$sum8dir" ] || {
___x_cmd_get_log "Folder already existed ==> $sum8dir";
command rm -rf "${tmptgt}";
return 0;
Expand All @@ -91,8 +91,8 @@
command mkdir -p "$vpath";
(
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}";

Copilot AI Jan 16, 2026

Copy link

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
printf ". \"\$___X_CMD_ROOT/v/%s/X\"\n" ". ${___X_CMD_VERSION_SUM8}";

Copilot AI Jan 16, 2026

Copy link

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
) >"$vpath/X";
;;
*)
Expand All @@ -105,7 +105,8 @@
esac;
};

___x_cmd_get_bootinit()(
___x_cmd_get_bootinit(){
(
___X_CMD_ROOT_V_VERSION_TRICK_0_1="$___X_CMD_ROOT/v/${___X_CMD_VERSION_SUM}" \
___X_CMD_ROOT="$___X_CMD_ROOT" \
___X_CMD_VERSION="$___X_CMD_VERSION" \
Expand All @@ -120,7 +121,8 @@
[ -z "$___X_CMD_VERSION0" ] || ___X_CMD_VERSION="$___X_CMD_VERSION0";
___x_cmd boot init "$___X_CMD_ROOT" "$___X_CMD_VERSION";
';
);
)
};

___x_cmd_get_install(){
local ___X_CMD_ROOT="$1";
Expand All @@ -134,15 +136,15 @@

___x_cmd_get_download "$tmptgt" || return $?;
___x_cmd_get_populate "$tmptgt" || return $?;
___x_cmd_get_link || return $?;
___x_cmd_get_link || return $? ;
___x_cmd_get_bootinit
};

___x_cmd_get_start(){
local x_cmd_root="$1";
local x_cmd_version="$2";
if [ -n "$___X_CMD_XBINEXP_EXIT" ]; then
___x_cmd_get_log "This installation/upgrade is performed by an external call, so the interactive shell for the new version will not automatically open.";
___x_cmd_get_log "This installation/upgrade is performed by an external call, so the interactive shell for the new version will not automatically open. ";
elif [ -z "$___X_CMD_ROOT_MOD" ]; then
___X_CMD_ROOT_CODE=;
. "$x_cmd_root/X";
Expand Down
Loading