From nobody Wed May 15 15:01:39 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VfbzR6YCgz5L1gD for ; Wed, 15 May 2024 15:01:55 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VfbzR4nwQz4Lb8 for ; Wed, 15 May 2024 15:01:55 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-51ff65b1e14so7731553e87.2 for ; Wed, 15 May 2024 08:01:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20230601.gappssmtp.com; s=20230601; t=1715785311; x=1716390111; darn=freebsd.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=KoN8vB4x1dyinzCuMvFy2dANeNO9HP0snCSOYTXo4PQ=; b=OjVoJGZSDAOZ1Hdny/eniZqPwKrc4WuhuZznxY8Nds4a6euQpkZ8B3sEzB8oKmhxGu 6JT1wfpnnIZSZg2gkhGHBFP0ydl1ag2TJAgt19UBjrgLfF4mrwpHqvFlLfWkuTDyhruQ A7UQr4RJx1S+TjLH+As1m9Ns1JFCqAzb31VXQYR0rN7Px2f08cH+suVBwTlFJ9dK0nbG 7ds/GxXvQVxWmd4foDMOawSnLklYsGUqLISGF5EkAJZucDJOTKrT/19cIygx0TYegrPD v2ZZ9wc/JTaJOSrUkW2yWPbiLG5GumiCdlCyYJWCaF02PQA4KfCv0/GAzkbT0m1QHCkH 90vA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715785311; x=1716390111; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=KoN8vB4x1dyinzCuMvFy2dANeNO9HP0snCSOYTXo4PQ=; b=JBD5DyDcU/2Ig2a+Eyq/bnIkLNanBVTGyxSZH0KKBOcg9RxWM+vSfFtWyar8CBPfRs lOCqPC9Ns2KXsORrwseD7El7fZcMiNh8TF3f/MUJ/js7F2dZliu//frG22hHS4qPl0Cy 9gfZx1w3PSYBUCt35KPXVq/sSmc9LHxSKvIfxPAwS76UJeAkIWUJN4AP2zIGuyN+nLFF AZcuYxK0wV/EjmSd2nJziYJtLir+p/l6GeVn7fYTowktIHhiUa5PTXryRwArg5iXUR2g Ao+20NXjkUSDsHl8+KFMM4siZJXvIwVdl8fZM8Dn3TOz9xGZ6wOCRJc3vgInJ21Cp0Ah W4iA== X-Forwarded-Encrypted: i=1; AJvYcCUtj4urvY/35+W+gvgl0+8AUCavDkrGrYtHnGhMUPiQ3F+uC6KC/yBaOEYW1Hgmi1rHkj+LO0Mqzzlztr53EEOT4UVhWa9FjSiyaENaGD2k X-Gm-Message-State: AOJu0Yxuh8/yGgZf0cYg5tXII+pvZqUJRKkUKziF3qOtYk0GWkIBWyRW SNFOKxn3tugartTSp2oCb3EVuRpikqCbdVq9LdCJPeiClyrEElopAqQyQBKIqA8/N1yZL5EfIh7 jzPNlhA6SM8Z1cN7Pyk+BbIQ9rzSx/yeUfpA8pA== X-Google-Smtp-Source: AGHT+IEiUsKzWPYtZH9N74StRZLSflnpXKtjNDj/dhgS7sasZC8YaVjyaEt1zPcoukl37ZcmdLZDi9QPOPXxq1dV37g= X-Received: by 2002:a19:5e13:0:b0:51c:cd6d:ad21 with SMTP id 2adb3069b0e04-5221007026fmr9679464e87.47.1715785310840; Wed, 15 May 2024 08:01:50 -0700 (PDT) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 References: <202405150953.44F9rvSw043707@gitrepo.freebsd.org> <865xvfz90f.fsf@ltc.des.dev> In-Reply-To: <865xvfz90f.fsf@ltc.des.dev> From: Warner Losh Date: Wed, 15 May 2024 09:01:39 -0600 Message-ID: Subject: Re: git: b5fb1f44ed43 - main - Issue #237 : Resolver uses nameserver commented out in /etc/resolv.conf To: =?UTF-8?Q?Dag=2DErling_Sm=C3=B8rgrav?= Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: multipart/alternative; boundary="000000000000f6d34206187f65b9" X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US] X-Rspamd-Queue-Id: 4VfbzR4nwQz4Lb8 --000000000000f6d34206187f65b9 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, May 15, 2024 at 4:04=E2=80=AFAM Dag-Erling Sm=C3=B8rgrav wrote: > Dag-Erling Sm=C3=B8rgrav writes: > > The branch main has been updated by des: > > > > URL: > https://cgit.FreeBSD.org/src/commit/?id=3Db5fb1f44ed435fa25fe3de87c9b9ee6= c0aad5125 > > > > commit b5fb1f44ed435fa25fe3de87c9b9ee6c0aad5125 > > Author: Willem Toorop > > AuthorDate: 2024-05-07 12:43:16 +0000 > > Commit: Dag-Erling Sm=C3=B8rgrav > > CommitDate: 2024-05-15 09:52:49 +0000 > > > > Issue #237 : Resolver uses nameserver commented out in > /etc/resolv.conf > > > > This /etc/resolv.conf: > > # x > > > > # nameserver 8.8.8.8 > > > > Still configured 8.8.8.8 as nameserver, because the comment > detection in `ldns_resolver_new_frm_fp_l()` didn't anticipate empty lines > before the comment. > > This fix removed all comment handling from > `ldns_resolver_new_frm_fp_l()`. Instead a new function is introduced > `ldns_fget_token_l_resolv_conf()` that skips comments that start with '#' > and ';'. The old `ldns_fget_token_l()` (that is used for zonefiles too) > still accepts only ';' for comments. > > --- > > contrib/ldns/parse.c | 35 +++++++++++++++++++++++++++---- > > contrib/ldns/resolver.c | 55 > ++++++++++--------------------------------------- > > 2 files changed, 42 insertions(+), 48 deletions(-) > > I actually did this as a subtree merge: > > % git subtree merge --prefix=3Dcontrib/ldns vendor/ldns > Merge made by the 'ort' strategy. > contrib/ldns/parse.c | 35 +++++++++++++++++++++++++++---- > contrib/ldns/resolver.c | 55 > ++++++++++--------------------------------------- > 2 files changed, 42 insertions(+), 48 deletions(-) > % git show > % git commit --amend > [main 2dbd65dc861c] ldns: Ignore commented-out lines in resolv.conf. > Date: Wed May 15 11:50:11 2024 +0200 > % git commit --amend > [main bee1ed74ab26] ldns: Ignore commented-out lines in resolv.conf. > Date: Wed May 15 11:50:11 2024 +0200 > > However, I had to rebase before pushing and that appears to have dropped > the merge commit, and I didn't notice until after I'd pushed. > > % git reflog > b5fb1f44ed43 (HEAD -> main, freebsd/main, freebsd/HEAD) HEAD@{0}: pull > --rebase (finish): returning to refs/heads/main > b5fb1f44ed43 (HEAD -> main, freebsd/main, freebsd/HEAD) HEAD@{1}: pull > --rebase (pick): Issue #237 : Resolver uses nameserver commented out in > /etc/resolv.conf > 61dece6d27fb (github/main) HEAD@{2}: pull --rebase (start): checkout > 61dece6d27fb2436928ca93d65667b358e05aa7b > bee1ed74ab26 HEAD@{3}: commit (amend): ldns: Ignore commented-out lines > in resolv.conf. > 2dbd65dc861c HEAD@{4}: commit (amend): ldns: Ignore commented-out lines > in resolv.conf. > 74ce793d921d HEAD@{5}: merge 0c57cb21e0c6a8a86fa074baeaeb6a002e2b7734: > Merge made by the 'ort' strategy. > 61dece6d27fb (github/main) HEAD@{6}: pull --rebase: Fast-forward > The next merge should be fine. git will eliminate the already applied deltas. It can usually do this even if you just always cherry-pick, but as the span gets larger and larger, the algorithms inside of git break down. We've had this issue with ACPICA, but as far as I know, nothing else (I've fixed it, or have a tree with it fixed somewhere). So missing a merge commit occasionally generates only a little confusion, but usually isn't a huge deal for the maintainer's next merge. There's no way to fix it after the fact (well, you can do a revert commit and then redo the subtree merge, but that's a lot of churn for almost no benefit). The vendor branch handbook section has information on what to do when you lose the "push race" since rebase with merge commits is 'fragile'. There's ways one can do it, but they only sometimes work. Or they are dropped entirely (like you experienced). Ed Maste also has a recipe that I find to be riskier, but would be more efficient for scripting. The tl;dr is: update vendor branch, etc then git checkout main git subtree merge create branch JUNK to save your work git checkout -B main freebsd/main (abandoning the merge commit on main) git checkout JUNK git merge main (yes, this is a merge commit, but it creates a 'loop' so you can't push it, it's a bookmark to save your work) git checkout main git subtree merge (same as above) git checkout JUNK . (the . is important, since that overwrites the current tree with the contents of JUNK, rather than moving to the branch) git push (hope you don't lose the race again, otherwise go back to ) git branch -D JUNK (you don't need it anymore, it was just to save the merged result). Though often if there's no conflicts that need to be fixed in the subtree merge, the above is overkill. Just do the subtree merge from a clean main. It's faster and simpler. But honestly, this should be one of the things we have a script for since the above is tedious and error-prone.... I often forget something if I'm doing this under the gun. Warner --000000000000f6d34206187f65b9 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Wed, May 15, 2024 at 4:04=E2=80=AF= AM Dag-Erling Sm=C3=B8rgrav <des@free= bsd.org> wrote:
Dag-Erling Sm=C3=B8rgrav <des@FreeBSD.org> writes:
> The branch main has been updated by des:
>
> URL: https://= cgit.FreeBSD.org/src/commit/?id=3Db5fb1f44ed435fa25fe3de87c9b9ee6c0aad5125<= /a>
>
> commit b5fb1f44ed435fa25fe3de87c9b9ee6c0aad5125
> Author:=C2=A0 =C2=A0 =C2=A0Willem Toorop <
willem@nlnetlabs.nl>
> AuthorDate: 2024-05-07 12:43:16 +0000
> Commit:=C2=A0 =C2=A0 =C2=A0Dag-Erling Sm=C3=B8rgrav <des@FreeBSD.or= g>
> CommitDate: 2024-05-15 09:52:49 +0000
>
>=C2=A0 =C2=A0 =C2=A0Issue #237 : Resolver uses nameserver commented out= in /etc/resolv.conf
>=C2=A0 =C2=A0 =C2=A0
>=C2=A0 =C2=A0 =C2=A0This /etc/resolv.conf:
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0# x
>=C2=A0 =C2=A0 =C2=A0
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0# nameserver 8.8.8.8
>=C2=A0 =C2=A0 =C2=A0
>=C2=A0 =C2=A0 =C2=A0Still configured 8.8.8.8 as nameserver, because the= comment detection in `ldns_resolver_new_frm_fp_l()` didn't anticipate = empty lines before the comment.
>=C2=A0 =C2=A0 =C2=A0This fix removed all comment handling from `ldns_re= solver_new_frm_fp_l()`. Instead a new function is introduced `ldns_fget_tok= en_l_resolv_conf()` that skips comments that start with '#' and = 9;;'. The old `ldns_fget_token_l()` (that is used for zonefiles too) st= ill accepts only ';' for comments.
> ---
>=C2=A0 contrib/ldns/parse.c=C2=A0 =C2=A0 | 35 +++++++++++++++++++++++++= ++----
>=C2=A0 contrib/ldns/resolver.c | 55 ++++++++++-------------------------= --------------
>=C2=A0 2 files changed, 42 insertions(+), 48 deletions(-)

