Fix a bug in swupd autoupdate --enabled. If the swupd autoupdate time unit
was already loaded with the status of 'active', the unit needs to be restarted
and not just started again.
Problem reported and fixed by Auke Kok <auke-jan.h.kok@intel.com>
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
Fix bug in v3.18.0. Autoupdate was disabled on systems because of an option
removed from configure.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
This release includes:
- Multiple fixes to memory leaks and invalid memory access
- Improvements in clean command, removing more unnecessary Manifests
- Adds new flags, keepcache, that keeps all staged cache after an update and
max-parallel-downloads (renamed from max-pack-parallel-downloads) that lets
user set the number of parallel downloads for packs and fullfiles.
- Major improvements in swupd test library. Porting to new testlib was
concluded and all tests from old library was ported.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
max-parallel-pack-downloads was renamed to max-parallel-downloads
and documentation needs to be fixed
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
read_versions is a function that attempts to read the current version
of the target system and the server version, but if there is an error
reading any of those values no action was performed so it was necessary
to validate these values wherever the function was being used,
duplicating code.
This commit adds a verification to make sure the current version of the
target system and the server version was able to be identified.
Closes#589
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
If the -t parameter is set for a given empty directory, then
the time queue will be empty causing that the TAILQ_FOREACH_REVERSE
macro segfaults.
The proposed solution is to check if the head is NULL at the beginning
of the print_time_stats function.
Fixes#600
Signed-off-by: Erich Cordoba <erich.cm@yandex.com>
Fixes#484
The manifest files with their hashes appended to the filename in the
cache are used internally to prevent swupd from re-calculating manifest
hashes every time they are opened. These should only persist for the
duration of the update and should not persist afterwards to prevent
root-priveleged owners from modifying internally-used data. This patch
causes swupd to remove them by default without having to pass --all. The
files will be automatically removed upon update.
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
When invoking swupd --version print more information about compile-time
configuration. This feature was requested after a bug was introduced to
an unreleased Clear Linux build when swupd was built with the wrong
format ID. This allows QA to determine exactly which compile-time
options were set during runtime without inspecting the binary.
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
After running an update, the state directory is cleaned up.
Sometimes it is useful to be able to peek at the state directory
after an update, this is specially true when testing updates,
this way tests can verify what manifests were downloaded during
the update.
This commit adds the --keepcache option to swupd update so it can
be used when writing tests for updates.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
Soon, a minversion header field will be included in the MoM. This change
updates the test library to add a minversion header field to MoMs and adds
functions to create a minversion update. Also, the skip-verified-fullfiles
test was replaced by the update-minversion test. The update-minversion test
verifies that unchanged files with a version bump caused by a minversion
update are skipped during an update.
Signed-off-by: John Akre <john.w.akre@intel.com>
This commit adds a couple of tests meant to validate adding bundles
using zero-packs or falling back to using full-files.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
The test library contains a few assertions meant to verify the
existence or non existence of files and directories. In the case
of swupd, it is sometimes common that these files can be in directories
that are not readable by non root users, which is the case of the state
directory.
This commit makes a change so these assertions use root for testing
the existence of these files and directories so we don't get false
positives in the tests.
The commit also adds one more env variable with the --keepcache
option so we can use it in tests that require the state directory
to be persisted.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
The old update and verify tests used the swupdlib.bash library that
was replaced by testlib.bash.
This commit replaces those old update and verify tests with new
versions of the same tests that now use testlib.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
The old search tests used the swupdlib.bash library that was
replaced by testlib.bash.
This commit replaces those old search tests with new versions
of the same tests that now use testlib.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
The old mirror tests used the swupdlib.bash library that was
replaced by testlib.bash.
This commit replaces those old mirror tests with new versions
of the same tests that now use testlib.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
The old hashdump tests used the swupdlib.bash library that was
replaced by testlib.bash.
This commit replaces those old hashdump tests with new versions
of the same tests that now use testlib.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
The old completion tests used the swupdlib.bash library that was
replaced by testlib.bash.
This commit replaces those old completion tests with new versions
of the same tests that now use testlib.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
The old checkupdate tests used the swupdlib.bash library that was
replaced by testlib.bash.
This commit replaces those old checkupdate tests with new versions
of the same tests that now use testlib.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
The old bundleremove tests used the swupdlib.bash library that was
replaced by testlib.bash.
This commit replaces those old bundleremove tests with new versions
of the same tests that now use testlib.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
The old bundlelist tests used the swupdlib.bash library that was
replaced by testlib.bash.
This commit replaces those old bundlelist tests with new versions
of the same tests that now use testlib.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
The old bundleadd tests used the swupdlib.bash library that was
replaced by testlib.bash.
This commit replaces those old bundleadd tests with new versions
of the same tests that now use testlib.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
When a user wants to print to the terminal from a test that
is using the bats framework, it is necessary to use file descriptor
3.
This commit provides a wrapper function called print so it is
easier for user to print to terminal from tests.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
When updating the manifest version we were replacing any line with the word
version to "version: new_version". This is a problem now that we are adding
a minversion field to the manifest. That could be a problem too when there
was a file named version.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
This release fixes 3 bugs:
- Error when downloading packs from a local mixer introduced by v3.17.14
- Bash autocomplete missing for mirror command
- Swupd wasn't returning the correct error code when a new include was
imported with errors.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
When downloading from file:// curl can process all reads and writes on the
first call of curl_multi_process() and then curl_multi_wait() will set numfds
to 0 and poll_fewer_than() will return without processing the download (i.e
extracting it).
Also change a bit the poll_fewer_than() to follow the timeout approach from the
official curl_multi_wait() example (https://curl.haxx.se/libcurl/c/multi-single.html).
Fixes#582
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
When adding included manifests during an update the add_subscriptions
function is used, this function returns a value of either add_sub_ERR=1,
or add_sub_BADNAME=4 when it fails to add a subscription, and the code
is currently considering any value > 0 to be a successful value.
This commit fixes the issue by making sure the add_subscriptions
function doesn't return a code of 1 or 4 which would mean it failed
adding a subscription.
This release adds support for using SSL client certificate if provided via
/etc/swupd/client.pem, it makes some updates to the swupd test library and
travis CI environment and makes a number of bug fixes:
- Memory managements improvements for swupd search
- No longer use network in swupd clean
- Temporarily disable parallel pack downloads due to timeout bug when
downloading large packs.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
This commit adds the iterative manifests (to-manifest) and the delta
manifest (from-manifest) when creating a bundle update. This manifests
should contain only those files that changed in the latest version.
Closes issue #557
Add parameter --max-parallel-pack-downloads to control the number
of packs to be downloaded in parallel. This is usefull if for some
reason the default value is too high or low for your configuration.
When downloading in parallel we may infer the minimum downloads in parallel
by using the maximum download value. The advantage of doing this is that
estimating a good value for this parameter can be confusing to users of the
API and it isn't something it's expected to be different from different
situations.
We are defining the max_xfer_bottom to (max_xfer / 2), so the number of
simultaneos downloads will always be a number between (max_xfer / 2)
and max_xfer.
There's a known issue (#562) when trying to download large files in parallel.
As a temporary fix, don't donwload packs in parallel, so we won't trigger this
problem.
According to manual unlink will return -1 on errors and set errno to error
code.
As in this point there's nothing we can do about a OOM error, just ignore it.
There are some cases in the library where sed or awk is used to find
certain lines within files. To match these lines we use a pattern.
In some cases this pattern should be anchored to the beginning of the
line, in case a string with that pattern appears in a file (for example
in a bundle manifest name) in the last field. This is unlikely, but
it's better to avoid unintentional matches.
When a user creates a new version in a test environment and uses
the -r option an updated version of the os-release and format files
are added to the files directory. This is useful for some tests
like update tests.
This commit adds a second step of adding the updated files to the
os-core bundle so it is easier to create updates. With this commit
if using the option -r it means the new version will include an
update to the os-core bundle.