On 7/9/19 9:57 PM, Yardena Cohen wrote:
Sometimes makechrootpkg fails with:
rm: cannot remove '/logdest/logpipe.xxxxxxxx': No such file or directory
This shouldn't cause the whole script to fail, so let's tolerate a missing pipe
As a matter of curiosity, when does this happen? I don't recall offhand seeing it. I'm not saying it's fundamentally wrong to make this change, but I wouldn't have expected this to be a problem.
Signed-off-by: Yardena Cohen <yardenack@gmail.com> --- scripts/makepkg.sh.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index aa03e9d9..9f8c9096 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -344,7 +344,7 @@ remove_deps() {
error_function() { if [[ -p $logpipe ]]; then - rm "$logpipe" + rm -f "$logpipe"
If we just checked using [[ -p namedpipe ]] then it seems like the window for a TOCTOU is pretty narrow... Aside for which, if we've reached this point then we're already erroring out, so -f would only silence a warning, not make anything succeed. So this should not be what is causing the whole script to fail.
fi # first exit all subshells, then print the error if (( ! BASH_SUBSHELL )); then @@ -428,7 +428,7 @@ run_function() { $pkgfunc &>"$logpipe"
wait $teepid - rm "$logpipe" + rm -f "$logpipe"
I'm curious under what situation we could tee to a file, wait until tee exits, and then try but fail to delete the file. IIRC the only times we use run_function() are inside run_function_safe() which sets up errexit, so if this fails then that would explain why the script would abort, but I don't get how the file is supposed to disappear in the first place.
else "$pkgfunc" fi
-- Eli Schwartz Bug Wrangler and Trusted User