maintainer-feedback requested: [Bug 227193] ports-mgmt/pkg: pkg updating only recognizes exact string matches for port origins

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Mon Apr 2 01:34:47 UTC 2018


Bugzilla Automation <bugzilla at FreeBSD.org> has asked pkg at FreeBSD.org for
maintainer-feedback:
Bug 227193: ports-mgmt/pkg: pkg updating only recognizes exact string matches
for port origins
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=227193



--- Description ---
The Porter's Handbook, section 11.2.1, contains a passage:

Note:

It is recommended that the AFFECTS line contains a glob matching all the ports
affected by the entry so that automated tools can parse it as easily as
possible. If an update concerns all the existing BIND 9 versions the AFFECTS
content must be users of dns/bind9*, it must not be users of BIND 9


However, empirical observations (ref., e.g., the email thread that starts at
<http://docs.FreeBSD.org/cgi/mid.cgi?20180331142525.GE1272>) and inspection of
the code in pkg-1.10.5's src/updating.c:

		tmp = NULL;
		if (found == 0) {
			if (strstr(line, "AFFECTS") != NULL) {
				SLIST_FOREACH(port, &origins, next) {
					if (caseinsensitive) {
						if ((tmp = strcasestr(line,
port->origin)) != NULL) {
							break;
						}
					} else {
						if ((tmp = strstr(line,
port->origin)) != NULL) {
							break;
						}
					}
				}
				if (tmp != NULL) {
					if ((date != NULL) && strncmp(dateline,
date, 8) < 0) {
						continue;
					}
					printf("%s%s",dateline, line);
					found = 1;
				}
			}
		} else {
			printf("%s",line);
		}


shows that "pkg updating" cannot make constructive use of "globs" -- and if
they are specified in ports/UPDATING, "pkg updating" will fail to match such
entries to any installed port, and will thus fail to display the entries for
affected ports.

That said, another way to address the inconsistency (between the Porter's
Handbook recommendation and the code in updating.c) would be to change the
recommendation (and corresponding practice) to only use port origin specifiers
that "pkg updating" will recognize: I am not in a position to make a claim as
to which approach makes more sense (either now or in the future).

(Indeed: it may well be that it may be better to use regular expressions,
rather than globs -- in which case code, documentation, and practice would each
need to change.  But that's not my call.)


More information about the freebsd-pkg mailing list