Skip to content

fix: fall back to distribution ID when os-release has no version field - #961

Merged
eifinger merged 2 commits into
astral-sh:mainfrom
cxzhong:fix/os-release-id-only-fallback
Jul 19, 2026
Merged

fix: fall back to distribution ID when os-release has no version field#961
eifinger merged 2 commits into
astral-sh:mainfrom
cxzhong:fix/os-release-id-only-fallback

Conversation

@cxzhong

@cxzhong cxzhong commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

getLinuxOSNameVersion() throws Failed to determine Linux distribution. Could not read /etc/os-release or /usr/lib/os-release on distributions whose os-release is readable but contains no version field at all — no VERSION_ID, no VERSION_CODENAME, no BUILD_ID. The error message is misleading in that case, and the action fails even though the distribution is perfectly identifiable.

Void Linux is such a distribution. Its os-release is:

$ cat /etc/os-release
NAME="Void"
ID="void"
PRETTY_NAME="Void Linux"
HOME_URL="https://voidlinux.org/"
DOCUMENTATION_URL="https://docs.voidlinux.org/"
LOGO="void-logo"
ANSI_COLOR="0;38;2;71;128;97"

DISTRIB_ID="void"

Unlike Arch (fixed by #912 via BUILD_ID) and debian:unstable (fixed via VERSION_CODENAME, #773), Void ships only ID, so both existing fallbacks miss it. This breaks any workflow using container: ghcr.io/void-linux/void-glibc-full with caching enabled — e.g. SageMath's CI started failing after bumping to v8: https://github.com/sagemath/sage/actions/runs/29456228986/job/87489892141 (worked around downstream in sagemath/sage#42547 by injecting a fake BUILD_ID into the container's os-release).

This PR adds a last-resort fallback: if ID is present but no version field is, return the plain ID (void), following the same reasoning as #912 — a stable cache key for a rolling release is better than crashing. Distributions with a version field are unaffected, and files without even an ID still raise the existing error.

Test Plan

  • npm run all passes (build, biome check, package, 83 unit tests).
  • Verified the compiled function against real os-release contents (fs.readFileSync stubbed):
    • Void (above) → void (previously: throw)
    • Arch (ID=arch, BUILD_ID=rolling) → arch-rolling (unchanged)
    • Ubuntu (ID=ubuntu, VERSION_ID="24.04") → ubuntu-24.04 (unchanged)
    • os-release with no ID → still throws (unchanged)

@cxzhong
cxzhong requested a review from eifinger as a code owner July 17, 2026 09:59

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3ca5dccb21

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/utils/platforms.ts Outdated
Comment on lines +127 to +128
if (id) {
return id;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Defer ID-only fallback until both files are checked

If /etc/os-release exists with only ID while /usr/lib/os-release still contains VERSION_ID, VERSION_CODENAME, or BUILD_ID, this return now short-circuits before the second file is inspected. Since getOSNameVersion() feeds the cache key, those images lose the more specific OS version component and can start sharing caches across OS versions; keep the ID-only value as a final fallback after all release files have been tried.

Useful? React with 👍 / 👎.

@cxzhong

cxzhong commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

Follow-up on the review point about short-circuiting: the initial commit returned the ID-only fallback inside the per-file loop, so an ID-only /etc/os-release would have masked a /usr/lib/os-release that still carries VERSION_ID/VERSION_CODENAME/BUILD_ID, losing the more specific version component of the cache key.

019f04a defers the ID-only fallback until all os-release files have been tried. Re-verified against the compiled function:

  • void /etc/os-release only → void
  • void /etc/os-release + ubuntu /usr/lib/os-releaseubuntu-24.04 (no short-circuit)
  • arch → arch-rolling, ubuntu → ubuntu-24.04, no-ID → throws (all unchanged)
  • npm run all green (83/83 tests)

@cxzhong

cxzhong commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

@codex please review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 019f04aa09

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/utils/platforms.ts

@eifinger eifinger left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good. Thank you!

@eifinger
eifinger merged commit f12b1f0 into astral-sh:main Jul 19, 2026
91 checks passed
@cxzhong
cxzhong deleted the fix/os-release-id-only-fallback branch July 19, 2026 08:52
Doridian pushed a commit to FoxDenHome/core that referenced this pull request Jul 21, 2026
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [https://github.com/astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) | action | major | `v8.3.2` → `v9.0.0` |

---

### Release Notes

<details>
<summary>astral-sh/setup-uv (https://github.com/astral-sh/setup-uv)</summary>

### [`v9.0.0`](https://github.com/astral-sh/setup-uv/releases/tag/v9.0.0): 🌈 Change `prune-cache` default to `false`

[Compare Source](astral-sh/setup-uv@v8.3.2...v9.0.0)

#### Changes

This release disables the default cache cache pruning to ease the load on the PyPi infrastructure.
Since users might experience more GitHub Actions cache usage which might result in higher costs this is marked as a breaking change. To read more on why we did this (now) you can read the detailed analysis and reasoning in [#&#8203;967](astral-sh/setup-uv#967)

Besides this big breaking change we also have a small bugfix while building caches for linux distributions that behave a big different than the "big ones" and a speed up in version resolution by only reading the version manifest until a matching version is found saving runtime and network bandwith.

#### 🚨 Breaking changes

- Change `prune-cache` default to `false` [@&#8203;charliermarsh](https://github.com/charliermarsh) ([#&#8203;967](astral-sh/setup-uv#967))

#### 🐛 Bug fixes

- fix: fall back to distribution ID when os-release has no version field [@&#8203;cxzhong](https://github.com/cxzhong) ([#&#8203;961](astral-sh/setup-uv#961))

#### 🚀 Enhancements

- Speed up version client by partial response reads [@&#8203;eifinger](https://github.com/eifinger) ([#&#8203;807](astral-sh/setup-uv#807))

#### 🧰 Maintenance

- chore: update known checksums for 0.11.30 @&#8203;[github-actions\[bot\]](https://github.com/apps/github-actions) ([#&#8203;968](astral-sh/setup-uv#968))
- chore: update known checksums for 0.11.29 @&#8203;[github-actions\[bot\]](https://github.com/apps/github-actions) ([#&#8203;960](astral-sh/setup-uv#960))

#### 📚 Documentation

- docs: update version references to v8.3.2 @&#8203;[github-actions\[bot\]](https://github.com/apps/github-actions) ([#&#8203;949](astral-sh/setup-uv#949))

#### ⬆️ Dependency updates

- chore(deps): roll up Dependabot updates [@&#8203;eifinger](https://github.com/eifinger) ([#&#8203;970](astral-sh/setup-uv#970))
- chore(deps): roll up Dependabot updates [@&#8203;eifinger](https://github.com/eifinger) ([#&#8203;962](astral-sh/setup-uv#962))

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yNzMuMCIsInVwZGF0ZWRJblZlciI6IjQzLjI3My4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

Reviewed-on: https://git.foxden.network/FoxDen/core/pulls/136
ajgon pushed a commit to deedee-ops/schemas that referenced this pull request Jul 22, 2026
#14)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) | action | major | `v8.3.2` → `v9.0.0` |

---

### Release Notes

<details>
<summary>astral-sh/setup-uv (astral-sh/setup-uv)</summary>

### [`v9.0.0`](https://github.com/astral-sh/setup-uv/releases/tag/v9.0.0): 🌈 Change `prune-cache` default to `false`

[Compare Source](astral-sh/setup-uv@v8.3.2...v9.0.0)

#### Changes

This release disables the default cache cache pruning to ease the load on the PyPi infrastructure.
Since users might experience more GitHub Actions cache usage which might result in higher costs this is marked as a breaking change. To read more on why we did this (now) you can read the detailed analysis and reasoning in [#&#8203;967](astral-sh/setup-uv#967)

Besides this big breaking change we also have a small bugfix while building caches for linux distributions that behave a big different than the "big ones" and a speed up in version resolution by only reading the version manifest until a matching version is found saving runtime and network bandwith.

#### 🚨 Breaking changes

- Change `prune-cache` default to `false` [@&#8203;charliermarsh](https://github.com/charliermarsh) ([#&#8203;967](astral-sh/setup-uv#967))

#### 🐛 Bug fixes

- fix: fall back to distribution ID when os-release has no version field [@&#8203;cxzhong](https://github.com/cxzhong) ([#&#8203;961](astral-sh/setup-uv#961))

#### 🚀 Enhancements

- Speed up version client by partial response reads [@&#8203;eifinger](https://github.com/eifinger) ([#&#8203;807](astral-sh/setup-uv#807))

#### 🧰 Maintenance

- chore: update known checksums for 0.11.30 @&#8203;[github-actions\[bot\]](https://github.com/apps/github-actions) ([#&#8203;968](astral-sh/setup-uv#968))
- chore: update known checksums for 0.11.29 @&#8203;[github-actions\[bot\]](https://github.com/apps/github-actions) ([#&#8203;960](astral-sh/setup-uv#960))

#### 📚 Documentation

- docs: update version references to v8.3.2 @&#8203;[github-actions\[bot\]](https://github.com/apps/github-actions) ([#&#8203;949](astral-sh/setup-uv#949))

#### ⬆️ Dependency updates

- chore(deps): roll up Dependabot updates [@&#8203;eifinger](https://github.com/eifinger) ([#&#8203;970](astral-sh/setup-uv#970))
- chore(deps): roll up Dependabot updates [@&#8203;eifinger](https://github.com/eifinger) ([#&#8203;962](astral-sh/setup-uv#962))

</details>

---

### Configuration

📅 **Schedule**: (in timezone Europe/Warsaw)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yNzIuMiIsInVwZGF0ZWRJblZlciI6IjQzLjI3Mi4yIiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIiwibGFiZWxzIjpbXX0=-->

Reviewed-on: https://git.ajgon.casa/deedee/schemas/pulls/14
luketainton pushed a commit to luketainton/repos_pypilot that referenced this pull request Jul 24, 2026
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) | action | major | `v8.3.2` → `v9.0.0` |

---

### Release Notes

<details>
<summary>astral-sh/setup-uv (astral-sh/setup-uv)</summary>

### [`v9.0.0`](https://github.com/astral-sh/setup-uv/releases/tag/v9.0.0): 🌈 Change `prune-cache` default to `false`

[Compare Source](astral-sh/setup-uv@v8.3.2...v9.0.0)

##### Changes

This release disables the default cache cache pruning to ease the load on the PyPi infrastructure.
Since users might experience more GitHub Actions cache usage which might result in higher costs this is marked as a breaking change. To read more on why we did this (now) you can read the detailed analysis and reasoning in [#&#8203;967](astral-sh/setup-uv#967)

Besides this big breaking change we also have a small bugfix while building caches for linux distributions that behave a big different than the "big ones" and a speed up in version resolution by only reading the version manifest until a matching version is found saving runtime and network bandwith.

##### 🚨 Breaking changes

- Change `prune-cache` default to `false` [@&#8203;charliermarsh](https://github.com/charliermarsh) ([#&#8203;967](astral-sh/setup-uv#967))

##### 🐛 Bug fixes

- fix: fall back to distribution ID when os-release has no version field [@&#8203;cxzhong](https://github.com/cxzhong) ([#&#8203;961](astral-sh/setup-uv#961))

##### 🚀 Enhancements

- Speed up version client by partial response reads [@&#8203;eifinger](https://github.com/eifinger) ([#&#8203;807](astral-sh/setup-uv#807))

##### 🧰 Maintenance

- chore: update known checksums for 0.11.30 @&#8203;[github-actions\[bot\]](https://github.com/apps/github-actions) ([#&#8203;968](astral-sh/setup-uv#968))
- chore: update known checksums for 0.11.29 @&#8203;[github-actions\[bot\]](https://github.com/apps/github-actions) ([#&#8203;960](astral-sh/setup-uv#960))

##### 📚 Documentation

- docs: update version references to v8.3.2 @&#8203;[github-actions\[bot\]](https://github.com/apps/github-actions) ([#&#8203;949](astral-sh/setup-uv#949))

##### ⬆️ Dependency updates

- chore(deps): roll up Dependabot updates [@&#8203;eifinger](https://github.com/eifinger) ([#&#8203;970](astral-sh/setup-uv#970))
- chore(deps): roll up Dependabot updates [@&#8203;eifinger](https://github.com/eifinger) ([#&#8203;962](astral-sh/setup-uv#962))

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yNzMuMCIsInVwZGF0ZWRJblZlciI6IjQzLjI3My4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJ0eXBlL2RlcGVuZGVuY2llcyJdfQ==-->Reviewed-on: https://git.tainton.uk/repos/pypilot/pulls/468
Reviewed-by: Luke Tainton <luke@tainton.uk>
Co-authored-by: renovate[bot] <renovate-bot@git.tainton.uk>
luketainton pushed a commit to luketainton/repos_labmcp that referenced this pull request Jul 24, 2026
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) | action | major | `v8.3.2` → `v9.0.0` |

---

### Release Notes

<details>
<summary>astral-sh/setup-uv (astral-sh/setup-uv)</summary>

### [`v9.0.0`](https://github.com/astral-sh/setup-uv/releases/tag/v9.0.0): 🌈 Change `prune-cache` default to `false`

[Compare Source](astral-sh/setup-uv@v8.3.2...v9.0.0)

##### Changes

This release disables the default cache cache pruning to ease the load on the PyPi infrastructure.
Since users might experience more GitHub Actions cache usage which might result in higher costs this is marked as a breaking change. To read more on why we did this (now) you can read the detailed analysis and reasoning in [#&#8203;967](astral-sh/setup-uv#967)

Besides this big breaking change we also have a small bugfix while building caches for linux distributions that behave a big different than the "big ones" and a speed up in version resolution by only reading the version manifest until a matching version is found saving runtime and network bandwith.

##### 🚨 Breaking changes

- Change `prune-cache` default to `false` [@&#8203;charliermarsh](https://github.com/charliermarsh) ([#&#8203;967](astral-sh/setup-uv#967))

##### 🐛 Bug fixes

- fix: fall back to distribution ID when os-release has no version field [@&#8203;cxzhong](https://github.com/cxzhong) ([#&#8203;961](astral-sh/setup-uv#961))

##### 🚀 Enhancements

- Speed up version client by partial response reads [@&#8203;eifinger](https://github.com/eifinger) ([#&#8203;807](astral-sh/setup-uv#807))

##### 🧰 Maintenance

- chore: update known checksums for 0.11.30 @&#8203;[github-actions\[bot\]](https://github.com/apps/github-actions) ([#&#8203;968](astral-sh/setup-uv#968))
- chore: update known checksums for 0.11.29 @&#8203;[github-actions\[bot\]](https://github.com/apps/github-actions) ([#&#8203;960](astral-sh/setup-uv#960))

##### 📚 Documentation

- docs: update version references to v8.3.2 @&#8203;[github-actions\[bot\]](https://github.com/apps/github-actions) ([#&#8203;949](astral-sh/setup-uv#949))

##### ⬆️ Dependency updates

- chore(deps): roll up Dependabot updates [@&#8203;eifinger](https://github.com/eifinger) ([#&#8203;970](astral-sh/setup-uv#970))
- chore(deps): roll up Dependabot updates [@&#8203;eifinger](https://github.com/eifinger) ([#&#8203;962](astral-sh/setup-uv#962))

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yNzMuMCIsInVwZGF0ZWRJblZlciI6IjQzLjI3My4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJ0eXBlL2RlcGVuZGVuY2llcyJdfQ==-->Reviewed-on: https://git.tainton.uk/repos/labmcp/pulls/17
Reviewed-by: Luke Tainton <luke@tainton.uk>
Co-authored-by: renovate[bot] <renovate-bot@git.tainton.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants