|
| 1 | +From c57f7efee706ce3bd0f12e87036c2edbde442403 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Mathieu Tortuyaux <mtortuyaux@microsoft.com> |
| 3 | +Date: Tue, 25 Aug 2026 15:05:52 +0200 |
| 4 | +Subject: [PATCH] sysupdate: do not fail when no transfers are defined |
| 5 | + |
| 6 | +sysupdate operations like 'list', 'reboot', etc. |
| 7 | +should not fail when no transfers are defined. |
| 8 | + |
| 9 | +Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com> |
| 10 | +--- |
| 11 | + src/sysupdate/sysupdate.c | 13 +++++++++---- |
| 12 | + 1 file changed, 9 insertions(+), 4 deletions(-) |
| 13 | + |
| 14 | +diff --git a/src/sysupdate/sysupdate.c b/src/sysupdate/sysupdate.c |
| 15 | +index 925e855a4a..ca8f627d86 100644 |
| 16 | +--- a/src/sysupdate/sysupdate.c |
| 17 | ++++ b/src/sysupdate/sysupdate.c |
| 18 | +@@ -1373,7 +1373,7 @@ static int verb_features(int argc, char *argv[], uintptr_t _data, void *userdata |
| 19 | + return r; |
| 20 | + |
| 21 | + r = context_make_offline(&context, loop_device ? loop_device->node : NULL, |
| 22 | +- READ_DEFINITIONS_REQUIRES_ANY_TRANSFERS); |
| 23 | ++ /* read_definition_flags= */ 0); |
| 24 | + if (r < 0) |
| 25 | + return r; |
| 26 | + |
| 27 | +@@ -1642,7 +1642,7 @@ static int verb_vacuum(int argc, char *argv[], uintptr_t _data, void *userdata) |
| 28 | + return r; |
| 29 | + |
| 30 | + r = context_make_offline(&context, loop_device ? loop_device->node : NULL, |
| 31 | +- READ_DEFINITIONS_REQUIRES_ANY_TRANSFERS); |
| 32 | ++ /* read_definitions_flags= */ 0); |
| 33 | + if (r < 0) |
| 34 | + return r; |
| 35 | + |
| 36 | +@@ -1665,7 +1665,7 @@ static int verb_pending_or_reboot(int argc, char *argv[], uintptr_t _data, void |
| 37 | + "The --root=/--image= switches may not be combined with the '%s' operation.", argv[0]); |
| 38 | + |
| 39 | + r = context_make_offline(&context, /* node= */ NULL, |
| 40 | +- READ_DEFINITIONS_REQUIRES_ENABLED_TRANSFERS | READ_DEFINITIONS_REQUIRES_ANY_TRANSFERS); |
| 41 | ++ READ_DEFINITIONS_REQUIRES_ENABLED_TRANSFERS); |
| 42 | + if (r < 0) |
| 43 | + return r; |
| 44 | + |
| 45 | +@@ -1674,8 +1674,13 @@ static int verb_pending_or_reboot(int argc, char *argv[], uintptr_t _data, void |
| 46 | + r = context_discover_update_sets_by_flag(context, UPDATE_INSTALLED); |
| 47 | + if (r < 0) |
| 48 | + return r; |
| 49 | +- if (!context->newest_installed) |
| 50 | ++ if (!context->newest_installed) { |
| 51 | ++ if (context->n_transfers == 0) { |
| 52 | ++ log_warning("Couldn't find any suitable installed versions."); |
| 53 | ++ return 0; |
| 54 | ++ } |
| 55 | + return log_error_errno(SYNTHETIC_ERRNO(ENODATA), "Couldn't find any suitable installed versions."); |
| 56 | ++ } |
| 57 | + |
| 58 | + r = parse_os_release(arg_root, "IMAGE_VERSION", &booted_version); |
| 59 | + if (r < 0) /* yes, arg_root is NULL here, but we have to pass something, and it's a lot more readable |
| 60 | +-- |
| 61 | +2.54.0 |
| 62 | + |
0 commit comments