Pkg install error handling and connect timeout RELENG_2_2
Fixes Redmine #4884 1) Line 778-780 - If the fetch of any of the package additional files fails then bail out. This prevents half-installed packages that look like they had a successful install. 2) Line 1458 - use the return boolean value from download_file_with_progress_bar() to determine success or failure here, like is done in the other places in this file. I had a case of installing a package with an error (timeout) and the download (I presume it was the download code) had left an empty file /usr/local/pkg/autoconfigbackup.xml - it passed the file_exists() check and the rest of the code went on to happily install the "nothing" in the package and then claim the package was successfully installed :( After the above 2 changes I could get reliable indication of success/failure of the package install and the code would abort nicely if a download went wrong. 3) Package installs happen either: i) On the end of a boot after upgrade or config restore, or; ii) Online while the main system is running (happily) Therefore there is no need to rush to abort if the download of a package file is taking some time to get started. It seems better to me to wait a decent amount of time rather than abort. Thus I have increased the connect timeout for this from the default (5) to 30 seconds. This makes my crap sites load packages much better :)
Related issues
Bug #4884: Pkg install additional files can fail but instllation does not abort
Pkg install error handling and connect timeout RELENG_2_2
Fixes Redmine #4884
1) Line 778-780 - If the fetch of any of the package additional files
fails then bail out. This prevents half-installed packages that look
like they had a successful install.
2) Line 1458 - use the return boolean value from
download_file_with_progress_bar() to determine success or failure here,
like is done in the other places in this file. I had a case of
installing a package with an error (timeout) and the download (I presume
it was the download code) had left an empty file
/usr/local/pkg/autoconfigbackup.xml - it passed the file_exists() check
and the rest of the code went on to happily install the "nothing" in the
package and then claim the package was successfully installed :(
After the above 2 changes I could get reliable indication of
success/failure of the package install and the code would abort nicely
if a download went wrong.
3) Package installs happen either:
i) On the end of a boot after upgrade or config restore, or;
ii) Online while the main system is running (happily)
Therefore there is no need to rush to abort if the download of a package
file is taking some time to get started. It seems better to me to wait a
decent amount of time rather than abort.
Thus I have increased the connect timeout for this from the default (5)
to 30 seconds.
This makes my crap sites load packages much better :)