Skip to content

fix: swiftly is stuck during dependency check on Fedora#520

Open
terraputix wants to merge 1 commit into
swiftlang:mainfrom
terraputix:fix/swiftly-stuck-during-dep-check
Open

fix: swiftly is stuck during dependency check on Fedora#520
terraputix wants to merge 1 commit into
swiftlang:mainfrom
terraputix:fix/swiftly-stuck-during-dep-check

Conversation

@terraputix
Copy link
Copy Markdown

Fix for #490.

The underlying issue was that using .discarded instead of .string(limit: 100 * 1024) will hang when waiting for user input. I verified this by running a bash script which waits for user input instead of yum list installed (from the changed line).
Since result.standardOutput is not currently being used the limit: 100 * 1024 could be smaller, but for simplicity I used the same value as in the apt-get version.

Moreover, yum list installed is not fully correct. Compare the following:

> yum list installed libuuid-devel
Updating and loading repositories:
Repositories loaded.
Available packages
libuuid-devel.i686   2.40.4-10.fc42 updates
libuuid-devel.x86_64 2.40.4-10.fc42 updates
> echo $?
0
> yum list --installed libuuid-devel
No matching packages to list
> echo $?
1

This shows that using --installed instead of installed will correctly return a non 0 exit code if a package is not installed.

return false
case "yum":
let result = try await run(.name("yum"), arguments: ["list", "installed", package], output: .discarded)
let result = try await run(.name("yum"), arguments: ["list", "--installed", package], output: .string(limit: 100 * 1024))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, this may not be working with Amazon Linux 2, which doesn't have dnf options like --installed.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would your preferred solution for this look like? I guess it would be simplest to check the output of the command for a correctly installed package (similar to what is done for the apt-get version).
Alternatively, dnf could be called with yum as a fallback?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants