From aa95c986646940a2a96c9f2c8ce360fbf8f915be Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 12 Feb 2026 17:36:49 +0000 Subject: [PATCH 1/6] Initial plan From 6bc44183bc69f52ffe7eb794ccc9f89063e2168f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 12 Feb 2026 17:39:24 +0000 Subject: [PATCH 2/6] Fix nightly build workflow by removing --clobber and adding deduplication Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com> --- .github/workflows/nightly.yml | 40 ++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 43a9adc4d..1ff12e741 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -706,15 +706,49 @@ jobs: GH_TOKEN: ${{ github.token }} run: | ls - find tmp -type f \( -name "*.zip" -o -name "*.whl" -o -name "*.tar.gz" -o -name "*.nupkg" -o -name "*.snupkg" \) > release_files.txt + find tmp -type f \( -name "*.zip" -o -name "*.whl" -o -name "*.tar.gz" -o -name "*.nupkg" -o -name "*.snupkg" \) -print0 > release_files.txt + + # Deduplicate files - keep only first occurrence of each basename + # Use NUL-delimited input/output to handle spaces in filenames safely + python3 << 'DEDUP_SCRIPT' + import sys + import os + + seen_basenames = set() + unique_files = [] + + # Read NUL-delimited input + with open("release_files.txt", "rb") as f: + content = f.read() + files = content.decode("utf-8").split("\0") if content else [] + + for filepath in files: + filepath = filepath.strip() + if not filepath: + continue + + basename = os.path.basename(filepath) + + # Keep only first occurrence of each basename + if basename not in seen_basenames: + seen_basenames.add(basename) + unique_files.append(filepath) + + # Write NUL-delimited output + with open("release_files_dedup.txt", "wb") as f: + f.write("\0".join(unique_files).encode("utf-8")) + DEDUP_SCRIPT + + # Convert NUL-delimited list to space-separated for gh command + # Use printf to safely handle filenames with spaces + RELEASE_FILES=$(cat release_files_dedup.txt | tr '\0' '\n' | grep -v '^$') gh release create Nightly \ --title "Nightly" \ --notes "Automated nightly build from commit ${{ github.sha }}" \ --prerelease \ --target ${{ github.sha }} \ - --clobber \ - $(cat release_files.txt | tr '\n' ' ') + $RELEASE_FILES publish-test-pypi: From c1603fc65a9e1f5d141a47caa8ff663821a94cd8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 12 Feb 2026 17:41:02 +0000 Subject: [PATCH 3/6] Improve file handling to properly handle special characters Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com> --- .github/workflows/nightly.yml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 1ff12e741..e774a9701 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -720,7 +720,8 @@ jobs: # Read NUL-delimited input with open("release_files.txt", "rb") as f: content = f.read() - files = content.decode("utf-8").split("\0") if content else [] + # Strip trailing NUL before splitting to avoid empty trailing element + files = content.decode("utf-8").rstrip("\0").split("\0") if content else [] for filepath in files: filepath = filepath.strip() @@ -736,19 +737,24 @@ jobs: # Write NUL-delimited output with open("release_files_dedup.txt", "wb") as f: - f.write("\0".join(unique_files).encode("utf-8")) + if unique_files: + f.write("\0".join(unique_files).encode("utf-8")) + f.write(b"\0") # Add trailing NUL for proper NUL-delimited format DEDUP_SCRIPT - # Convert NUL-delimited list to space-separated for gh command - # Use printf to safely handle filenames with spaces - RELEASE_FILES=$(cat release_files_dedup.txt | tr '\0' '\n' | grep -v '^$') + # Read files into bash array safely using NUL delimiter + declare -a FILES + while IFS= read -r -d $'\0' file; do + FILES+=("$file") + done < release_files_dedup.txt + # Create release with properly quoted file arguments gh release create Nightly \ --title "Nightly" \ --notes "Automated nightly build from commit ${{ github.sha }}" \ --prerelease \ --target ${{ github.sha }} \ - $RELEASE_FILES + "${FILES[@]}" publish-test-pypi: From a1f5016f02b4ef9870ca8d6a1e3c69af3203f1ec Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 12 Feb 2026 17:42:24 +0000 Subject: [PATCH 4/6] Add proper error handling for empty file list and preserve filepath integrity Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com> --- .github/workflows/nightly.yml | 40 +++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index e774a9701..be467bf3e 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -720,12 +720,14 @@ jobs: # Read NUL-delimited input with open("release_files.txt", "rb") as f: content = f.read() + + # Handle empty file case explicitly + if content.rstrip(b"\0"): # Strip trailing NUL before splitting to avoid empty trailing element - files = content.decode("utf-8").rstrip("\0").split("\0") if content else [] + files = content.decode("utf-8").rstrip("\0").split("\0") for filepath in files: - filepath = filepath.strip() - if not filepath: + if not filepath: # Skip empty strings continue basename = os.path.basename(filepath) @@ -735,7 +737,7 @@ jobs: seen_basenames.add(basename) unique_files.append(filepath) - # Write NUL-delimited output + # Write NUL-delimited output with trailing NUL with open("release_files_dedup.txt", "wb") as f: if unique_files: f.write("\0".join(unique_files).encode("utf-8")) @@ -743,18 +745,24 @@ jobs: DEDUP_SCRIPT # Read files into bash array safely using NUL delimiter - declare -a FILES - while IFS= read -r -d $'\0' file; do - FILES+=("$file") - done < release_files_dedup.txt - - # Create release with properly quoted file arguments - gh release create Nightly \ - --title "Nightly" \ - --notes "Automated nightly build from commit ${{ github.sha }}" \ - --prerelease \ - --target ${{ github.sha }} \ - "${FILES[@]}" + # Only if the deduplicated file list is not empty + if [ -s release_files_dedup.txt ]; then + declare -a FILES + while IFS= read -r -d $'\0' file; do + FILES+=("$file") + done < release_files_dedup.txt + + # Create release with properly quoted file arguments + gh release create Nightly \ + --title "Nightly" \ + --notes "Automated nightly build from commit ${{ github.sha }}" \ + --prerelease \ + --target ${{ github.sha }} \ + "${FILES[@]}" + else + echo "No files to release after deduplication" + exit 1 + fi publish-test-pypi: From 24d9a62356c2f4fb8ab7739f1265af1c8a2f2081 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 12 Feb 2026 17:43:37 +0000 Subject: [PATCH 5/6] Fix EOF handling in bash read and improve empty content detection Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com> --- .github/workflows/nightly.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index be467bf3e..d38bbd561 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -721,8 +721,8 @@ jobs: with open("release_files.txt", "rb") as f: content = f.read() - # Handle empty file case explicitly - if content.rstrip(b"\0"): + # Handle empty file case - check if there's meaningful content after removing NULs + if content.strip(b"\0"): # Strip trailing NUL before splitting to avoid empty trailing element files = content.decode("utf-8").rstrip("\0").split("\0") @@ -748,7 +748,8 @@ jobs: # Only if the deduplicated file list is not empty if [ -s release_files_dedup.txt ]; then declare -a FILES - while IFS= read -r -d $'\0' file; do + # Handle the case where read returns non-zero at EOF after successfully reading last entry + while IFS= read -r -d $'\0' file || [ -n "$file" ]; do FILES+=("$file") done < release_files_dedup.txt From 97bdef79b5fc298a8b465606e61b5542f9b0af82 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 12 Feb 2026 18:21:25 +0000 Subject: [PATCH 6/6] Replace Python deduplication script with shell commands Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com> --- .github/workflows/nightly.yml | 58 +++++++++-------------------------- 1 file changed, 15 insertions(+), 43 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index d38bbd561..2c044f856 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -710,56 +710,28 @@ jobs: # Deduplicate files - keep only first occurrence of each basename # Use NUL-delimited input/output to handle spaces in filenames safely - python3 << 'DEDUP_SCRIPT' - import sys - import os + declare -A seen_basenames + declare -a unique_files - seen_basenames = set() - unique_files = [] - - # Read NUL-delimited input - with open("release_files.txt", "rb") as f: - content = f.read() - - # Handle empty file case - check if there's meaningful content after removing NULs - if content.strip(b"\0"): - # Strip trailing NUL before splitting to avoid empty trailing element - files = content.decode("utf-8").rstrip("\0").split("\0") - - for filepath in files: - if not filepath: # Skip empty strings - continue - - basename = os.path.basename(filepath) - - # Keep only first occurrence of each basename - if basename not in seen_basenames: - seen_basenames.add(basename) - unique_files.append(filepath) - - # Write NUL-delimited output with trailing NUL - with open("release_files_dedup.txt", "wb") as f: - if unique_files: - f.write("\0".join(unique_files).encode("utf-8")) - f.write(b"\0") # Add trailing NUL for proper NUL-delimited format - DEDUP_SCRIPT - - # Read files into bash array safely using NUL delimiter - # Only if the deduplicated file list is not empty - if [ -s release_files_dedup.txt ]; then - declare -a FILES - # Handle the case where read returns non-zero at EOF after successfully reading last entry - while IFS= read -r -d $'\0' file || [ -n "$file" ]; do - FILES+=("$file") - done < release_files_dedup.txt + while IFS= read -r -d $'\0' filepath || [ -n "$filepath" ]; do + [ -z "$filepath" ] && continue + basename="${filepath##*/}" - # Create release with properly quoted file arguments + # Keep only first occurrence of each basename + if [ -z "${seen_basenames[$basename]}" ]; then + seen_basenames[$basename]=1 + unique_files+=("$filepath") + fi + done < release_files.txt + + # Create release with properly quoted file arguments + if [ ${#unique_files[@]} -gt 0 ]; then gh release create Nightly \ --title "Nightly" \ --notes "Automated nightly build from commit ${{ github.sha }}" \ --prerelease \ --target ${{ github.sha }} \ - "${FILES[@]}" + "${unique_files[@]}" else echo "No files to release after deduplication" exit 1