Re: `pkg autoremove` uninstalls pkg itself

From: Yasuhiro Kimura <yasu_at_FreeBSD.org>
Date: Sun, 21 Apr 2024 18:34:04 UTC
From: Yasuhiro Kimura <yasu@FreeBSD.org>
Subject: Re: `pkg autoremove` uninstalls pkg itself
Date: Sun, 21 Apr 2024 22:30:26 +0900 (JST)

> Just from curiosity I checked out following commit and tested if the
> issue also happens (I selected the commit just because it was
> committed on the release date of 14.0-RELEASE).
> 
> ----------------------------------------------------------------------
> commit 5f5f3d7a8808
> Author:     Piotr Kubaj <pkubaj@FreeBSD.org>
> AuthorDate: Mon Nov 20 15:29:31 2023 +0100
> Commit:     Piotr Kubaj <pkubaj@FreeBSD.org>
> CommitDate: Mon Nov 20 15:32:05 2023 +0100
> 
>     shells/oksh: update to 7.4
> ----------------------------------------------------------------------
> 
> Then output of `pkg query '%a' pkg` is '0' and `pkg autoremove`
> doesn't remove itself. It means something is changed after this commit
> and it is the cause of the issue.
> 
> I tried bisect, and according to the result of it the issue starts
> with following commit.
> 
> ----------------------------------------------------------------------
> commit 830ec3717024
> Author:     Tijl Coosemans <tijl@FreeBSD.org>
> AuthorDate: Wed Mar 6 20:13:39 2024 +0100
> Commit:     Tijl Coosemans <tijl@FreeBSD.org>
> CommitDate: Wed Mar 6 21:22:21 2024 +0100
> 
>     Mk/Scripts/do-depends.sh: Avoid make -D flag
>     
>     Both FreeBSD make and GNU make pass command line flags to sub-makes
>     through the MAKEFLAGS environment variable, but the flags aren't
>     compatible and GNU make 4.4 exits with an error when it encounters
>     flags it doesn't understand, e.g. -D.
>     
>     Avoid using the flag for now until ports run gmake with SETENVI.
>     
>     This fixes the case where a port is built using make directly and it
>     recurses to build a dependency that uses gmake.  Poudriere does not
>     use this feature of the ports tree to build dependencies so it's not
>     affected.
>     
>     PR:             272216, 277492
> ----------------------------------------------------------------------
> 
> As far as I read commit message, the issue of pkg seems to be
> unintended result of this commit.

I submitted the issue to Bugzilla.

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=278511

---
Yasuhiro Kimura