Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Oct 2012 11:20:28 -0500 (CDT)
From:      "Matthew D.Fuller" <fullermd@over-yonder.net>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   bin/172715: [PATCH] Fix portsnap's INDEX building
Message-ID:  <3XgPyN12HfzWh5@draco.over-yonder.net>
Resent-Message-ID: <201210151630.q9FGU106037066@freefall.freebsd.org>

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

>Number:         172715
>Category:       bin
>Synopsis:       [PATCH] Fix portsnap's INDEX building
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Oct 15 16:30:01 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Matthew D. Fuller
>Release:        FreeBSD 9.0-STABLE amd64
>Organization:
>Environment:
System: FreeBSD draco.over-yonder.net 9.0-STABLE FreeBSD 9.0-STABLE #0 r237357: Thu Jun 21 01:21:37 CDT 2012 root@draco.over-yonder.net:/usr/obj/usr/src/sys/DRACO amd64


	
>Description:

In r227483, portsnap.sh was changed to use $IFS in several places rather
than calling out to cut(1) to split things up by '|'.  However, in
several places, this was done around a block by "IFS='|'" prior and
"IFS=" after, which has the result of leaving IFS set to the empty string
after the fact.

This causes an error when extract_indices() is called after some of the
fetch functions (as will happen when you run a `portsnap fetch update`)
that looks like:

  Building new INDEX files... DESCRIBE.7 INDEX-8 not provided by portsnap server; INDEX-7 not being generated.


To properly return to default behavior, IFS needs to be unset, not set to
empty.  Changes tested via 'extract' and 'fetch update'.

>How-To-Repeat:
	
>Fix:


Index: portsnap.sh
===================================================================
--- portsnap.sh	(revision 241541)
+++ portsnap.sh	(working copy)
@@ -587,7 +587,7 @@
 
 # Take a list of ${oldhash}|${newhash} and output a list of needed patches
 fetch_make_patchlist() {
-	IFS='|'
+	local IFS='|'
 	echo "" 1>${QUIETREDIR}
 	grep -vE "^([0-9a-f]{64})\|\1$" |
 		while read X Y; do
@@ -596,7 +596,6 @@
 			echo "${X}|${Y}"
 		done
 	echo "" 1>${QUIETREDIR}
-	IFS=
 }
 
 # Print user-friendly progress statistics
@@ -725,7 +724,7 @@
 		fi
 		rm -f diff OLD NEW ${X}-${Y}.gz ptmp
 	done < patchlist 2>${QUIETREDIR}
-	IFS=
+	unset IFS
 	echo "done."
 
 # Update metadata without patches
@@ -810,7 +809,7 @@
 		fi
 		rm -f diff OLD NEW ${X}-${Y}
 	done < patchlist 2>${QUIETREDIR}
-	IFS=
+	unset IFS
 	echo "done."
 
 # Update ports without patches
@@ -948,6 +947,8 @@
 		return 0;
 	fi
 
+	unset IFS
+
 	extract_metadata
 	extract_indices
 }

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



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