From e5531ff95b740bc3083410544b06caa4dd34ad28 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 14 Jan 2026 15:35:06 +0000 Subject: [PATCH 1/5] Initial plan From 238f9b39c52fad87bb51ffb137a891572827dd04 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 14 Jan 2026 15:39:57 +0000 Subject: [PATCH 2/5] Pin Oryx repository to commit before GetFileSize breaking change Co-authored-by: abdurriq <137001048+abdurriq@users.noreply.github.com> --- src/oryx/install.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/oryx/install.sh b/src/oryx/install.sh index cf67db6b1..20ed9c680 100755 --- a/src/oryx/install.sh +++ b/src/oryx/install.sh @@ -177,7 +177,12 @@ GIT_ORYX=/opt/tmp/oryx-repo mkdir -p ${BUILD_SCRIPT_GENERATOR} mkdir -p ${ORYX} -git clone --depth=1 https://github.com/microsoft/Oryx $GIT_ORYX +# Pin to commit before ISourceRepo.GetFileSize breaking change (2026-01-13) +# See: https://github.com/microsoft/Oryx/commit/21c559437d69cb43fd9b34f01f68c43ea4bce318 +git clone https://github.com/microsoft/Oryx $GIT_ORYX +cd $GIT_ORYX +git checkout 0243a804b56d92febdb15cab01f98bbb168baa3b +cd - if [[ "${PINNED_SDK_VERSION}" != "" ]]; then cd $GIT_ORYX From 71bc4e8ca2b163b6ea64006a62aa638d47fc35dc Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 14 Jan 2026 15:40:57 +0000 Subject: [PATCH 3/5] Improve maintainability by moving Oryx commit hash to variable at top of script Co-authored-by: abdurriq <137001048+abdurriq@users.noreply.github.com> --- src/oryx/install.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/oryx/install.sh b/src/oryx/install.sh index 20ed9c680..776e60373 100755 --- a/src/oryx/install.sh +++ b/src/oryx/install.sh @@ -9,6 +9,10 @@ USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}" UPDATE_RC="${UPDATE_RC:-"true"}" MICROSOFT_GPG_KEYS_URI="https://packages.microsoft.com/keys/microsoft.asc" +# Pin Oryx to a specific commit to avoid breaking changes +# Last stable commit before ISourceRepo.GetFileSize breaking change (2026-01-13) +# See: https://github.com/microsoft/Oryx/commit/21c559437d69cb43fd9b34f01f68c43ea4bce318 +ORYX_COMMIT="0243a804b56d92febdb15cab01f98bbb168baa3b" set -eu @@ -177,11 +181,9 @@ GIT_ORYX=/opt/tmp/oryx-repo mkdir -p ${BUILD_SCRIPT_GENERATOR} mkdir -p ${ORYX} -# Pin to commit before ISourceRepo.GetFileSize breaking change (2026-01-13) -# See: https://github.com/microsoft/Oryx/commit/21c559437d69cb43fd9b34f01f68c43ea4bce318 git clone https://github.com/microsoft/Oryx $GIT_ORYX cd $GIT_ORYX -git checkout 0243a804b56d92febdb15cab01f98bbb168baa3b +git checkout $ORYX_COMMIT cd - if [[ "${PINNED_SDK_VERSION}" != "" ]]; then From b25cf9f7d21185fe3a2d2134be5f56bcdee6535a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 14 Jan 2026 16:10:10 +0000 Subject: [PATCH 4/5] Apply patch to implement GetFileSize instead of pinning to old commit Co-authored-by: abdurriq <137001048+abdurriq@users.noreply.github.com> --- src/oryx/install.sh | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/src/oryx/install.sh b/src/oryx/install.sh index 776e60373..5d7153352 100755 --- a/src/oryx/install.sh +++ b/src/oryx/install.sh @@ -9,10 +9,6 @@ USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}" UPDATE_RC="${UPDATE_RC:-"true"}" MICROSOFT_GPG_KEYS_URI="https://packages.microsoft.com/keys/microsoft.asc" -# Pin Oryx to a specific commit to avoid breaking changes -# Last stable commit before ISourceRepo.GetFileSize breaking change (2026-01-13) -# See: https://github.com/microsoft/Oryx/commit/21c559437d69cb43fd9b34f01f68c43ea4bce318 -ORYX_COMMIT="0243a804b56d92febdb15cab01f98bbb168baa3b" set -eu @@ -181,10 +177,27 @@ GIT_ORYX=/opt/tmp/oryx-repo mkdir -p ${BUILD_SCRIPT_GENERATOR} mkdir -p ${ORYX} -git clone https://github.com/microsoft/Oryx $GIT_ORYX -cd $GIT_ORYX -git checkout $ORYX_COMMIT -cd - +git clone --depth=1 https://github.com/microsoft/Oryx $GIT_ORYX + +# Patch MemorySourceRepo to implement ISourceRepo.GetFileSize method +# This fixes a breaking interface change introduced in upstream Oryx +# See: https://github.com/microsoft/Oryx/commit/21c559437d69cb43fd9b34f01f68c43ea4bce318 +MEMORY_SOURCE_REPO_FILE="$GIT_ORYX/tests/Detector.Tests/MemorySourceRepo.cs" +if [ -f "$MEMORY_SOURCE_REPO_FILE" ]; then + # Add GetFileSize implementation before the GetGitCommitId method + sed -i '/public string GetGitCommitId()/i\ + public long? GetFileSize(params string[] paths)\ + {\ + var path = Path.Combine(paths);\ + if (!pathsToFiles.ContainsKey(path))\ + {\ + return null;\ + }\ + var content = pathsToFiles[path];\ + return content?.Length;\ + }\ +' "$MEMORY_SOURCE_REPO_FILE" +fi if [[ "${PINNED_SDK_VERSION}" != "" ]]; then cd $GIT_ORYX From 64d6e193dff8257cb208cd07e3c3ac0914098185 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 14 Jan 2026 16:11:53 +0000 Subject: [PATCH 5/5] Add verification and skip logic for GetFileSize patch Co-authored-by: abdurriq <137001048+abdurriq@users.noreply.github.com> --- src/oryx/install.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/oryx/install.sh b/src/oryx/install.sh index 5d7153352..06070027f 100755 --- a/src/oryx/install.sh +++ b/src/oryx/install.sh @@ -184,8 +184,11 @@ git clone --depth=1 https://github.com/microsoft/Oryx $GIT_ORYX # See: https://github.com/microsoft/Oryx/commit/21c559437d69cb43fd9b34f01f68c43ea4bce318 MEMORY_SOURCE_REPO_FILE="$GIT_ORYX/tests/Detector.Tests/MemorySourceRepo.cs" if [ -f "$MEMORY_SOURCE_REPO_FILE" ]; then - # Add GetFileSize implementation before the GetGitCommitId method - sed -i '/public string GetGitCommitId()/i\ + # Check if GetFileSize is already implemented + if ! grep -q "GetFileSize" "$MEMORY_SOURCE_REPO_FILE"; then + echo "Patching MemorySourceRepo to add GetFileSize implementation..." + # Add GetFileSize implementation before the GetGitCommitId method + sed -i '/public string GetGitCommitId()/i\ public long? GetFileSize(params string[] paths)\ {\ var path = Path.Combine(paths);\ @@ -197,6 +200,16 @@ if [ -f "$MEMORY_SOURCE_REPO_FILE" ]; then return content?.Length;\ }\ ' "$MEMORY_SOURCE_REPO_FILE" + + # Verify the patch was applied + if grep -q "GetFileSize" "$MEMORY_SOURCE_REPO_FILE"; then + echo "Successfully patched MemorySourceRepo" + else + echo "Warning: Failed to patch MemorySourceRepo - build may fail" + fi + else + echo "MemorySourceRepo already has GetFileSize implementation, skipping patch" + fi fi if [[ "${PINNED_SDK_VERSION}" != "" ]]; then