1895 Commits
Author SHA1 Message Date
Otavio Pontes 518f9aeab8 Release v3.24.4
Enhancements
 - 3rd-party: Export XDG_DATA_DIRS and XDG_CONF_DIRS in binary wrapper
 - 3rd-party: always recreate the binary if a binary is updated
 - 3rd-party: repair regenerate all binary wrappers
 - Make it mandatory to have a signature for latest file
 - Add flag --nosigcheck-latest to proceed with update without checking the signature of latest file, but still checking the signature of Manifests.
 - Better warning messages for --nosigcheck flags
 - Don't print double slashes for paths in any message
 - Add a --force option to swupd 3rd-party add to proceed even when errors found
 - Mixin tool deprecated
 - Don't try resume downloads if server respond with incorrect range error

Bug Fixes:
 - When checking latest version signature, don't consider it invalid if server can't respond file size
 - If delta manifests are valid but generating an invalid manifest, download the full manifest again
 - Fix problem that caused Getcwd errors to be warned when swupd was run in an invalid directory
 - Some files could be removed when a directory was renamed to a symlink in an update

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
v3.24.4
2020-04-07 09:31:01 -07:00
Otavio Pontes fbc90a0c87 mirror: Warning message should be printed only when theres' no default url
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-06 14:57:18 -07:00
Castulo Martinez 449cde45c5 Bug_fix: Check if directory is absolute, not file
During staging, if a file is marked for deletion, and the path to
the file, or the file istelf is a simlink, then it is not removed. This
is incorrect, if the file itself is a symlink it is fine to remove it,
the only case when it should not be removed is when the path to it
contain a symlink.

Closes #1424

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-06 14:45:17 -07:00
Castulo Martinez 609d785f37 BUG_FIX Don't follow links removing during staging
When during an update a directory was removed and replaced by a symlink
to another directory that contains one or more files with the same name
as files in the directory that was removed, swupd will remove the
directory from the target system and then it will try to remove each one
of the files that were contained in the directory. Since the directory is
now a symlink to another existing directory, it may end up deleting the
files from the other directory. swupd should not follow links when
removing files during the staging process.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-06 14:44:18 -07:00
Castulo Martinez 3a5cdad882 Test: Adding test cases to cover file type changes
Adding test scenarions fo file type changes:
 - from file -> symlink
 - from file -> recursive symlink
 - from directory -> symlink
 - from symlink -> file
 - from symlink -> directory
 - from file -> directory
 - from directory -> file

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-06 14:44:15 -07:00
Otavio Pontes f6ae8675ff Revert "Test: Adding test cases to cover file type changes"
This reverts commit 2989f8a7f5.
2020-04-06 10:24:48 -07:00
Otavio Pontes 5ef7670718 Revert "BUG_FIX Don't follow links removing during staging"
Commit caused some files not to be deleted on updates. Waiting for a fixed
version of patch.

This reverts commit b02a3a3ed7.
2020-04-06 09:40:41 -07:00
Castulo Martinez 8d15b4dc56 Testlib: do not print the result of openssl
When generating the certificate for tests, openssl is printing messages
to the terminal, we are already selecting what to print by using the
debug_msg() function, so these unwanted messages shouldnot be printed.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-03 08:09:04 -07:00
Otavio Pontes 6def37a640 tests: Add script to validate if we are using one function we want to avoid
There are some functions we decided to avoid using, so add a test to make
sure we won't add them by accident.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-02 12:17:54 -07:00
Otavio Pontes a0ca9e5c97 Prefer strtok_r() istead of strtok()
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-02 12:17:54 -07:00
Otavio Pontes cf009d24dd helpers: Prefer str_or_die() than other printf methods.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-02 12:17:54 -07:00
Otavio Pontes 35a91aa8cf string: Protect strlen for overflowing by using strnlen
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-02 12:17:54 -07:00
Otavio Pontes 3338c2a758 log: Prefer vasprintf instead of vsnprintf
vasprintf is already used by other string functions, so create a base
function to be reused and make a copy for log.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-02 12:17:54 -07:00
Otavio Pontes 19c4dbb6d6 verifytime: Adding more lib dependencies to verifytime
As there are more string functions that will be needed by log and
verifytime and it would be impractical to copy everything, prefering
to include more dependencies instead.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-02 12:17:54 -07:00
Otavio Pontes ccd57aa794 Don't redifine a standard const
PATH_MAX is already defined by the system, so don't redefine it

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-02 12:17:54 -07:00
Castulo Martinez 950478729d Fix memory leak during do_staging()
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-02 12:17:37 -07:00
Otavio Pontes 956822ad78 test: Repo add certificate test was not removing installed files in the system
We need to install/uninstall on test_setup, not global_setup because env
variables are not preserved between tests

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-02 10:35:54 -07:00
Otavio Pontes 79d0c712aa testlib: Generate swupd certificates for each test to be execute
Instead of requiring an external script (.prereq) to generate the certificates
we can regenerate them before running each test.

