2019 Commits
Author SHA1 Message Date
Otavio Pontes 998ed76b4e Release 4.1.0
Enhancements:
 - Improving the quality of swupd --quiet output to be easy to be used on scripts and stable over time.
 - Fixing severity in telemetry reports to match the telemetry specification
 - Improve installation for directories and files to reduce dependency from tar binary. Now, tar is only used as a fallback
 when standard installation method fails.
 - Performance improvement when executing external commands by using vfork before execve as all commands already run in serial.
 - Updated list of files that triggers a clr-boot-manager call on update to include the cbm binary and ldlinux.c32
 - Man page style was improved to follow the style of other standard man pages
 - Adding a new flag to update to also update 3rd-party repositories (swupd update --3rd-party)
 - Printing debug information for all file checked on diagnose or repair

Bugs:
 - Installation of new directories on root dir (/) could fail on update or bundle-add
 - When flag --file is used on repair, only exact matches should be processed.
 - When repairing or diagnosing a directory using --file also some extra files were ignored.
 - Fixing problems on autocomplete for zsh
 - Fixed invalid memory access on curl resume download file errors

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
v4.1.0
2020-04-30 13:56:35 -07:00
Otavio Pontes d2c053cdb3 test: Create test to validate if we can repair files that have type change
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-30 12:26:29 -07:00
Otavio Pontes f2c0413dcc verify: Don't dereference symlinks on repair
Access always dereference symlinks and we should never do that when we
are validating one file on the system.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-30 12:26:29 -07:00
Otavio Pontes 4436d33e43 target_root: Handle invalid directory or missing directory the same way
We don't need to handle directory missing or invalid differently, because
the staging function removes it if necessary, so making the if simple.

Fix #1509

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-30 12:26:29 -07:00
Otavio Pontes ce0943982a shellcheck: Error SC2119 doesn't apply to our use cases
Ignoring error SC2119 because they are false positives and I don't see cases
where that would return anything useful for us.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-30 08:50:48 -07:00
Otavio Pontes a3c1f97c57 shellcheck: Unify shellcheck script
Make sure shellcheck and shellcheck bats are using the same configuration to
run shellcheck

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-30 08:50:48 -07:00
Otavio Pontes 694c39b1f0 verify: Debug info for every checked file
Print debug information for all file that is checked in repair/diagnose/os-install

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-29 13:03:24 -07:00
Otavio Pontes 203b9e35ca macros: Create a wrapper for free()
On several points on swupd we need to free a pointer and then set it to
NULL. This is made in some areas using the free_and_clear_pointer(). But
most places free_and_clear_pointer() is used, this is not really necessary.

On the other hand it's hard to make sure that we are really setting to NULL
every pointer that we need, so we're adding a more conservative approach on
setting every pointer to NULL after free using a wrapper.

The greatest advantage of this wrapper over free_and_clear_pointer() is that
it's not type dependent and we don't need to call it with a pointer of a pointer,
so calls look more to calls to a standard free.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-29 10:20:50 -07:00
Otavio Pontes e15ee0a6d6 sys: Always prefer to use basename and dirname from sys.c
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-29 10:20:50 -07:00
Castulo Martinez 766be95913 Test: show_target shellcheck warning
The show_target function shows a warning that is not applicable so this
commit ignores that warning wherever show_target is used.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-29 09:04:13 -07:00
Castulo Martinez 2d71700157 curl: exit if the file cannot be created/appended
If for some reason swupd fails to create or append the file it will
cause a segmentation fault. This, commit prevents this from happening.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-29 09:03:33 -07:00
Castulo Martinez b58e6c20ca Fail to be compliant if --quiet tests change
We are aiming to provide a stable --quiet output, so forcing "make
compliant" to fail if there are changes in the test/functional/api
tests, which cover these scenarios will prevent us from unadvertedly
changing those tests.

Closes #1501

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-28 14:19:57 -07:00
Castulo Martinez e57b9e6948 Testlib: adding help with description for all funcs
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-28 10:56:39 -07:00
Castulo Martinez 8a6eb85efe Testlib: function to print help menus of commands
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-28 10:56:39 -07:00
Otavio Pontes d51a3863f4 helpers: Add check for allocation errors
Forgot to add the check after calloc

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-28 09:44:42 -07:00
Castulo Martinez 201950445a Reporting if a file was fixed or not with --quiet
When using --quiet, there was no way of knowing if a file had been
successfully repaired or not. This commit fixes that.

