From owner-cvs-all Sat Sep 1 17:27:54 2001 Delivered-To: cvs-all@freebsd.org Received: from tao.org.uk (genesis.tao.org.uk [212.135.162.62]) by hub.freebsd.org (Postfix) with ESMTP id 6349F37B409; Sat, 1 Sep 2001 17:27:46 -0700 (PDT) Received: by tao.org.uk (Postfix, from userid 100) id 22C082C1; Sun, 2 Sep 2001 01:27:40 +0100 (BST) Date: Sun, 2 Sep 2001 01:27:40 +0100 From: Josef Karthauser To: Paul Richards Cc: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/usr.sbin/pkg_install/update pkg_update.pl Message-ID: <20010902012740.A11122@tao.org.uk> References: <200012300014.eBU0E1238805@freefall.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-md5; protocol="application/pgp-signature"; boundary="ReaqsoxgOBHFXBhH" Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200012300014.eBU0E1238805@freefall.freebsd.org>; from paul@FreeBSD.org on Fri, Dec 29, 2000 at 04:14:01PM -0800 Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --ReaqsoxgOBHFXBhH Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Dec 29, 2000 at 04:14:01PM -0800, Paul Richards wrote: > paul 2000/12/29 16:14:01 PST >=20 > Modified files: > usr.sbin/pkg_install/update pkg_update.pl=20 > Log: > Change open modes from ">$file" to "> $file" because it's much safer sh= ould > $file not be what you expect, particularly should $file turn out to be > "+REQUIRES" since ">+" is a valid open mode. > =20 > This isn't currently a problem since $file is constructed safely but it= removes the potential of future problems. > =20 > Pointed out by Anton Berezin. > =20 > Revision Changes Path > 1.3 +3 -3 src/usr.sbin/pkg_install/update/pkg_update.pl Sorry I've taken so long to get around to this one. Are you sure? The perl docs for 'open' explicitly say that the + needs to come before the >. If the filename begins with '<' or nothing, the file is opened for input. If the filename begins with '>', the file is truncated and opened for output, being created if necessary. If the filename begins with '>>', the file is opened for appending, again being created if necessary. You can put a '+' in front of the '>' or '<' to indicate that you want both read and write access to the file; thus '+<' is almost always preferred for read/write updates--the '+>' mode would clobber the file first. You can't usually use either read-write mode for updating textfiles, since they have variable length records. See the -i switch in perlrun for a better approach. The file is created with permissions of 0666 modified by the process' umask value. Regards, Joe --ReaqsoxgOBHFXBhH Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (FreeBSD) Comment: For info see http://www.gnupg.org iEYEARECAAYFAjuRfPwACgkQXVIcjOaxUBYOWQCfULGI5vjaDIgVFcTECr9MYROn DzsAn3f9cb5V0DwTtCX8N9mssvxeHpcV =QKt9 -----END PGP SIGNATURE----- --ReaqsoxgOBHFXBhH-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message