Also removes completly the .prereq script

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-02 10:35:54 -07:00
Castulo Martinez b02a3a3ed7 BUG_FIX Don't follow links removing during staging
When during an update a directory was removed and replaced by a symlink
to another directory that contains one or more files with the same name
as files in the directory that was removed, swupd will remove the
directory from the target system and then it will try to remove each one
of the files that were contained in the directory. Since the directory is
now a symlink to another existing directory, it may end up deleting the
files from the other directory. swupd should not follow links when
removing files during the staging process.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-02 10:11:10 -07:00
Castulo Martinez 2989f8a7f5 Test: Adding test cases to cover file type changes
Adding test scenarions fo file type changes:
 - from file -> symlink
 - from file -> recursive symlink
 - from directory -> symlink
 - from symlink -> file
 - from symlink -> directory
 - from file -> directory
 - from directory -> file

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-02 10:11:10 -07:00
Castulo Martinez 238e7d8fe4 Testlib: keep the current status on type change
When updating a bundle using testlib, if the file is updated, and the
update includes a file type change, testlib was updating the manifest
with the correct type but was overwriting the other status flags, so if
a file was marked as 'x' (exported) before, that flag was being removed.

This commit fixes the issue by only updating the flag that relates to
the file type.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-02 08:00:30 -07:00
Castulo Martinez c40b7b094b 3rd-party: repair regenerates scripts of binaries
During a 3rd-party repair, the wrapper scripts of all binaries verified
should be regenerated regardless of if the binary was repaired or not.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-01 14:37:50 -07:00
Castulo Martinez 20912f8a95 3rd-party: updated binaries need new scripts
When updating a 3rd-party bundle, if any of its binaries is modified,
or the binary is new swupd needs to recreate the wrapper script.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-01 14:37:50 -07:00
Otavio Pontes bbd40948a3 Makefile: System tests should be run in serial
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-01 13:30:37 -07:00
Castulo Martinez 5ab3b8b9e9 Testlib: add function to print the test target fs
When running tests sometimes is useful to see how the filesystem of the
test target system looks like before and after a test. This commit adds
a function to show that chroot fs in a tree view, and it calls that
function in the setup and teardown of tests if DEBUG_TESTS is set.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-01 13:28:20 -07:00
Castulo Martinez 6f86afbfa3 Testlib: Func to update a bundle based on content
This commit provides a function that can be used to generate update
content based on the content from a directory specified by the user.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-01 13:28:20 -07:00
Castulo Martinez 57d544384b Testlib: Functions to get entries from manifest
This commit adds a function that retrieve the matching entry from a
manifest or all entries if no key is provided.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-01 13:28:20 -07:00
Castulo Martinez 9e3dd33247 Testlib: function to create a bundle from content
This commit adds a function to create a bundle based on the content form
a directory specified by the user.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-01 13:28:20 -07:00
Castulo Martinez a47d8bfa17 Testlib: small corrections in the library
This commit has a few small corrections in testlib:
 - it removes some code that was used for iterative manifests
 - it correct some help menus
 - favors the use of debug_msg over an if statement for filtering
   messages
 - do not follow links in the function that creates tars from
   fullfiles

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-01 13:28:20 -07:00
Castulo Martinez a55c0cdb2e Testlib: don't follow links adding to manifest
When a test is adding a symlink to a manifest, the file the link is
pointing to is also added to the manifest. This commit prevents the file
pointed by the link to be added, if the user wants to add this file they
can do it explicitely.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-01 13:28:20 -07:00
Castulo Martinez 8ed40ee2ce Testlib: support file type changes
This commit adds support for file type changes when using bundle_update,
so the correct type is added to the manifest.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-01 13:28:20 -07:00
Otavio Pontes 54fcaad51e signature: Accept expired signatures for latest file
It is considered safe to accept expired signatures to validate the latest
file because we are always checking again the signature of the MoM file.

