On 04/02/2026 16:49, Basil L. Contovounesios wrote:
Pádraig Brady [2026-02-04 16:35 +0000] wrote:
On 04/02/2026 14:24, Basil L. Contovounesios wrote:
Basil L. Contovounesios [2026-02-04 15:12 +0100] wrote:
That said, I think we can keep the generality by offsetting the line
number found by AWK by the start of the sed address.
I attach a patch which attempts this. WDYT?
Sorry, wrong patch; correct one attached.
I tried it with both single and double sed addresses in
my cfg.mk value of news-check-lines-spec.
OK cool. It's a bit over complicated though.
I'll apply with this adjustment:
stub_offset=$(sed -n "${stub_range}=" "$news" | head -n1)
The reason I opted for
sed '[addr]!d;='
in place of
sed -n '[addr]='
is because my local 'man 1posix sed' says:
[1addr]= Write the following to standard output:
"%d\n", <current line number>
where [1addr] is previously described as:
In the following list of editing commands, the maximum number of permis‐
sible addresses for each function is indicated by [0addr], [1addr], or
[2addr], representing zero, one, or two addresses.
which I took to mean that = is not guaranteed to work with all forms of
address. I don't know where that would be the case though, nor whether
do-release-commit-and-tag ought to support it.
Well I was assuming GNU tools for maintainers, but indeed:
solaris11$ seq 10 | sed -n '1,2='
Only one address allowed: 1,2=
Though { block } supports a range and is portable,
and also allows use to be more efficient.
So I'll make this adjustment instead:
stub_offset=$(sed -n "${stub_range}{=;q;}" "$news")
cheers,
Padraig