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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
- 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.
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>
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>
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>
"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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>