mirror of
https://github.com/Z3Prover/z3
synced 2026-04-30 23:53:44 +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:
parent
d1146a74c0
commit
6b5f7b21e6
1 changed files with 12 additions and 6 deletions
18
.github/workflows/nightly.yml
vendored
18
.github/workflows/nightly.yml
vendored
|
|
@ -720,7 +720,8 @@ jobs:
|
||||||
# Read NUL-delimited input
|
# Read NUL-delimited input
|
||||||
with open("release_files.txt", "rb") as f:
|
with open("release_files.txt", "rb") as f:
|
||||||
content = f.read()
|
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:
|
for filepath in files:
|
||||||
filepath = filepath.strip()
|
filepath = filepath.strip()
|
||||||
|
|
@ -736,19 +737,24 @@ jobs:
|
||||||
|
|
||||||
# Write NUL-delimited output
|
# Write NUL-delimited output
|
||||||
with open("release_files_dedup.txt", "wb") as f:
|
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
|
DEDUP_SCRIPT
|
||||||
|
|
||||||
# Convert NUL-delimited list to space-separated for gh command
|
# Read files into bash array safely using NUL delimiter
|
||||||
# Use printf to safely handle filenames with spaces
|
declare -a FILES
|
||||||
RELEASE_FILES=$(cat release_files_dedup.txt | tr '\0' '\n' | grep -v '^$')
|
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 \
|
gh release create Nightly \
|
||||||
--title "Nightly" \
|
--title "Nightly" \
|
||||||
--notes "Automated nightly build from commit ${{ github.sha }}" \
|
--notes "Automated nightly build from commit ${{ github.sha }}" \
|
||||||
--prerelease \
|
--prerelease \
|
||||||
--target ${{ github.sha }} \
|
--target ${{ github.sha }} \
|
||||||
$RELEASE_FILES
|
"${FILES[@]}"
|
||||||
|
|
||||||
|
|
||||||
publish-test-pypi:
|
publish-test-pypi:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue