Date: Sun, 2 Sep 2001 01:27:40 +0100 From: Josef Karthauser <joe@tao.org.uk> To: Paul Richards <paul@FreeBSD.org> 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> In-Reply-To: <200012300014.eBU0E1238805@freefall.freebsd.org>; from paul@FreeBSD.org on Fri, Dec 29, 2000 at 04:14:01PM -0800 References: <200012300014.eBU0E1238805@freefall.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
On Fri, Dec 29, 2000 at 04:14:01PM -0800, Paul Richards wrote:
> paul 2000/12/29 16:14:01 PST
>
> Modified files:
> usr.sbin/pkg_install/update pkg_update.pl
> Log:
> Change open modes from ">$file" to "> $file" because it's much safer should
> $file not be what you expect, particularly should $file turn out to be
> "+REQUIRES" since ">+" is a valid open mode.
>
> This isn't currently a problem since $file is constructed safely but it removes the potential of future problems.
>
> Pointed out by Anton Berezin.
>
> 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
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (FreeBSD)
Comment: For info see http://www.gnupg.org
iEYEARECAAYFAjuRfPwACgkQXVIcjOaxUBYOWQCfULGI5vjaDIgVFcTECr9MYROn
DzsAn3f9cb5V0DwTtCX8N9mssvxeHpcV
=QKt9
-----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010902012740.A11122>
