#22881 closed defect (bug) (duplicate)
upgrade fails when disk space is exhausted due to quotas
Reported by: | Owned by: | ||
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.4.2 |
Component: | Upgrade/Install | Keywords: | |
Focuses: | Cc: |
Description
The upgrade from wordpress 3.4.2 to 3.5 failed due to a disk space limitation:
Downloading update from http://wordpress.org/wordpress-3.5-new-bundled.zip… Unpacking the update… The package could not be installed.: PCLZIP_ERR_BAD_FORMAT (-10) : Unable to find End of Central Dir Record signature Installation Failed
A similar bug occurs if the space for the files themselves is exhausted. On the same installation, functions.php was truncated at 112k, leaving the installation in a non-functional state.
This kind of behaviour can be avoided with an upgrade function of the form:
# test for 64k free disk space ... dd if=/dev/zero of=biggish-test-file bs=1024 count=64 && rm biggish-test-file && wget -O - http://wordpress.org/latest.tar.gz | tar -zvx --strip-components=1
Streaming the download imposes no additional disk space requirements for the intermediate .zip file, but does require a change in the extraction code. Streaming an update cannot be done with zip files, since the index is at the end. ZIP files have to be complete, since the tag is at the end. 'tar' files are more suitable for streaming.
Change History (4)
#3
@
11 years ago
Incoming commit for a covering cases where the WP_Filesystem classes do not correctly check files are written properly.
Noting it here, the Filesystem classes will have issues with mbstring.func_overload
overloading strlen()
after this change. A follow up change will be required to cover that case.
A function i just spotted (that I wasn't aware actually worked cross-platform) is
disk_free_space()
which returns the number of KB's available in a specific directory. I have no idea if that respects user quota's or can be relied upon when a FS is remote.A patch on #16057 should prevent half-written-to-disk zip files attempting to be processed.