commit | 5d9302860ff4b064ae09bb91683cb7fa00ba7450 | [log] [tgz] |
---|---|---|
author | Lei YU <mine260309@gmail.com> | Fri Mar 08 16:41:51 2019 +0800 |
committer | Lei YU <mine260309@gmail.com> | Tue Apr 02 10:32:49 2019 +0800 |
tree | f20a0f3293ecdc13f61b1bf2e5a90f31b6658e7d | |
parent | ab8231c66364286a10b0da6d64d9742752323b4d [diff] |
Refactor: only untar once The code in processImage() execute "tar xf" twice, the first time to extract the MANIFEST, and the second time to extract the whole tarball. On a tarball without compression, it's OK. But if the tarball is compressed, it takes much longer time to de-compress the tarball for twice. This commit changes the behavior by: 1. Untar the whole tarball into a temp dir; 2. Parse the manifest as before; 3. If something is wrong, remove the temp dir as before; 4. If it's valid, rename the temp dir to the valid image dir. It also fixes an issue that it uses const_cast in mkdtemp, which is undefined behavior because the returned const char* shall be read-only, writing this memory could cause undefined behavior. Partially resovles openbmc/bmcweb#60 Tested: Verify the image upload works well, and it takes much less time on a gzip compressed tarball. Change-Id: I0af81acbd948e9c54d5d168c9f72e8ebbf8daebe Signed-off-by: Lei YU <mine260309@gmail.com>
Phosphor BMC Code Management provides a set of system software management applications. More information can be found at Software Architecture
To build this package, do the following steps: 1. ./bootstrap.sh 2. ./configure ${CONFIGURE_FLAGS} 3. make To clean the repository run `./bootstrap.sh clean`.