Closes #1504

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-28 09:13:45 -07:00
Castulo Martinez 8b9a2e8510 API: Do not validate error messages in API tests
The tests in test/functional/api are going to validate the --quiet
output is rarely changed, therefore only expected output should be
validated and not warnings or error messages.

Closes #1502

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-27 16:04:05 -07:00
Lucius Hu 6c3f0a5f13 zsh-completions: Only add 3rd-party when it's supported
- Added a new flag `feature_thirdparty` for whether `3rd-party` operations
  is supported.
- Improved return code handling.
2020-04-27 14:51:00 -07:00
Otavio Pontes 1b9d19c3fe globals: Remove unnecessary variables
Those variables that saved counts were only being checked again with the
same information that made the counts, so basically we were just checking if
we are looking at all elements of a list in a loop.
Removing it them.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-27 14:50:22 -07:00
Otavio Pontes 9ca268a008 target_root: Return correct exit code when file instalation fails
We were not returning an error code when rename fails

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-27 14:50:22 -07:00
Otavio Pontes 9a8d5a09e3 target_root: Reorganize function verify_fix_path()
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-27 14:50:22 -07:00
Otavio Pontes 6346f75477 sys: sys_path_join was wrong for string "//"
When sys_path_join("//") was used, the result was "" instead of "/"

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-27 13:59:07 -07:00
Castulo Martinez edd3328f92 Disable --3rd-party when applicable
There is a configuration option to build swupd without the 3rd-party
functionality, this commit adds a guard to disable the code that adds
the "swupd update --3rd-party" flag which should be only available if
3rd-party is enabled.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-27 12:21:21 -07:00
Lucius Hu 6c3505f683 swupd.zsh: Updated to support 3rd-party repo
- Added supports to 3rd-party repos.
- Added a new functionality to complete `version` number. For example
  `swupd update --version=VERSION_NUMBER`
- Updated descriptions for arguments/options.
- Large amount of refactoring. Separation of data and logic.
2020-04-27 08:30:04 -07:00
Castulo Martinez 8ab83f8167 3rd-party: using "repository" for headers
Headers are printed at the beginning of the output for every repository
in operations that run in multipl repos. This header was using the word
"repo" but we are trying to use the whole "repository" word every time
we printed it to the user. This commit changes that.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-24 17:12:17 -07:00
Otavio Pontes 455b398edd scripts: Run all tests with force-tartar build flag
Make sure that the tar|tar install file works because it's used as a
fallback when file failed to be installed using system tools

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-24 12:03:09 -07:00
Otavio Pontes e83a872ab0 build_opts: Adding debug_mode and force_tar to swupd -v
Swupd -v is used to print compile flags used, so printing debug-mode and
force-tar parameters here.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-24 12:03:09 -07:00
Otavio Pontes a4a59ff492 target_root: Add a flag to force to use tar|tar
"Tar | tar" strategy to install files are only used now in cases where we
have errors trying better approaches. In order to make it easier to debug
errors on this fallback mechanism, create a flag to force swupd to always
use tar | tar to install files and directories.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-24 12:03:09 -07:00
Otavio Pontes 93635443d1 target_root: Unify tar|tar commands
To be easier to port, make 2 functions that run tar to use same template.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-24 12:03:09 -07:00
Castulo Martinez 6766748b42 Check extra files even if no tracked files
When running a diagnose/repair, swupd creates a list of the files to be
verified, this list contains normally all the files from the manifests
from bundles installed in the system. When the --file flag is used, this
list contains only the file specified in the flag or the directory and
files included in that directory if a directory is specified. If nothing
trakced was found using the given path, then swupd was considering
nothing else needed to be done and was exiting. This commit changes this
behavior so if there are no tracked files, we still look for extra,
untracked files before exiting.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-24 09:32:28 -07:00
Castulo Martinez 5e3164523d Testlib: function to add os-core-update to an env
For some tests is useful to have a minimal version of the os-core-update
bundle since some system files are tracked there.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-24 09:32:28 -07:00
Castulo Martinez be0fa3c69f Bug_fix: don't consider partial match with --file
When running a diagnose/repair using the --file flag, swupd was
considering partial matches, for example "--file /ba" would match
"/bar", "/baz", "/bat", etc. This commit changes it so it only matches
full matches. Foe example: "/bar" will only match "/bar",
"/bar/file", but won't match "/barbar".

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-24 09:32:28 -07:00
Castulo Martinez 77b499cd0b Adding a --3rd-party flag to update
This commit adds a flag that can be used to update content from
3rd-party repositories after updating the regular content if
successfull.

