maintainer-feedback requested: [Bug 258858] ports-mgmt/pkg: 1.17.2 fails to upgrade en-freebsd-doc and de-freebsd-doc 20210125,1 -> 20210918,1

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 02 Oct 2021 08:56:48 UTC
Bugzilla Automation <bugzilla@FreeBSD.org> has asked freebsd-pkg (Nobody)
<pkg@FreeBSD.org> for maintainer-feedback:
Bug 258858: ports-mgmt/pkg: 1.17.2 fails to upgrade en-freebsd-doc and
de-freebsd-doc 20210125,1 -> 20210918,1
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=258858



--- Description ---
Greetings,

several of my machines require two "pkg upgrade" runs to upgrade the
en-freebsd-doc and de-freebsd-doc packages from 20210125,1 to 20210918,1. 
There is no note of this in ports/CHANGES.  The relevant change is apparently
7ee8c0803bbf5763c4c84bf23ccef422db9a692b.

The workaround appears to be pkg delete-ing the old *-freebsd-doc packages and
reinstalling them by name afterwards. Please add a note of this to
ports/CHANGES.

Data Points as Debugging Aids:

* I have rebuilt the old package from ports
84ebfb568a682d804cdcf77514670c5085a4f368 for FreeBSD:13:* - get it from
https://people.freebsd.org/~mandree/en-freebsd-doc-20210125,1.pkg (35
MibiBytes)

* 1st run: pkg: Fail to rename
/usr/local/share/doc/freebsd/en/articles/bsdl-gpl/.pkgtemp.article.html.bYSz3D0
4nZod
-> /usr/local/share/doc/freebsd/en/articles/bsdl-gpl/article.html:No such file
or directory

* 2nd run: pkg: unlinkat(usr/local/share/doc/freebsd/en): Operation not
permitted


Relevant contents (sorry, de_DE locale for dates but you get the file types):

Old package en-freebsd-doc: 20210125,1
$ ls -ldb /usr/local/share/doc/freebsd/en
lrwxr-xr-x  1 root  wheel  15  1 Okt. 09:27 /usr/local/share/doc/freebsd/en ->
en_US.ISO8859-1

New package en-freebsd-doc: 20210918,1
$ ls -ldb /usr/local/share/doc/freebsd/en
drwxr-xr-x  7 root  wheel  7  1 Okt. 09:41 en


NOTE: Failed upgrades appear to leave the old en_US.ISO8859-1 and other
directories behind, and also .pkg* temp files.


Longer logs:
see attachment for pkg -d upgrade logs.



Reference screenshots of plain pkg upgrade:


First pkg run aborts:

...
Checking for upgrades (7 candidates): 100%
Processing candidates (7 candidates): 100%
The following 2 package(s) will be affected (of 0 checked):

Installed packages to be UPGRADED:
	automake: 1.16.3 -> 1.16.4 [FreeBSD-latest]
	en-freebsd-doc: 20210125,1 -> 20210918,1 [FreeBSD-latest]

Number of packages to be upgraded: 2

The operation will free 13 MiB.
20 MiB to be downloaded.

Proceed with this action? [y/N]: y
[1/2] Fetching en-freebsd-doc-20210918,1.pkg: 100%   20 MiB   1.9MB/s	 00:11 

[2/2] Fetching automake-1.16.4.pkg: 100%  550 KiB 562.9kB/s    00:01	
Checking integrity... done (0 conflicting)
[1/2] Upgrading en-freebsd-doc from 20210125,1 to 20210918,1...
[1/2] Extracting en-freebsd-doc-20210918,1: 100%
pkg: Fail to rename
/usr/local/share/doc/freebsd/en/articles/bsdl-gpl/.pkgtemp.article.html.bYSz3D0
4nZod
-> /usr/local/share/doc/freebsd/en/articles/bsdl-gpl/article.html:No such file
or directory


Second run emits a truckload of errors (see log) but succeeds:

[root@rsv1 ~]# pkg upgrade -y
Updating FreeBSD-latest repository catalogue...
FreeBSD-latest repository is up to date.
Updating local repository catalogue...
local repository is up to date.
All repositories are up to date.
Checking for upgrades (7 candidates): 100%
Processing candidates (7 candidates): 100%
Checking integrity... done (0 conflicting)
The following 2 package(s) will be affected (of 0 checked):

Installed packages to be UPGRADED:
	automake: 1.16.3 -> 1.16.4 [FreeBSD-latest]
	en-freebsd-doc: 20210125,1 -> 20210918,1 [FreeBSD-latest]

Number of packages to be upgraded: 2

The operation will free 13 MiB.
[1/2] Upgrading en-freebsd-doc from 20210125,1 to 20210918,1...
[1/2] Extracting en-freebsd-doc-20210918,1: 100%
pkg: unlinkat(usr/local/share/doc/freebsd/en): Operation not permitted
en-freebsd-doc-20210125,1: missing file
/usr/local/share/doc/freebsd/en_US.ISO8859-1/articles/bsdl-gpl/addenda.html
en-freebsd-doc-20210125,1: missing file
/usr/local/share/doc/freebsd/en_US.ISO8859-1/articles/bsdl-gpl/article.html
...
en-freebsd-doc-20210125,1: missing file
/usr/local/share/doc/freebsd/en_US.ISO8859-1/books/porters-handbook/versions.ht
ml
en-freebsd-doc-20210125,1: missing file
/usr/local/share/doc/freebsd/en_US.ISO8859-1/books/porters-handbook/why-port.ht
ml
en-freebsd-doc-20210125,1: missing file /usr/local/share/doc/freebsd/faq
en-freebsd-doc-20210125,1: missing file /usr/local/share/doc/freebsd/handbook
en-freebsd-doc-20210125,1: missing file
/usr/local/share/licenses/en-freebsd-doc-20210125,1/BSD2CLAUSE
en-freebsd-doc-20210125,1: missing file
/usr/local/share/licenses/en-freebsd-doc-20210125,1/LICENSE
en-freebsd-doc-20210125,1: missing file
/usr/local/share/licenses/en-freebsd-doc-20210125,1/catalog.mk
[2/2] Upgrading automake from 1.16.3 to 1.16.4...
[2/2] Extracting automake-1.16.4: 100%