I actually did this as a subtree merge:

% git subtree merge --prefix=3Dcontrib/ldns vendor/ldns
Merge made by the 'ort' strategy.
=C2=A0contrib/ldns/parse.c=C2=A0 =C2=A0 | 35 +++++++++++++++++++++++++++---= -
=C2=A0contrib/ldns/resolver.c | 55 ++++++++++------------------------------= ---------
=C2=A02 files changed, 42 insertions(+), 48 deletions(-)
% git show
% git commit --amend
[main 2dbd65dc861c] ldns: Ignore commented-out lines in resolv.conf.
=C2=A0Date: Wed May 15 11:50:11 2024 +0200
% git commit --amend=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
[main bee1ed74ab26] ldns: Ignore commented-out lines in resolv.conf.
=C2=A0Date: Wed May 15 11:50:11 2024 +0200

However, I had to rebase before pushing and that appears to have dropped the merge commit, and I didn't notice until after I'd pushed.

% git reflog
b5fb1f44ed43 (HEAD -> main, freebsd/main, freebsd/HEAD) HEAD@{0}: pull -= -rebase (finish): returning to refs/heads/main
b5fb1f44ed43 (HEAD -> main, freebsd/main, freebsd/HEAD) HEAD@{1}: pull -= -rebase (pick): Issue #237 : Resolver uses nameserver commented out in /etc= /resolv.conf
61dece6d27fb (github/main) HEAD@{2}: pull --rebase (start): checkout 61dece= 6d27fb2436928ca93d65667b358e05aa7b
bee1ed74ab26 HEAD@{3}: commit (amend): ldns: Ignore commented-out lines in = resolv.conf.
2dbd65dc861c HEAD@{4}: commit (amend): ldns: Ignore commented-out lines in = resolv.conf.
74ce793d921d HEAD@{5}: merge 0c57cb21e0c6a8a86fa074baeaeb6a002e2b7734: Merg= e made by the 'ort' strategy.
61dece6d27fb (github/main) HEAD@{6}: pull --rebase: Fast-forward

