Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Feb 2003 12:12:12 +0100 (CET)
From:      Foldi Tamas <crow@kapu.hu>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   bin/48525: [PATCH] pkg_add under 5.0-RELEASE
Message-ID:  <20030221111212.2DBED32B2C@mirk.wigner.bme.hu>

next in thread | raw e-mail | index | archive | help

>Number:         48525
>Category:       bin
>Synopsis:       [PATCH] pkg_add under 5.0-RELEASE
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Feb 21 03:20:02 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Foldi Tamas
>Release:        FreeBSD 4.6-STABLE i386
>Organization:
>Environment:

	FreeBSD carma 5.0-RELEASE FreeBSD 5.0-RELEASE #1: Mon Jan 27 15:27:21 CET 2003     root@carma:/usr/obj/usr/src/sys/GENERIC  i386
	
program version: src/usr.sbin/pkg_install/add/main.c,v 1.54.2.1

>Description:
After I upgraded my system to 5.0-RELEASE the "pkg_add -rv" command can not download the port packages:

[crow@carma]% pkg_add -rv bbpager                                    /home/crow
requesting ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-5.0-release/La
t
est/bbpager.tbz
Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-5.0-release/Late
s
t/bbpager.tbz...bzip2: (stdin) is not a bzip2 file.
tar: Child returned status 2
tar: Error exit delayed from previous errors
tar command returns 2 status
 Done.
pkg_add: unable to open table of contents file '+CONTENTS' - not a package?
pkg_add: 1 package addition(s) failed

The requested file on the server does not exists (bad symlink). I would like to change the package release directory, but the pkg_add program does not have option to do this. After I patched the src/usr.sbin/pkg_install/add/main.c, the pkg_add program works correctly with the 5-current release tag:

[crow@carma]% pkg_add -rv -O 5-current bbpager                       /home/crow
requesting ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-5-current/Late
s
t/bbpager.tbz
Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-5-current/Latest/bbpager.tbz...+CONTENTS

 
>How-To-Repeat:

run pkg_add on 5.0 release with 'r' option

>Fix:
The following patch will solve this issue:
(src/usr.sbin/pkg_install/add/main.c)


30c30
< static char Options[] = "hvIRfnrp:SMt:";
---
> static char Options[] = "hvIRfnrp:SMt:O:";
68a69
> char	*Osrelease	= NULL; 
127a129,132
> 	case 'O':
> 		Osrelease = optarg;
> 		break;
> 
258,262c263,265
<     reldate = getosreldate();
<     for(i = 0; releases[i].directory != NULL; i++) {
< 	if (reldate >= releases[i].lowver && reldate <= releases[i].hiver) {
< 	    if (strlcat(sitepath, releases[i].directory, sizeof(sitepath))
< 		>= sizeof(sitepath))
---
> 	if ( Osrelease ) {
> 		if (strlcat(sitepath, "/packages-", sizeof(sitepath))
> 				>= sizeof(sitepath))
264c267,279
< 	    break;
---
> 		if (strlcat(sitepath, Osrelease, sizeof(sitepath))
> 				>= sizeof(sitepath))
> 		return NULL;
> 	} else {
> 	    reldate = getosreldate();
> 	   	for(i = 0; releases[i].directory != NULL; i++) {
> 		if (reldate >= releases[i].lowver && reldate <= releases[i].hiver) {
> 		    if (strlcat(sitepath, releases[i].directory, sizeof(sitepath))
> 			>= sizeof(sitepath))
> 			return NULL;
> 		    break;
> 		}
> 	   	}
266d280
<     }
279c293
< 		"usage: pkg_add [-vInrfRMS] [-t template] [-p prefix]",
---
> 		"usage: pkg_add [-vInrfRMS] [-O osrelease] [-t template] [-p prefix]",



>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030221111212.2DBED32B2C>