This release makes several bug fixes and minor improvements.
Bug fixes
- File rename bug fixed, swupd-client can now handle the simplest case
of renames where the file name changes but the content does not.
- Several compiler warning fixes.
- A fix for doc build failure for separate src and build dirs.
- Travis CI dependency update.
- Progress meter will always fully reach 100%.
- Progress meter flushes to stdout during redirected output.
Improvements
- Add progress updates for --verify.
- Support IPv6 in downloads.
- Support mixing of http and file URLs for content and version URLs.
- Add CApath fallback support.
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
Fixes#272
The create_update_list function was not adding a file onto its return
list if it was part of a rename that didn't change the contents. This
was due to a short circuit which failed to check if the flags
associated with a file (is_file, is_deleted etc) were the same.
Signed-off-by: Icarus Sparry <icarus.w.sparry@intel.com>
This test renames foo to bar with no changes to contents, and baz to
bat with minimal changes.
Signed-off-by: Icarus Sparry <icarus.w.sparry@intel.com>
Allow chown_root and revert_chown_root to take multiple parameters, in
particular they can now take -R to do a recursive chown.
New functions clean_web_dir, clean_state_dir and clean_target_dir to
clean things up (clean_test_dir is now an alias for
clean_state_dir).
New function set_os_release to set the value in target_dir
New function unpack_target_from_manifest. This takes two parameters
release and name. It reads the manifest, locates the files from the
web-dir/$release/staged directory and copies them into target-dir, and
also creates the directories. Helpful in creating initial versions of
target-dir. Should be expanded to do deletion.
Signed-off-by: Icarus Sparry <icarus.w.sparry@intel.com>
A colon-separated list of alternative CApath options can be passed to
swupd-client at the configuration time using --with-fallback-capaths
option.
In runtime, fallback CApath support is implemented as part of the
connectivity check. The implementation will try the default (built into
curl) and then will iterate through the list in the order they were
specified. It is done only once on the first call.
The code is reorganized to keep the connectivity check inside curl
wrapper:
* Deleted check_network implementation from version.c
* Removed have_network global (globals.c)
* Scoped swupd_curl_test_resume to curl.c
* Change use of check_network to swupd_curl_check_network
Also:
* Fixed an issue where SSL was only enabled if a URL was matching the
content URL
swupd used to enforce that version and content URL had to use the same
protocol because then it only needed to check once whether it was
downloading locally.
However, it's not that much more difficult to check each individual
URL, so now that's what swupd does now and thus the restriction is
gone.
Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
The calls to strstr() and strcasestr() in file_search() from search.c
result in compiler warnings when -Wnonnull is specified, because GCC's
"nonnull" attribute applies to these functions.
The logic from the file_search() call sites prevent NULL pointers from
being passed to these functions, but to protect against future
refactoring introducing this bug, check that the appropriate pointers
are non-NULL before calling the string functions.
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
Fixes#200
Because swupd-client uses libcurl, and my guess is that libcurl has
supported IPv6 for a long time, I don't see any reason to restrict
downloads to IPv4 only.
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
Fixing the compiler issue for check_network in check_update.c triggered
test failures. Fix the test failures and improve the error output for
when check_network() fails.
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
Fixes#263
The conditional checking for network connection always evaluated as true
since the check_network() function was not being called. Add the
parentheses to actually check for network.
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
Fixes#276
Refactor fixing a single file into its own routine, then call it in a
loop with print_progress.
Signed-off-by: Icarus Sparry <icarus.w.sparry@intel.com>
The progress meter adds a dot for every 10 steps taken if the output
is not to a terminal, but the output is probably block buffered so
output only occurs every 40960 steps. Add a fflush to force it out
straight away.
Related to #256.
Signed-off-by: Icarus Sparry <icarus.w.sparry@intel.com>
The denominator for the progress report is based on the length of the
linked list to be processed, and the numerator is the number of
elements processed. Most loops have short cut conditions, which invoke
continue, which don't therefore update the numerator, and so loops end
before the progress meter shows 100%. In particular the final file
might be skipped.
Update the numerator early in the loop, and add a final call to
print_progress to force showing 100% if it has not already been done.
Note this can force another dot to be output for the case where stdout
is not connected to a terminal.
Signed-off-by: Icarus Sparry <icarus.w.sparry@intel.com>
Now we have dots (or percentages) when files are being downloaded
these can intermingle with the normal output if they are flushed.
Alter the fix-missing-file test to remove dots from the lines to be
compared, and alter the lines-checked to add in the lines which would
normally be ignored but no longer match due to the missing dots,
e.g. "Downloading packs."
Signed-off-by: Icarus Sparry <icarus.w.sparry@intel.com>
Recent outages to sourceforge break Travis CI runs. Use the github
release instead and update to the latest version of libcheck (0.11.0).
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
Use = rather than := on the line. It is only an efficiency gain.
replace patsubst and filter with a new variable and standard
substitution.
Replace %-style pattern with suffix rule.
Signed-off-by: Icarus Sparry <icarus.w.sparry@intel.com>
glibc marks system() as a function whose return value should not be
ignored, which is generally reasonable. In this case we do want to
ignore the return value. Just casting to void is not enough to stop
the gcc warning. So instead we use the value in an if statement with
an empty body, which we trust the optimizer to remove so there is no
run time penalty.
The alternative solution would be to use
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wwarn_unused_result"
system(log_cmd);
#pragma GCC diagnostic pop
but that is rather gcc specific.
Signed-off-by: Icarus Sparry <icarus.w.sparry@intel.com>
This release improves error reporting for container use-cases.
* Adds systemctl check for autoupdate to correctly report that swupd is
"Unable to determine autoupdate status" in a container.
* Adds a --no-boot-update flag to disable boot file updates particularly
for use in a container when boot file management will fail.
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
Since clr-boot-manager does not work in a container add the
--no-boot-update option to allow installation into a container to skip
the boot partition management. This also calls apply_heuristics when
running bundle-add, with the result of running CBM when necessary for
bundle-adds and skipping CBM when the --no-boot-update flag is
specified.
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
In a container systemctl does not work, and /usr/bin/systemctl fails as
expected with "Failed to connect to bus: No such file or directory."
Because of this, swupd autoupdate will not work either. However,
"systemctl is-enabled ..." will not fail, even though it should.
Add an additional check to make sure /usr/bin/systemctl is working
before checking if swupd-update.service is-enabled. Report that swupd
was "Unable to determine autoupdate status" if this check fails.
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
This release improves error messages for post update scripts when
systemd is not operable, such as in a container, adds a --force or
--picky requirement when verify --fixing to another version, and
performs hash checks on every file when adding a bundle.
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
When running verify --fix with -m specifying a different version than
the current OS version, require --picky to enforce management of files
under /usr or require --force as an override. Adding --picky can solve
issues such as issue #238 where fixing backward caused glibc library
confusion.
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
Now that bundleadd verifies each file it downloads the incorrect hashes
cause test failures. Update these hashes to be correct.
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
Add a check for missing file so that bundleadd can fall back to the
verify_fix_path to attempt to re-download the file instead of failing
the hash check due to the hash being all 0s.
Improve error messages by reporting the filename instead of the hash in
the error.
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
When running swupd in a container systemd is not operable and fails with
a "Failed to connect to bus" error. Instead of printing these errors
directly check if systemd is operable at all and print a warning if not,
then return early from the update_triggers.
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
Add newline so progress updates are printed correctly. Instead of this:
...10%File /file was not in a pack
...11%
Print a newline before the message:
...10%
File /file was not in a pack
...11%
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
This release adds the --deps and --has-dep subcommands to bundle-list to
print dependencies of a bundle and a tree of bundles that have the
specified bundle as a dependency, respectively. It also improves error
handling when checking that the state directory is owned by root.
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
Don't use the return value from swupd_rm, which is poorly defined, but
test directly that the file no longer exists.
Signed-off-by: Icarus Sparry <icarus.w.sparry@intel.com>
Allow user to list all bundle dependencies of a bundle passed to
swupd bundle-list --deps BUNDLE
This lists all included bundles (included those recursively included)
for the BUNDLE. This is particularly useful when applications or users
need to determine just how large the bundle addition will be. For
example, a user may not be aware that by bundle-adding desktop-dev they
are recursively adding 12 other bundles. This command allows the user to
make this check before installation.
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
The --has-dep=BUNDLE argument will display a tree representing all
installed bundles that recursively include BUNDLE.
One may pass the --all argument as well to list the dependency tree for
BUNDLE including all installable bundles available on the server.
**Example output without --all:**
Installed bundles that have os-installer as a dependency:
format:
# * is-required-by
# |-- is-required-by
# * is-also-required-by
# ...
* mixer
|-- os-clr-on-clr
**Example output with --all:**
Attempting to download version string to memory
All installable and installed bundles that have os-installer as a dependency:
format:
# * is-required-by
# |-- is-required-by
# * is-also-required-by
# ...
* clr-devops
* mixer
|-- os-clr-on-clr
|-- os-clr-on-clr-dev
|-- clr-devops
|-- os-clr-on-clr-dev
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
A bundle will fail to be removed from the filesystem when other bundles
require that bundle as a dependency. Print a list of each of these
bundles along with the error message.
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
This release fixes several errant return codes, adds progress status for
long-running tasks, ensures the swupd state directory is created and is
owned by root at runtime, fixes --format arg validation, and enforces
format transitions for verify.
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
When using verify's -m option, it generally only makes sense to verify a
build within the same format, since the subsequent format (if any) might
not be compatible. Therefore, we should disallow verifying to a build
with a different format by default. This commit adds the proper
enforcement by making this condition a fatal error. The early exit can
be bypassed using the -x/--force option, which will print a warning
message instead.
For now, this compatibility check is targeting the use case of verifying
to a newer build, so I also report the latest supported build for the
current format. Verifying to an older build is not guaranteed to succeed
at present, and swupd-client does not yet understand the
version/formatN/first file. In other words, reporting to the user the
oldest build they can verify to will be a future improvement.
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
strtoull succeed when the leading characters of the input form a valid
number, so it is necessary to verify that there is no trailing
characters. Use the endptr parameter (that will point to the end of
the accepted input) to verify that.
Fixes#142.
Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>