Skip to content

Commit

Permalink
fix(service): fix the return value of ListRepositories (#1930)
Browse files Browse the repository at this point in the history
## Problem

`ListRepositories` D-Bus method just crashes. It is expected to return
an array with contains the
return value as its first element. However, when there are no
repositories, it just returns an empty
array. It causes Ruby D-Bus to fail because it cannot serialize a `nil`
value.

## Solution

Fix the return value. For comparison, you can check the following
`ListPatterns` method.

## Testing

- _Tested manually_
  • Loading branch information
imobachgs authored Jan 21, 2025
2 parents fa72f8e + e8e5bc7 commit a2ebb64
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 4 additions & 4 deletions service/lib/agama/dbus/software/manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ def issues
# array of repository properties: pkg-bindings ID, alias, name, URL, product dir, enabled
# and loaded flag
dbus_method :ListRepositories, "out Result:a(issssbb)" do
backend.repositories.repositories.map do |repo|
[
[
backend.repositories.repositories.map do |repo|
[
repo.repo_id,
repo.repo_alias,
Expand All @@ -81,8 +81,8 @@ def issues
repo.enabled?,
!!repo.loaded?
]
]
end
end
]
end

# value of result hash is category, description, icon, summary and order
Expand Down
6 changes: 6 additions & 0 deletions service/package/rubygem-agama-yast.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue Jan 21 19:11:04 UTC 2025 - Imobach Gonzalez Sosa <[email protected]>

- Fix the ListRepositories D-Bus method to return the proper value
instead of crashing the service (gh#agama-project/agama#1930).

-------------------------------------------------------------------
Mon Jan 20 16:44:45 UTC 2025 - Ladislav Slezák <[email protected]>

Expand Down

0 comments on commit a2ebb64

Please sign in to comment.