Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Nov 2011 13:21:50 +0100
From:      Jilles Tjoelker <jilles@stack.nl>
To:        Garrett Cooper <yanegomi@gmail.com>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, Alfred Perlstein <alfred@FreeBSD.org>, src-committers@freebsd.org
Subject:   Re: svn commit: r227483 - head/usr.sbin/portsnap/portsnap
Message-ID:  <20111113122150.GA62828@stack.nl>
In-Reply-To: <32EF12FA-07AC-481C-A407-3C8B578484C4@gmail.com>
References:  <201111130318.pAD3IvGr074144@svn.freebsd.org> <32EF12FA-07AC-481C-A407-3C8B578484C4@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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



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