Skip to content

Commit 59ee944

Browse files
committed
Remove read_file/write_file tests. These were originally intended to
*fail*, to test that plpython didn't allow untrusted operations. When we changed plpython to plpythonu because python didn't actually have a secure sandbox mode, someone (probably me :-() misinterpreted the tests as checking whether Python's file I/O works. Which is a stupid thing for us to be testing. Remove it so we don't clutter the filesystem with random temporary files.
1 parent 9d7c005 commit 59ee944

File tree

4 files changed

+0
-33
lines changed

4 files changed

+0
-33
lines changed

src/pl/plpython/expected/plpython_error.out

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,3 @@ SELECT valid_type('rick');
1919

2020
(1 row)
2121

22-
-- Security sandbox tests
23-
SELECT write_file('/tmp/plpython','Only trusted users should be able to do this!');
24-
write_file
25-
------------------------------
26-
Wrote to file: /tmp/plpython
27-
(1 row)
28-
29-
SELECT read_file('/tmp/plpython');
30-
read_file
31-
-----------------------------------------------
32-
Only trusted users should be able to do this!
33-
(1 row)
34-

src/pl/plpython/expected/plpython_function.out

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -255,13 +255,6 @@ for r in rv:
255255
return seq
256256
'
257257
LANGUAGE plpythonu;
258-
CREATE OR REPLACE FUNCTION read_file(text) RETURNS text AS '
259-
return open(args[0]).read()
260-
' LANGUAGE plpythonu;
261-
CREATE OR REPLACE FUNCTION write_file(text,text) RETURNS text AS '
262-
open(args[0],"w").write(args[1])
263-
return "Wrote to file: %s" % args[0]
264-
' LANGUAGE plpythonu;
265258
--
266259
-- Universal Newline Support
267260
--

src/pl/plpython/sql/plpython_error.sql

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,3 @@ SELECT invalid_type_uncaught('rick');
77
SELECT invalid_type_caught('rick');
88
SELECT invalid_type_reraised('rick');
99
SELECT valid_type('rick');
10-
11-
-- Security sandbox tests
12-
SELECT write_file('/tmp/plpython','Only trusted users should be able to do this!');
13-
SELECT read_file('/tmp/plpython');

src/pl/plpython/sql/plpython_function.sql

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -298,15 +298,6 @@ return seq
298298
'
299299
LANGUAGE plpythonu;
300300

301-
CREATE OR REPLACE FUNCTION read_file(text) RETURNS text AS '
302-
return open(args[0]).read()
303-
' LANGUAGE plpythonu;
304-
305-
CREATE OR REPLACE FUNCTION write_file(text,text) RETURNS text AS '
306-
open(args[0],"w").write(args[1])
307-
return "Wrote to file: %s" % args[0]
308-
' LANGUAGE plpythonu;
309-
310301
--
311302
-- Universal Newline Support
312303
--

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy