Skip to content

Conversation

bkhouri
Copy link
Contributor

@bkhouri bkhouri commented Jul 14, 2025

The ProcessInfo extension to determine if a host is running on Amazon Linux 2 was slightly flawed as it did not take into account the double-quote (") surrounding the values.

Update the logic to look at "PRETTY_NAME" since the ID can be used in multiple Amazon Linux OS'es, and use exact logic match.

issue: rdar://155612963

@bkhouri
Copy link
Contributor Author

bkhouri commented Jul 14, 2025

@swift-ci test

@bkhouri
Copy link
Contributor Author

bkhouri commented Jul 14, 2025

I pushed a change that update the tests to add coverage with difference scenarios.

@swift-ci test

@bkhouri
Copy link
Contributor Author

bkhouri commented Jul 14, 2025

@swift-ci test windows

let id = line.replacingOccurrences(of: "ID=", with: "").trimmingCharacters(in: .whitespacesAndNewlines)
if id == "amzn" { // ID for Amazon Linux is "amzn"
do {
let nameRegex = try Regex("PRETTY_NAME=\"?Amazon Linux 2.*\"?")
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest you just do an exact match without the regex -- as is, this will incorrectly match Amazon Linux 2023 (due to the greedy match), which is the next version of Amazon Linux that the Swift project will later switch to, and notably does not have the posix_spawn issues that cause us to special case AL2 in the first place.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd rather have this merged now and edge cases dealt with later in separate PRs. This PR is blocking toolchain builds and AL2 failures is one of the reasons we don't have published toolchains since 22nd of June.

@MaxDesiatov MaxDesiatov dismissed jakepetroules’s stale review July 14, 2025 17:29

This PR is blocking development snapshot toolchain builds

HOME_URL="https://amazonlinux.com/"
SUPPORT_END="2026-06-30"
""",
expected: true
Copy link
Contributor

Choose a reason for hiding this comment

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

Here is AL2023:

NAME="Amazon Linux"
VERSION="2023"
ID="amzn"
ID_LIKE="fedora"
VERSION_ID="2023"
PLATFORM_ID="platform:al2023"
PRETTY_NAME="Amazon Linux 2023.6.20250107"
ANSI_COLOR="0;33"
CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2023"
HOME_URL="https://aws.amazon.com/linux/amazon-linux-2023/"
DOCUMENTATION_URL="https://docs.aws.amazon.com/linux/"
SUPPORT_URL="https://aws.amazon.com/premiumsupport/"
BUG_REPORT_URL="https://github.com/amazonlinux/amazon-linux-2023"
VENDOR_NAME="AWS"
VENDOR_URL="https://aws.amazon.com/"
SUPPORT_END="2028-03-15"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for this.

Copy link
Contributor

@MaxDesiatov MaxDesiatov left a comment

Choose a reason for hiding this comment

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

@bkhouri the cross-repo job is still failing: https://ci.swift.org/job/swift-PR-toolchain-amazonlinux2/79/console

18:46:28  ✘ Test run with 499 tests in 91 suites failed after 1168.385 seconds with 99 issues (including 88 known issues).

@MaxDesiatov MaxDesiatov dismissed their stale review July 14, 2025 18:30

Removing requested changes marker in case there's a need to force merge

@bkhouri bkhouri force-pushed the t/main/update_is_al2_logic branch from 1319817 to 0afa319 Compare July 14, 2025 22:05
@bkhouri
Copy link
Contributor Author

bkhouri commented Jul 14, 2025

@swift-ci test

@bkhouri bkhouri force-pushed the t/main/update_is_al2_logic branch from 0afa319 to 9ed71f0 Compare July 14, 2025 22:17
@bkhouri
Copy link
Contributor Author

bkhouri commented Jul 14, 2025

@swift-ci test

@bkhouri
Copy link
Contributor Author

bkhouri commented Jul 14, 2025

@bkhouri
Copy link
Contributor Author

bkhouri commented Jul 14, 2025

@swift-ci test windows

The ProcessInfo extension to determine if a host is running on Amazon
Linux 2 was slightly flawed as it did not take into account the
double-quote (") surrounding the values.

Update the logic to look at "PRETTY_NAME" since the ID can be used in
multiple Amazon Linux OS'es, and use exact logic match.

issue: rdar://155612963
@bkhouri bkhouri force-pushed the t/main/update_is_al2_logic branch from 9ed71f0 to 263e883 Compare July 15, 2025 01:35
@bkhouri
Copy link
Contributor Author

bkhouri commented Jul 15, 2025

@bkhouri
Copy link
Contributor Author

bkhouri commented Jul 15, 2025

@swift-ci test windows

@bkhouri
Copy link
Contributor Author

bkhouri commented Jul 15, 2025

@swift-ci test self hosted windows

@MaxDesiatov
Copy link
Contributor

@swift-ci test self hosted windows

1 similar comment
@MaxDesiatov
Copy link
Contributor

@swift-ci test self hosted windows

@MaxDesiatov MaxDesiatov enabled auto-merge (squash) July 15, 2025 14:22
@MaxDesiatov
Copy link
Contributor

@swift-ci test windows self hosted

@MaxDesiatov
Copy link
Contributor

@swift-ci test self hosted windows

@bnbarham
Copy link
Contributor

Merging to unblock toolchain builds

@bnbarham bnbarham disabled auto-merge July 15, 2025 16:48
@bnbarham bnbarham merged commit 1a8c516 into swiftlang:main Jul 15, 2025
5 of 6 checks passed
@bkhouri bkhouri deleted the t/main/update_is_al2_logic branch July 15, 2025 18:23
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.

4 participants