Adding tests to validate that:
 - Expired signatures for latest file works
 - Expired signatures for MoM fails even when latest signature is correct

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-01 08:38:15 -07:00
Otavio Pontes 0c96d28565 signature: Add flags to signature verification to be able to extend it
Replace a bool value with an enum flags, so we can add more modifiers to
function.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-01 08:38:15 -07:00
Otavio Pontes 7a338baeb9 tests: Add extra tests to signature validation
- Check if custom certificate is working when valid
 - Check if we are having errors on expired certificate

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-01 08:38:15 -07:00
Otavio Pontes 2fe40faf10 test: Group tests that can be run only on in CI
2 groups were created:
 - slow: Tests that are very slow because of sleeps, so we can run them all
   in parallel
 - system: Tests that make change to the system, so they can cause problems
   when running in parallel, so we run them in series.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-01 08:38:15 -07:00
Otavio Pontes d6ff0586ef 3rd-party: Add 3rd-party share directories to XDG dirs
When creating a wrapper for 3rd-party binaries, append relative
/usr/share and /usr/local/share to XDG_DATA_DIRS variable and /etc
to XDG_CONF_DIRS.

Fix #1411

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-03-31 14:41:11 -07:00
Castulo Martinez c875ebc428 Correct the comment from sys_path_join()
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-03-30 15:05:44 -07:00
Otavio Pontes 819f4d1b6a swupd_init: Make sure swupd is always runnin in an existing path
If the path where swupd is running is removed getcwd errors will occurs, mostly
because of multiple commands swupd executes. So move to directory "/", no mather
where swupd is going to be installed, to make sure the path is always existent.

Fixes #1078

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-03-30 13:59:43 -07:00
Castulo Martinez da0ef3e05e Remove extra slash from paths
This commit removes the extra slash '/' from the path from:
- the update_boot function
- the verifytime script

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-03-30 13:39:04 -07:00
Otavio Pontes e9739d9eb3 actions: cache dependencies for swupd
Some packages we need to build swupd are not available on ubunutu-latest
so we need to download and build from source. This process is slow and
caching can save us some significant time on build.
2020-03-27 15:34:41 -07:00
Otavio Pontes 450cbe970c tests: Fix shellcheck-all reported problem
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-03-27 12:53:11 -07:00
Otavio Pontes 5a8b431eeb scripts: Run shellcheck-all just once
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-03-27 10:45:15 -07:00
Castulo Martinez a734463f3f Bug_fix: Fixing memory leaks
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-03-27 10:00:07 -07:00
Otavio Pontes bad6135075 README: Update badge to use information from github actions
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-03-27 09:38:55 -07:00
Otavio Pontes b1a6b1e15c scripts: Use shellcheck-all on test script
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-03-26 18:58:37 -07:00
Otavio Pontes 3412dd7c6b delta: Don't retry to use manifest deltas
When a manifest delta was incorrect, the full manifest was used. But in the
case of a correct delta that produces an invalid manifest, swupd was never
trying to download the full manifest.

Changing code to try to use deltas only once. On first error, always retry
downloading the full manifest.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-03-26 18:57:21 -07:00
Otavio Pontes 0b940afdc8 actions: Create a success job to make it easier to check if workflow is ok
It's a bit hard to configure github to block PRs when we change the name of
tests, so keep one with a constant name to validate PRs

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-03-26 15:44:04 -07:00
Otavio Pontes 3019a7adaa actions: group scripts that are only relevant to github actions
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-03-26 15:44:04 -07:00
Otavio Pontes 18c3cc853e actions: Rename github actions job to better names
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-03-26 15:44:04 -07:00
Otavio Pontes 1ad51a7fdb actions: Only run shellcheck-all on pushes to master branch
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-03-26 15:44:04 -07:00