From nobody@FreeBSD.org  Mon Nov 19 19:06:01 2012
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 6FE965C2
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 19 Nov 2012 19:06:01 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 5030E8FC08
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 19 Nov 2012 19:06:01 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.5/8.14.5) with ESMTP id qAJJ61rE044169
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 19 Nov 2012 19:06:01 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.5/8.14.5/Submit) id qAJJ61ew044168;
	Mon, 19 Nov 2012 19:06:01 GMT
	(envelope-from nobody)
Message-Id: <201211191906.qAJJ61ew044168@red.freebsd.org>
Date: Mon, 19 Nov 2012 19:06:01 GMT
From: jb <jb.1234abcd@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: portsnap(8) - fix entry validation
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         173725
>Category:       bin
>Synopsis:       portsnap(8) - fix entry validation
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    cperciva
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Nov 19 19:10:01 UTC 2012
>Closed-Date:    
>Last-Modified:  Thu Nov 29 07:04:07 UTC 2012
>Originator:     jb
>Release:        FreeBSD 9.1-RC3 #0
>Organization:
>Environment:
FreeBSD localhost.localdomain 9.1-RC3 FreeBSD 9.1-RC3 #0 r242324: Tue Oct 30 00:18:27 UTC 2012     root@obrian.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386

>Description:
# rm -rf /usr/ports
# portsnap fetch update
Looking up portsnap.FreeBSD.org mirrors... 6 mirrors found.
Fetching snapshot tag from ec2-eu-west-1.portsnap.freebsd.org... done.
Fetching snapshot metadata... done.
Updating from Sun Nov 11 15:54:03 CET 2012 to Mon Nov 19 15:34:57 CET 2012.
Fetching 4 metadata patches... done.
Applying metadata patches... done.
Fetching 0 metadata files... done.
Fetching 24085 patches.....10....20....30....40....50....60....70....80....90...
..
0....24060....24070....24080.. done.
Applying patches... done.
Fetching 18 new ports or files... done.
/usr/ports was not created by portsnap.
You must run 'portsnap extract' before running 'portsnap update'.
#
# ls /usr/ports
ls: /usr/ports: No such file or directory
#

So, the entry did so much work (ca. 5 min, 24085 patches) before aborting
half way and telling user that the env was not set properly up.
With correct entry validation, it should be rejected up front as invalid entry,
even if it applied to the second part ("update"), because the effect of
processing the entire entry ("fetch" plus "update") is lost anyway.

>How-To-Repeat:
as above
>Fix:


>Release-Note:
>Audit-Trail:

From: J B <jb.1234abcd@gmail.com>
To: bug-followup@FreeBSD.org, jb.1234abcd@gmail.com
Cc:  
Subject: Re: bin/173725: portsnap(8) - fix entry validation
Date: Wed, 21 Nov 2012 16:47:15 +0100

 It is not desirable to have a partially successful execution of an entry.
 If I were interested in partial outcomes, I would have requested:
 # portsnap fetch; portsnap update
 
 Check up front and reject entire entry:
 if update
   if no dir portsdir (e.g. /usr/ports), then reject entry
     PORTSDIR not configured or does not exist.
     You must run 'portsnap extract' before running 'portsnap update'.
 
 This advises the user to review and remedy the problem first, which is
 the right thing to do.
Responsible-Changed-From-To: freebsd-bugs->cperciva 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Thu Nov 29 07:03:53 UTC 2012 
Responsible-Changed-Why:  
Over to maintainer. 

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