3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-02-14 04:41:48 +00:00

Improve file handling to properly handle special characters

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-02-12 17:41:02 +00:00
parent 6bc44183bc
commit c1603fc65a

View file

@ -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: