From khera@kcilink.com  Tue Mar 12 19:20:10 2013
Return-Path: <khera@kcilink.com>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1])
	by hub.freebsd.org (Postfix) with ESMTP id CC121EF
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 12 Mar 2013 19:20:10 +0000 (UTC)
	(envelope-from khera@kcilink.com)
Received: from yertle.kcilink.com (yertle-comcast.kcilink.com [74.92.149.58])
	by mx1.freebsd.org (Postfix) with ESMTP id 8E5D08BE
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 12 Mar 2013 19:20:10 +0000 (UTC)
Received: by yertle.kcilink.com (Postfix, from userid 1002)
	id 648B98A010; Tue, 12 Mar 2013 15:11:04 -0400 (EDT)
Message-Id: <20130312191104.648B98A010@yertle.kcilink.com>
Date: Tue, 12 Mar 2013 15:11:04 -0400 (EDT)
From: Vick Khera <vivek@khera.org>
Reply-To: Vick Khera <vivek@khera.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: pkg update doesn't fetch updated repo from private copy
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         176889
>Category:       ports
>Synopsis:       ports-mgmt/pkg: pkg update doesn't fetch updated repo from private copy
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    portmgr
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Mar 12 19:30:01 UTC 2013
>Closed-Date:    
>Last-Modified:  Wed Mar 13 05:31:32 UTC 2013
>Originator:     Vick Khera
>Release:        FreeBSD 9.1-RELEASE amd64
>Organization:
>Environment:
System: FreeBSD yertle.int.kcilink.com 9.1-RELEASE FreeBSD 9.1-RELEASE #0 r243864: Tue Dec 4 12:09:48 EST 2012 khera@yertle.int.kcilink.com:/usr/obj/u/yertle1/sources/usr9/src/sys/KCI64 amd64


	
>Description:
	

I use tinderbox to make a local package repository with my customizations. On
another system I request pkg to update the repo index, but will only ever do
it if I specify "-f" flag to force it. Otherwise it always says there is no
update needed, even if there is an updated list.

>How-To-Repeat:
	

Set up package server running lighttpd-1.4.32_1. I use this configuration for
the virtual host:

$HTTP["host"] == "pkg.kcilink.com" {
  server.document-root        = "/usr/local/tinderbox/packages/"
}

and in pkg.conf on the clients I set this:

PACKAGESITE         : http://pkg.kcilink.com/9.1-FreeBSD/All



This is the current repo file on that server:

% ls -l /usr/local/tinderbox/packages/9.1-FreeBSD/All/repo.txz
-rw-r--r--  1 root  wheel  146096 Mar 12 14:02 /usr/local/tinderbox/packages/9.1-FreeBSD/All/repo.txz

Now, on the client system using those packages, run update:

[root@sandbox]# pkg -v
1.0.8
[root@sandbox]# ls -l /var/db/pkg/repo.sqlite
-rw-r--r--  1 root  wheel  601088 Mar 12 09:03 /var/db/pkg/repo.sqlite
[root@sandbox]# pkg update
Updating repository catalogue
Repository catalogue is up-to-date, no need to fetch fresh copy
[root@sandbox]# ls -l /var/db/pkg/repo.sqlite
-rw-r--r--  1 root  wheel  601088 Mar 12 09:03 /var/db/pkg/repo.sqlite
[root@sandbox]# pkg update -f
Updating repository catalogue
repo.txz                            100%  143KB 142.7KB/s 142.7KB/s   00:00
[root@sandbox]# ls -l /var/db/pkg/repo.sqlite
-rw-r--r--  1 root  wheel  605184 Mar 12 14:29 /var/db/pkg/repo.sqlite


The only curiosity I see is that the first "pkg update" logs this on the
package server lighttpd.conf file:

192.168.7.23 pkg.kcilink.com - [12/Mar/2013:14:29:03 -0400] "GET /9.1-FreeBSD/All/repo.txz HTTP/1.1" 200 146096 "-" "pkg libfetch/2.0"

and the second update with -f logs this:

192.168.7.23 pkg.kcilink.com - [12/Mar/2013:14:29:16 -0400] "GET /9.1-FreeBSD/All/repo.txz HTTP/1.1" 200 146096 "-" "pkg libfetch/2.0"

Fetching via a snooping proxy, the only difference I see is that the "-f"
request does not send the "If-Modified-Since" header, but in either case
lighttpd sends back the same byte stream and headers in its response.

>Fix:

	


workaround is to always use pkg update -f.
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->portmgr 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Wed Mar 13 05:31:32 UTC 2013 
Responsible-Changed-Why:  
Over to maintainer (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=176889 
>Unformatted:
