Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/freebsd/poudriere.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan Drewery <bryan@shatow.net>2021-09-09 03:45:41 +0300
committerBryan Drewery <bryan@shatow.net>2021-09-09 03:55:18 +0300
commitde88d7acafac01b56f3e294cccbed5c66ae7addf (patch)
tree0deb5eebf8191f4113b4c570603751106d92db97
parentf86046082f8741693daf7ba7f7540de01c4bb6ce (diff)
distclean: Fix deleting from a corrupted list
This could have deleted valid files. Using awk(1) to dump the data was causing it to buffer up to the disk's blocksize. For tmpfs this is 4096 which for a port like multimedia/gstreamer1-plugins-rust was calling write(2) 5 times resulting in an intermixed corrupted list of files. By appending from inside of awk it ensures it flushes after each record. We could just fflush from in there, or avoid awk, or use stdbuf(1) as well. (cherry picked from commit fb8d95e3b01c774e4e0fdc205b0fad57851b3400)
-rwxr-xr-xsrc/share/poudriere/distclean.sh7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/share/poudriere/distclean.sh b/src/share/poudriere/distclean.sh
index f77163fc..68f23079 100755
--- a/src/share/poudriere/distclean.sh
+++ b/src/share/poudriere/distclean.sh
@@ -122,8 +122,11 @@ gather_distfiles() {
msg_verbose "Gathering distfiles for: ${originspec}"
- awk -v distdir="${DISTFILES_CACHE%/}" '/SIZE/ {print distdir "/" substr($2, 2, length($2) - 2)}' \
- "${distinfo_file}" >> ${DISTFILES_LIST}
+ # Append from inside awk to force line buffering
+ awk -v distdir="${DISTFILES_CACHE%/}" \
+ -v out="${DISTFILES_LIST}"
+ '/SIZE/ {print distdir "/" substr($2, 2, length($2) - 2) >> out}' \
+ "${distinfo_file}"
}
[ -d ${DISTFILES_CACHE:-/nonexistent} ] ||