New trap behavior broke incomplete downloads
konimex opened this issue · 6 comments
When downloading a file is interrupted, the offending file normally is removed. However, since certain versions, it no longer removes the incomplete file when the interruption happens, resulting in checksum mismatch.
After bisecting, I found bdd95ba to break the old behavior.
Indeed indeed...
The difference is...
{old}
-> llvm Downloading https://github.com/llvm/llvm-project/archive/llvmorg-12.0.0.tar.gz
+ mkdir -p /home/dilyn/.cache/kiss/sources/llvm/
+ curl https://github.com/llvm/llvm-project/archive/llvmorg-12.0.0.tar.gz -fLo ././llvmorg-12.0.0.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 133 0 133 0 0 540 0 --:--:-- --:--:-- --:--:-- 540
54 128M 54 70.0M 0 0 19.8M 0 0:00:06 0:00:03 0:00:03 23.3M^C+ pkg_clean
+ [ = 1 ]
+ rm -rf /tmp/19130
+ rm -f ././llvmorg-12.0.0.tar.gz
+ die llvm Failed to download https://github.com/llvm/llvm-project/archive/llvmorg-12.0.0.tar.gz
+ log llvm Failed to download https://github.com/llvm/llvm-project/archive/llvmorg-12.0.0.tar.gz ERROR
+ printf %b%s %b%s%b %s\n \033[1;33m ERROR \033[m\033[1;34m llvm \033[m Failed to download https://github.com/llvm/llvm-project/archive/llvmorg-12.0.0.tar.gz
ERROR llvm Failed to download https://github.com/llvm/llvm-project/archive/llvmorg-12.0.0.tar.gz
+ exit 1
+ pkg_clean
+ [ = 1 ]
+ rm -rf /tmp/19130
{new}
-> llvm Downloading sources
+ mkdir -p /home/dilyn/.cache/kiss/sources/llvm
+ cd /home/dilyn/.cache/kiss/sources/llvm
+ read -r src dest
+ [ -z https://github.com/llvm/llvm-project/archive/llvmorg-12.0.0.tar.gz ]
+ [ -z https://github.com/llvm/llvm-project/archive/llvmorg-12.0.0.tar.gz ]
+ [ -f ././llvmorg-12.0.0.tar.gz ]
+ [ -z ]
+ log llvm Downloading https://github.com/llvm/llvm-project/archive/llvmorg-12.0.0.tar.gz
+ printf %b%s %b%s%b %s\n \033[1;33m -> \033[m\033[1;34m llvm \033[m Downloading https://github.com/llvm/llvm-project/archive/llvmorg-12.0.0.tar.gz
-> llvm Downloading https://github.com/llvm/llvm-project/archive/llvmorg-12.0.0.tar.gz
+ mkdir -p /home/dilyn/.cache/kiss/sources/llvm/
+ curl https://github.com/llvm/llvm-project/archive/llvmorg-12.0.0.tar.gz -fLo ././llvmorg-12.0.0.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 133 100 133 0 0 527 0 --:--:-- --:--:-- --:--:-- 527
100 3542k 0 3542k 0 0 2426k 0 --:--:-- 0:00:01 --:--:-- 3556k^C+ pkg_clean
+ [ = 1 ]
+ rm -rf /tmp/16979
+ exit 1
+ pkg_clean
+ [ = 1 ]
+ rm -rf /tmp/16979
I've been on a micro vacation but will take a look at this Tuesday night/Wednesday.
Do we need an easier way to manage trap states? To my mind there are only two cases; kiss d|c
and kiss b|i
. Can we not just add a pkg_clean
to line 224?
Most of the time you want the package manager to cleanup and exit immediately, and sometimes you don't.
I was wondering about reasons why we don't want to exit immediately but haven't dug deep enough yet. Would be nice if you could elaborate.
@dilyn-corner fyi, I sent a patch to the mailing list.
@aaronNGi Well, I can't think of a reason apart from this download case here, but there might be other issues that we just haven't spotted yet. For the issue here, we have a separate cleanup process if the download is interrupted, and we simply can't run that if we exit immediately.
This exact problem would apply to other areas we might want to specially handle fails, maybe we haven't noticed because curl
is much likelier to be interrupted by the user.
This has been fixed edfb25a Thanks Cem :)