microsoft / microsoft/azure-linux-dev-tools

`patch-add` overlay appends `PatchN:` tag at end of preamble instead of grouping with existing Patch tags

Open Beginner friendly
#284 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area: overlays enhancement priority: low
Dominant language
Go
Stars
18
Forks
27
Avg merge
4d 33m
Merged PRs (30d)
24

Description

Summary
When the patch-add overlay adds a patch to a spec that has no %patchlist section, the new PatchN: tag is appended at the very end of the preamble (just before %description) rather than being placed alongside the existing Patch/PatchN tags. This produces valid but awkwardly-placed output.

Example
For libsolv.spec, which has an upstream Patch: tag near the top of the preamble, running the patch-add overlay:

[[components.libsolv.overlays]]
description = "Make file time available for dnf plugins, a prerequisite for virtual snapshots"
type = "patch-add"
source = "0002-Make-file-time-available-for-dnf-plugins.patch"

inserts Patch1: at ~L92 (after the %if %{with zchunk}...%endif BuildRequires block, immediately before %description), instead of next to the existing Patch: tag at ~L70.

Root cause

  • The patch-add overlay calls Spec.AddPatchEntry (edit.go:653).
  • When there is no %patchlist section, it falls back to AddTag(...) (edit.go:172).
  • AddTag calls AppendLinesToSection, which always inserts at the end of the section (edit.go:473).

Acceptance criteria

  • New patches added via patch-add are placed next to existing Patch/PatchN tags. (cosmetic change)
  • Specs with a %patchlist section continue to append there.
  • Specs with no existing patch tags behave as today.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in edit.go:653 and follow Spec.AddPatchEntry through edit.go:172 and AddTag/AppendLinesToSection at edit.go:473. Check the libsolv.spec example and existing patch-tag handling; done means patch-add groups new PatchN: tags with existing Patch tags, preserves %patchlist behavior, and leaves specs without patch tags unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.