Closes #1473

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-24 08:14:45 -07:00
Otavio Pontes b59116ddbc header: Print the header decoration all at once
When printing the header, print all '_' chars at once to prevent
json-output and --debug to print that in multiple lines.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-23 15:20:50 -07:00
Otavio Pontes d5865a42f0 docs: Changes on man pages to make is similar to system man pages
Using a man page formating similar to what other man pages in the system
uses.

Fixes #1285

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-23 12:08:11 -07:00
Otavio Pontes cac56264d3 compliant: Start using clang-format-10 to check for style problems
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-23 12:07:51 -07:00
Castulo Martinez 737e002851 Fixing typo in helper description
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-23 11:13:01 -07:00
Otavio Pontes 3bb267a267 strings: Create a str_starts_with() to be used when needed
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-23 08:55:45 -07:00
Otavio Pontes 73a6d0055c strings: Create safer wrapper to strcmp()
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-23 08:55:45 -07:00
Otavio Pontes bbd7da491d strings: renaming functions to have a str_ prefix
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-23 08:55:45 -07:00
Otavio Pontes 1d8caf04f4 autotools: Automatically defined _GNU_SOURCE
We define _GNU_SOURCE in multiple files because we use some
functions that can have different behaviors when _GNU_SOURCE
is used.

Defining it in config.h then, to make sure that all files
will behave the same. We had problems in the past where
same function had different behaviors in different files.

Only case where this is known to be needed is in sys, so
leaving the define there.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-22 15:21:07 -07:00
Otavio Pontes 83420c0fee autotools: Forces all files to include config.h header
Instead of explicitly adding config.h in every file, forcing it to be included
by the build system. Forgetting to include config.h could cause ifdefs to include
incorrect code.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-22 15:21:07 -07:00
Otavio Pontes 4747b41204 sys: sys_path_join() removes trailing '/' from "/"
Sys_path_join is removing trailing '/', but we shouldn't remove the last
'/' if path is "/". Right now sys_path_join("/") == "" and should be "/".

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-22 15:20:54 -07:00
Castulo Martinez a7ed2cbce0 Bug_fix: In closing steps in multi-repo ops
Multi-repo operations can run in one or multiple repos, so that needs to
be taken in consideration when opening and closing progress steps.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-22 10:46:59 -07:00
Castulo Martinez 6be7cb857d 3rd-party: do not report telemetry on 3rd-party
Telemetry is used to report problems to main repository, so it doesn't
make sense to create telemetry report files for 3rd-party repositories.

Closes #1358

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-22 10:12:12 -07:00
Castulo Martinez 1a13a29e14 Updating list to run clr-boot-manager
This commit adds the following files to trigger the execution of
clr-boot-manager:
- /usr/bin/clr-boot-manager
- /usr/share/syslinux/ldlinux.c32

Closes #1415

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-22 09:37:59 -07:00
Otavio Pontes 9d967e2482 scripts: Use --enable-debug to run swupd tests
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-21 14:20:40 -07:00
Otavio Pontes b7d9de6ae5 tests: Adding more attribute changes to test
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2020-04-21 11:33:41 -07:00
Castulo Martinez 1e3cb68979 API: output for mirror
This commit provides a minimal output to be displayed when the --quiet
flag is used for these commands:

- swupd mirror

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-20 10:52:14 -07:00
Castulo Martinez dbe702ca03 API: output for 3rd-party add, remove, list
This commit provides a minimal output to be displayed when the --quiet
flag is used for these commands:

- swupd 3rd-party add
- swupd 3rd-party remove
- swupd 3rd-party list

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2020-04-20 09:51:22 -07:00