The next merge should be fine. git will eliminate= the already applied deltas. It can usually do this even if you just always= cherry-pick, but as the span gets larger and larger, the algorithms inside= of git break down. We've had this issue with ACPICA, but as far as I k= now, nothing else (I've fixed it, or have a tree with it fixed somewher= e). So missing a merge commit occasionally=C2=A0 generates only a little co= nfusion, but usually isn't a huge deal for the maintainer's next me= rge. There's no way to fix it after the fact (well, you can do a revert= commit and then redo the subtree merge, but that's a lot of churn for = almost no benefit).

The vendor branch handbook sec= tion has information on what to do when you lose the "push race" = since rebase with merge commits is 'fragile'. There's ways one = can do it, but they only sometimes work. Or they are dropped entirely (like= you experienced). Ed Maste also has a recipe=C2=A0that I find to be riskie= r, but would be more efficient for scripting. The tl;dr is:

<= /div>
update vendor branch, etc then git checkout main
gi= t subtree merge
<lose the race>
create branch JUN= K to save your work
git checkout -B main freebsd/main (abandoning= the merge commit on main)
git checkout JUNK
git merge = main (yes, this is a merge commit, but it creates a 'loop' so you c= an't push it, it's a bookmark to save your work)
git chec= kout main
git subtree merge (same as above)
git checkou= t JUNK . (the . is important, since that overwrites the current tree with t= he contents of JUNK, rather than moving to the branch)
git push (= hope you don't lose the race again, otherwise go back to <lose the r= ace>)
git branch -D JUNK (you don't need it anymore, it wa= s just to save the merged result).

Though often if= there's no conflicts that need to be fixed in the subtree merge, the a= bove is overkill. Just do the subtree merge from a clean main. It's fas= ter and simpler.

But honestly, this should be one = of the things we have a script for since the above is tedious and error-pro= ne.... I often forget something if I'm doing this under the gun.
<= div>
Warner
--000000000000f6d34206187f65b9--