This release adds a free-disk-space check invoked before adding new
bundles to the client system. An error will be printed if there is not
enough space for the bundle-add and the bundle-add will fail. This check
can be overridden with the --skip-diskspace-check flag.
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
Prevoiusly, when running bundle-add there was no check in
place to verify free storage before attempting to add the
new bundle.
Added this check, a warning message, and a flag to ignore
the message if desired.
related to issue #266
V2: Fixed many issues issues from review.
V3: Removed recursive size function, removed extra files,
reverted search.c.
V4: Forgot to run 'git compliant', did so and added the
changes.
Signed-off-by: Brian J Lovin <brian.j.lovin@intel.com>
This release fixes a bug that made it impossible for users to migrate
back to upstream when a mixer state file exists, improved delta
application failure messaging, and added functionality to clean the
swupd cache after completing an update. Return-code documentation was
also added to the swupd man page.
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
Separate the main statedir clean functionality into a callable function
and call it after performing an update. This helps clean up unused
files that bloat the state directory on a regular basis and helps
prevent the state directory from getting into a weird state over
updates.
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
When delta application failed due to swupd being unable to calculate the
hash of the from file or a hash-mismatch against what was expected print
an error message that indicates there is a corrupted file.
Fixes#469
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
When the version the user is fixing to is different from the version
they are on disable checks for mixer state on the system. This allows
users on local mixes to easily migrate back to the upstream update
stream. It also means users are not able to fix to another version
within their own mix.
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
This release allows non-root users to run the base bundle-list command,
makes bundle-add and bundle-remove output consistent, and fixes several
memory management issues in the codebase.
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
In systems where sizeof(long long int) > sizeof(int) we could have an
integer overflow in the function get_version_from_path().
Also fixing a memory leak of variable ret_str.
Instead of checking if server supports resume for every execution
that uses the network, do it only when resume is going to be used
Fixes one of the problems cited on #432
When resuming a download, we need to open the file to append data.
Previous code was opening it using write mode and all data already
dowloaded was lost and the final file was corrupted
The operations have different command result output styles. Also,
in particular bundle-remove error is a bit redundant.
This commit changes the messages displayed by the bundle-add and
bundle-remove functions so they have consistent messages for their
corresponding operations.
Fixes#475
There is a bug that causes the install operation to abort when
trying to install multiple bundles and at least one is invalid.
This commit fixes the issue so if other bundles are valid they
get installed.
As /usr/share/clear/bundles has read permissions for everyone, we can
let regular users to run "swupd bundle-list". If a path_prefix is
informed and the user don't have access to it, it will fail printing
an error message.
This release adds a file to the ignore list for hash comparisons during
migrating to a local mix due to that file being modified by the mix
itself (in an expected manner). This release also adds an up-to 10x
improvement for bundle-adds of small bundles and bundles where most of
the content is already on the system.
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
Make test-bundle1 an 11-file bundle so that zero-pack downloads are
turned on for the operation, thus testing the zero-pack codepath.
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
Local testing with some small bundles shows that bumping the fullfile
download minimum to 10 still yields much faster results than downloading
the zero pack. 10 is a more realistic heuristic.
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
for error recovery, bundle-add needs to read all currently installed manifests
and consolidate them into the normal tree.
currently, bundle-add does this always, even for the common case of no errors.
this patch turns this around and does this work lazily once the first
error is encountered.
There are some cases where do_staging() is ok to be called without
having a full MoM for performance reasons (e.g. in bundle_add
where alternative recovery is in place)
With overlapping bundle-content, it's not entirely uncommon for files
that are in a newly added bundle to already exist on the system.
This patch optimizes this case by removing these from the files that need
to be installed.
In addition, if after this filter step, there's less than 5
(number to be tuned) files to install left, skip downloading the pack
for the bundle and just grab the full files directly.
Mixin re-creates the os-core bundle when creating a local mix. This
causes the corresponding os-core-update-index bundle-info file to have
changes to the metadata listed inside. Treate this as mixin state and do
not check hashes for this file.
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
This release make several bug fixes and implementation improvements as
listed below:
* Fix memory leak on subscription list
* Add missing --nosigcheck option to search subcommand
* Better memory management in some codepaths
* Report missing packs to telemetry (when user is opted-in)
* Unused/commented-out code removed from codebase
* Improve the internal swupd_curl API, including making it more usable
and performing better memory management.
* Remove content when running swupd clean and only keep manifests around
* Add fullfile fallback to bundle-add code.
* Refactor bundle-remove to properly remove multiple bundles.
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
In order to avoid the need to dereference *bundles all the time
another variable was added.
The check about making sure the bundle to be removed is not os-core
was moved before the message "Removing bundle: <bundle>" to avoid
confusions.
When 1 or more bundles fail to be removed from the system a message
was being displayed, a message that looked like this:
"1 bundle(s) of 2 failed to remove"
This commit changes that message so it uses pasive voice, like this:
"1 bundle(s) of 2 failed to be removed"
The current remove_bundle() function was designed to only be called
once, but for multiple bundle removals, it is currently called
multiple times.
This commit refactors this function so the bundle removal code can
handle multiple bundles at once.
Fixes#449
Use fullfile_download to download full files from server if a pack
download has failed or if the file is missing/corrupted in a pack.
Verify --install wasn't checking if the content of the downloaded
files match the hash in the manifest. As the fullfile download
function check that, the hashes in some tests needed to be fixed.
Use download_fullfiles() instead of reimplementing it on
full_download_loop().
Tests:
- Test skip-verified-fullfiles was alterered because in the current
implementation start_full_download() won't be called when there's no
extra file to download.
Moving the fullfile fallback to a single file and exporting it in
swupd.h in order to be reused on update and bundle add.
Tests:
- Changing verify tests becase download function won't be called when
there's no file to be downloaded
Checking for hashes inside the download function was out of scope
and made the function harder to be reused. Instead, check if hashes
matches the files in the system before calling the download function,
so only necessary files will be downloaded.
There's no way to inforce braces on single line ifs using clang-format.
Adding a grep to look for ifs without a bracket so we can at least
warn users about that.