bottlerocket-os / bottlerocket-os/twoliter
paryplanner: set_partition_uuids` eaks `partition_plan` into the caller's scope
- Dominant language
- Rust
- Stars
- 34
- Forks
- 43
- Avg merge
- 11h 13m
- Merged PRs (30d)
- 16
Description
**[P2] `set_partition_uuids` (L573-594) leaks `partition_plan` into the caller's scope — missing `local`.** _(commenting near the UKI typecode change since L579 is not in the diff)_
```bash
set_partition_uuids() {
local -n pp_uuid
pp_uuid="${1:?}"
partition_plan="${2:?}" # <-- L579, missing `local`
```
The sibling `set_partition_sizes` correctly declares `local ... partition_plan` (L235). Copy-paste drift.
Today the only callers use uppercase `PARTITION_PLAN`, so no collision, but any future caller (e.g. a helper inside img2img) with its own lowercase `local partition_plan` will find its value silently clobbered by this function via bash's dynamic scoping.
**Fix:** `local partition_plan="${2:?}"` on L579.
_Originally posted by @jmt-lab in https://github.com/bottlerocket-os/twoliter/pull/701#discussion_r3762546132_
Contributor guide
Research direction
Start at set_partition_uuids on lines 573-594 and compare its partition_plan handling with set_partition_sizes around line 235. Verify that partition_plan no longer leaks into callers and that the existing partition UUID workflow remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- bash
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 88/100