svn commit: r227483 - head/usr.sbin/portsnap/portsnap

Jilles Tjoelker jilles at stack.nl
Sun Nov 13 12:21:52 UTC 2011


On Sat, Nov 12, 2011 at 07:25:23PM -0800, Garrett Cooper wrote:
> On Nov 12, 2011, at 7:18 PM, Alfred Perlstein wrote:
> > Author: alfred
> > Date: Sun Nov 13 03:18:57 2011
> > New Revision: 227483
> > URL: http://svn.freebsd.org/changeset/base/227483
[snip]
> > Modified: head/usr.sbin/portsnap/portsnap/portsnap.sh
> > ==============================================================================
> > --- head/usr.sbin/portsnap/portsnap/portsnap.sh	Sun Nov 13 03:01:58 2011	(r227482)
> > +++ head/usr.sbin/portsnap/portsnap/portsnap.sh	Sun Nov 13 03:18:57 2011	(r227483)
> > @@ -570,14 +570,16 @@ fetch_metadata_sanity() {
[snip]
> > +	IFS='|'
> > +	echo "" 1>${QUIETREDIR}
> > +	grep -vE "^([0-9a-f]{64})\|\1$" |
> > +		while read X Y; do
> > +			printf "Processing: $X $Y ...\r" 1>${QUIETREDIR}
> > +			if [ -f "files/${Y}.gz" -o ! -f "files/${X}.gz" ]; then continue; fi
> > +			echo "${X}|${Y}"
> > 		done
> > +	echo "" 1>${QUIETREDIR}
> > +	IFS=
[snip]
> > +	IFS='|'
> > +	while read X Y; do
> > 		if [ ! -f "${X}-${Y}.gz" ]; then continue; fi
> > 		gunzip -c < ${X}-${Y}.gz > diff
> > 		gunzip -c < files/${X}.gz > OLD
> > @@ -707,6 +708,7 @@ fetch_update() {
> > 		fi
> > 		rm -f diff OLD NEW ${X}-${Y}.gz ptmp
> > 	done < patchlist 2>${QUIETREDIR}
> > +	IFS=
> > 	echo "done."
[snip]
> > +	update_run_exract || return 1

> 	Wouldn't

> oldIFS=$IFS
> # Blah blah
> IFS=$oldIFS

> 	be better?

That's too simple, it will change an unset IFS to a null IFS and the
difference between those is major. If IFS is unset, it behaves the same
as IFS=$' \t\n' and if IFS='' it disables field splitting.

Given that you are already using 'local', why not use it everywhere? You
may need to split up some functions to do this.

-- 
Jilles Tjoelker


More information about the svn-src-all mailing list