ports/165308: bsdadminscripts: pkg_upgrade fails to retrieve INDEX for FreeBSD-9.0-RELEASE
Alvin Poon
aspoon at gmail.com
Mon Feb 20 03:30:13 UTC 2012
>Number: 165308
>Category: ports
>Synopsis: bsdadminscripts: pkg_upgrade fails to retrieve INDEX for FreeBSD-9.0-RELEASE
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Mon Feb 20 03:30:12 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator: Alvin Poon
>Release: 9.0-RELEASE
>Organization:
>Environment:
FreeBSD xxx.xxx 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Tue Jan 3 07:46:30 UTC 2012 root at farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64
>Description:
It appears to be a problem with the name "packages-9-release", as the folder available on FTP is actually "packages-9.0-release". (note the .0 in the version)
It seems to affect RELEASE builds only -- once the system switches to STABLE or CURRENT, the corresponding folder on FTP (such as "packages-9-stable") does not include the .x version, and the script should work fine.
>How-To-Repeat:
On a FreeBSD 9.0-RELEASE system:
# pkg_upgrade -aC
fetch: ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-9-release/INDEX:
File unavailable (e.g., file not found, no access)
#
>Fix:
The problem is found in /usr/local/sbin/uma, line 76 onwards:
71 # Logic from src/usr.sbin/pkg_install/add/main.c, plus the
possibility to
72 # override the architecture with ARCH.
73 : ${PACKAGEROOT="ftp://ftp.freebsd.org"}
74 : ${ARCH="$(uname -m)"}
75 branch="$(uname -r | tr '[:upper:]' '[:lower:]')"
76 number="${branch%%.*}"
77 branch="${branch##*-}"
78 case "$branch" in
79 release)
80 branch=$number-$branch
81 ;;
82 stable|current)
83 branch=${number%%.*}-$branch
84 ;;
85 *)
86 # Fallback to stable for prerelease and the like.
87 branch=${number%%.*}-stable
88 ;;
89 esac
On line 76, it arbitrarily removed the .x minor version from the number. It
should have been "number=${branch%%-*}", since the minor version is
further stripped off in the following case statements depending on the
release:
Change line 76 from
number="${branch%%.*}"
to
number="${branch%%-*}"
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list