724 Commits
Author SHA1 Message Date
Matthew Johnson 206df7b3de Release v3.17.8
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>
v3.17.8
2018-06-29 08:38:04 -07:00
Brian J Lovin a77cbee6da Add free space check before adding bundles
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>
2018-06-29 08:23:52 -07:00
Matthew Johnson 16bf961c00 Release v3.17.7
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>
v3.17.7
2018-06-18 16:14:55 -07:00
Matthew Johnson eef2a4f5f8 clean: separate into callable function and use in update
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>
2018-06-18 16:09:42 -07:00
Matthew Johnson 5f39d1e86e manpages: add return-code documentation
Additionally remove the unused EPREP_MOUNT error code.
Fixes #296

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2018-06-18 10:50:40 -07:00
Matthew Johnson ec4f9e40cc delta: improve delta failure message
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>
2018-06-18 09:15:00 -07:00
Matthew Johnson e4c636a200 verify: Ignore mix state when fixing to version
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>
2018-06-15 16:32:10 -07:00
Matthew Johnson 89f199ef5e Release v3.17.6
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>
v3.17.6
2018-06-15 12:05:47 -07:00
Matthew Johnson eec6e4a9a0 Fix up code style
Style issue identified via 'make compliant'

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2018-06-14 15:11:55 -07:00
Otavio Pontes 38b9272caa manifest: Fix memory leak - Manifest data was not freed on errors 2018-06-14 15:01:23 -07:00
Otavio Pontes 23697b6bb8 search: Fix memory leak - lists and data were not freed 2018-06-14 15:01:23 -07:00
Otavio Pontes 18835bb09d bundle: Fix memory leak - data from list was not freed 2018-06-14 15:01:23 -07:00
Otavio Pontes 6d0523d9e5 Fix string memory leaks
Fixing some string memory leaks on:
 - bundle
 - helpers
 - manifest
 - packs
 - verify
2018-06-14 15:01:23 -07:00
Otavio Pontes 8b63972c89 globals: Fix integer overflow error and memory leak
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.
2018-06-14 15:01:23 -07:00
Otavio Pontes c0229ef92d manifest: Removing unecessary check
alloc_manifest() aborts when manifest allocation fails, so the result
will never be NULL
2018-06-14 15:01:23 -07:00
Otavio Pontes 6c03e883f3 test: Remove debug leftovers 2018-06-14 13:04:31 -07:00
Otavio Pontes 93f24604de bundle-add: Use download resume on bundle-add too
There's no reason to support pack resume on bundle-add
2018-06-14 13:04:31 -07:00
Otavio Pontes 573427039a test: Check if the download resume check is working
It would be great to have in the future a server implemetation with support
to resume downloads to check if the feature is really working.
2018-06-14 13:04:31 -07:00
Otavio Pontes 9dce69bd09 curl: Check if resume is supported only when needed
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
2018-06-14 13:04:31 -07:00
Otavio Pontes 15d86581bb download: Resume was corrupting the downloaded file
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
2018-06-14 13:04:31 -07:00
Castulo Martinez 81d616b605 Be consistent in bundle-add/remove error messages
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
2018-06-13 14:47:36 -07:00
Castulo Martinez f98a578fb2 Fixes an issue attempting to add multiple bundles
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.
2018-06-13 14:47:36 -07:00
Otavio Pontes d5e8f1300c bundle-list: Let any user to run swupd bundle-list
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.
2018-06-13 09:23:46 -07:00
Matthew Johnson 5d4112a5cd Release v3.17.5
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>
v3.17.5
2018-06-12 13:32:44 -07:00
Matthew Johnson 8bdb4e6c0a Add brackets around single-line if
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2018-06-12 13:28:02 -07:00
Matthew Johnson 5890bc6b78 tests: larger bundle to force zero pack download
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>
2018-06-12 13:28:02 -07:00
Matthew Johnson f0a50295b7 bundle-add: bump fullfile minimum to 10
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>
2018-06-12 13:28:02 -07:00
Matthew Johnson 556813ee7a Fix code style
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2018-06-12 13:28:02 -07:00
Matthew Johnson 73537e7775 tests: uncomment fullfile tar creation 2018-06-12 13:28:02 -07:00
Matthew Johnson 58f80eb5b5 tests: fix tests for bundle-add fullfile downloads
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2018-06-12 13:28:02 -07:00
Arjan van de Ven 07ab12302f fix relative path 2018-06-12 13:28:02 -07:00
Arjan van de Ven 6b8397dee3 Optimize bundle-add by not reading all manifests for the common case
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.
2018-06-12 13:28:02 -07:00
Arjan van de Ven 1bab2b2748 Allow do_staging() to be called with a NULL MoM
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)
2018-06-12 13:28:02 -07:00
Arjan van de Ven c93aea46e0 Optimize bundle-add to only install files that don't yet exist
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.
2018-06-12 13:28:02 -07:00
Otavio Pontes 2f444dc7f6 fullfile: Fix double free
String that is reused later shoudn't be freed.

Fix double free reported on issue #480
2018-06-12 11:29:57 -07:00
Matthew Johnson 9790937402 Add os-core index to mixin state
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>
2018-06-12 11:29:35 -07:00
Matthew Johnson 3fbd376579 Release v3.17.4
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>
v3.17.4
2018-06-08 10:51:22 -07:00
Castulo Martinez e388674a94 Renaming variable for consistency
Renaming a variable from camel case to snake case to keep
consistency with the project.
2018-06-08 10:49:21 -07:00
Castulo Martinez 1dc830fa57 Store the bundle to be removed in a variable
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.
2018-06-08 10:49:21 -07:00
Castulo Martinez 006e29b565 Removing unnecessary curopts struct
The curopts struct is no longer being used to save parsed options
when using the bundle-remove command so it can be removed from the
code.
2018-06-08 10:49:21 -07:00
Castulo Martinez f49fb714fe Fixing typo in remove bundle message
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"
2018-06-08 10:49:21 -07:00
Castulo Martinez 71a2a4cb0e Refactor bundle-remove to handle multiple bundles
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
2018-06-08 10:49:21 -07:00
Otavio Pontes b0911b3f0a Verify --install: Download full files if pack download fails
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.
2018-06-08 10:43:09 -07:00
Otavio Pontes c7c224de47 Bundle-add: Download full files if pack download fails or has problems
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.
2018-06-08 10:43:09 -07:00
Otavio Pontes 9648035803 Update: Use consolidated version of fullfiles download
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.
2018-06-08 10:43:09 -07:00
Otavio Pontes 660537d36f Verify: Consolidate download fullfile fallback to be reused
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
2018-06-08 10:43:09 -07:00
Otavio Pontes 6a51b2e451 Verify: Remove file hash comparison from download function
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.
2018-06-08 10:43:09 -07:00
Caio Marcelo de Oliveira Filho c773afc6e6 clean: do not keep content around
Instead of keeping recent content around, just delete all the files,
with exception of the latest relevant Manifests.
2018-06-08 10:37:15 -07:00
Otavio Pontes 2284ebb6f4 Fix missing brackets on single line ifs 2018-06-08 10:21:52 -07:00
Otavio Pontes b13e4ae189 compliant: Enforce braces on single line ifs
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.
2018-06-08 10:21:52 -07:00