Bug 247456 - ports-mgmt/pkg: Use of .note.tag to determine osname
Summary: ports-mgmt/pkg: Use of .note.tag to determine osname
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-pkg (Nobody)
Keywords: needs-qa
Depends on:
Reported: 2020-06-21 08:24 UTC by dewayne
Modified: 2020-06-21 10:27 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (pkg)


Note You need to log in before you can comment on or make changes to this bug.
Description dewayne 2020-06-21 08:24:54 UTC
When the innocuous define of NOTE_FREEBSD_VENDOR is changed from
#define NOTE_FREEBSD_VENDOR     "FreeBSD" in 
to contain something other than FreeBSD (I'm storing build/date details)
there is no ABI statement explicit in
these messages are emitted from a 'pkg info -oa'
pkg: failed to get the note section
pkg: failed to get the note section
pkg: Unable to determine ABI
pkg: Cannot parse configuration file!

This was a major surprise when I upgraded the OS.  What broke the pkg system as a result of upgrading stable 12.1 to a later revision??

Explicitly stating the ABI in /usr/local/etc/pkg.conf as 
ABI = "freebsd:12:x86:64";
enabled pkg to function. However every invocation of pkg now results in 
pkg: failed to get the note section
pkg: failed to get the note section

1) that a dependency notice appear in /usr/src/lib/csu/common/notes.h to advise that changing NOTE_FREEBSD_VENDOR will impact the pkg's OS detection mechanism which will require maintenance of the ABI in /usr/local/etc/pkg.conf.
2) pkg suppresses the failure notice as the explicit use of the ABI is sufficient.
3) I would think that a variable named NOTE_FREEBSD_VENDOR could be used by vendors in a manner of their choosing. Though perhaps a better approach would be to add an ELF section explicit for pkg to utilize (something like)
#define PKG_OS FreeBSD 
in /usr/src/lib/csu/common/notes.h
if elf section checking is the best route (?)

(And yes, I know that the latter (3) is no small task) :-(