public inbox for [email protected]  
help / color / mirror / Atom feed
From: Michael Fuhr <[email protected]>
To: Bob <[email protected]>
Cc: [email protected]
Subject: Re: Minor changed needed to doc on untrusted pl/perl example
Date: Fri, 21 Oct 2005 14:51:16 -0600
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

On Fri, Oct 21, 2005 at 01:06:05PM -0500, Bob wrote:
> CREATE FUNCTION badfunc() RETURNS integer AS $$
>     open(TEMP, ">/tmp/badfile");
>     print TEMP "Gotcha!\n";
>     return 1;
> $$ LANGUAGE plperl;
> 
> I believe the code snippet should look like this for it to work correctly:
> 
> CREATE FUNCTION badfunc() RETURNS integer AS $$
>     open(TEMP, ">/tmp/badfile");
>     print TEMP "Gotcha!\n";
>     close(TEMP);
>     return 1;
> $$ LANGUAGE plperl;

The function should work without an explicit close (or it would,
but for the security check).  The file should appear on disk
immediately after the open, although the data might not be flushed
to disk until the file is actually closed, such as when the calling
session's postmaster exits (that's how a plperlu version behaves
on my test system, anyway).  Not that I disagree with adding an
explicit close, but the example should still "work" without it.

-- 
Michael Fuhr




view thread (2+ messages)

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Minor changed needed to doc on untrusted pl/perl example
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox