-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add single step update #1639
Add single step update #1639
Conversation
When allocating the buffer for a version string, the size should be one greater than the max string size as the null string is inserted at the content size index which leads to a buffer overflow. Signed-off-by: William Douglas <william.douglas@intel.com>
1c95581
to
ac97f45
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside from the help/usage text, my only suggestion is to consider whether "incremental" might be less ambiguous than "single-step".
Thanks, I am not great at coming up with clear names. |
ac97f45
to
129e82b
Compare
src/cmds/update.c
Outdated
|
||
static int requested_version = -1; | ||
static bool download_only = false; | ||
static bool update_search_file_index = false; | ||
static bool keepcache = false; | ||
static bool cmdline_option_single_step = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static bool cmdline_option_single_step = false; | |
static bool cmdline_option_incremental = false; |
src/cmds/update.c
Outdated
@@ -142,11 +144,11 @@ int add_included_manifests(struct manifest *mom, struct list **subs) | |||
return 0; | |||
} | |||
|
|||
static enum swupd_code check_versions(int *current_version, int *server_version, int req_version, char *path_prefix) | |||
static enum swupd_code check_versions(int *current_version, int *server_version, int req_version, char *path_prefix, bool single_step) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static enum swupd_code check_versions(int *current_version, int *server_version, int req_version, char *path_prefix, bool single_step) | |
static enum swupd_code check_versions(int *current_version, int *server_version, int req_version, char *path_prefix, bool incremental) |
src/cmds/update.c
Outdated
{ | ||
int ret; | ||
|
||
ret = read_versions(current_version, server_version, path_prefix); | ||
ret = read_versions(current_version, server_version, path_prefix, single_step); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ret = read_versions(current_version, server_version, path_prefix, single_step); | |
ret = read_versions(current_version, server_version, path_prefix, incremental); |
src/cmds/update.c
Outdated
@@ -285,7 +291,7 @@ enum swupd_code execute_update_extra(extra_proc_fn_t post_update_fn, extra_proc_ | |||
|
|||
/* get versions */ | |||
timelist_timer_start(globals.global_times, "Get versions"); | |||
ret = check_versions(¤t_version, &server_version, requested_version, globals.path_prefix); | |||
ret = check_versions(¤t_version, &server_version, requested_version, globals.path_prefix, cmdline_option_single_step); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ret = check_versions(¤t_version, &server_version, requested_version, globals.path_prefix, cmdline_option_single_step); | |
ret = check_versions(¤t_version, &server_version, requested_version, globals.path_prefix, cmdline_option_incremental); |
src/cmds/update.c
Outdated
@@ -617,6 +635,9 @@ static bool parse_opt(int opt, char *optarg) | |||
cmdline_option_3rd_party = optarg_to_bool(optarg); | |||
return true; | |||
#endif | |||
case FLAG_INCREMENTAL: | |||
cmdline_option_single_step = optarg_to_bool(optarg); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cmdline_option_single_step = optarg_to_bool(optarg); | |
cmdline_option_incremental = optarg_to_bool(optarg); |
src/cmds/update.c
Outdated
@@ -697,7 +718,7 @@ enum swupd_code update_main(int argc, char **argv) | |||
ret = check_update(); | |||
|
|||
#ifdef THIRDPARTY | |||
if (cmdline_option_3rd_party) { | |||
if (cmdline_option_3rd_party && !cmdline_option_single_step) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (cmdline_option_3rd_party && !cmdline_option_single_step) { | |
if (cmdline_option_3rd_party && !cmdline_option_incremental) { |
src/cmds/update.c
Outdated
@@ -707,7 +728,7 @@ enum swupd_code update_main(int argc, char **argv) | |||
ret = execute_update(); | |||
|
|||
#ifdef THIRDPARTY | |||
if (cmdline_option_3rd_party) { | |||
if (cmdline_option_3rd_party && !cmdline_option_single_step) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (cmdline_option_3rd_party && !cmdline_option_single_step) { | |
if (cmdline_option_3rd_party && !cmdline_option_incremental) { |
src/swupd.h
Outdated
@@ -167,7 +167,7 @@ extern enum swupd_code walk_tree(struct manifest *, const char *, bool, const re | |||
|
|||
extern int get_latest_version(char *v_url); | |||
extern int get_int_from_url(const char *url); | |||
extern enum swupd_code read_versions(int *current_version, int *server_version, char *path_prefix); | |||
extern enum swupd_code read_versions(int *current_version, int *server_version, char *path_prefix, bool single_step); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extern enum swupd_code read_versions(int *current_version, int *server_version, char *path_prefix, bool single_step); | |
extern enum swupd_code read_versions(int *current_version, int *server_version, char *path_prefix, bool incremental); |
src/swupd_lib/version.c
Outdated
@@ -330,15 +434,21 @@ bool get_distribution_string(char *path_prefix, char *dist) | |||
return true; | |||
} | |||
|
|||
enum swupd_code read_versions(int *current_version, int *server_version, char *path_prefix) | |||
enum swupd_code read_versions(int *current_version, int *server_version, char *path_prefix, bool single_step) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enum swupd_code read_versions(int *current_version, int *server_version, char *path_prefix, bool single_step) | |
enum swupd_code read_versions(int *current_version, int *server_version, char *path_prefix, bool incremental) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update-incremental.bats
Monday morning grep X(. |
129e82b
to
63fdc78
Compare
Allow users to update by stepping through each release between their current version and the latest. This option is primarily for cases where update is failing due to memory or disk space running out when updating normally. Signed-off-by: William Douglas <william.douglas@intel.com>
Sorry about that. Fixed up commit message too. Thanks for rechecking. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've all been there :)
No description provided.