plpython fails its regression test

Started by Tom Lanealmost 23 years ago6 messages
#1Tom Lane
tgl@sss.pgh.pa.us

In CVS tip, if you run "make installcheck" in src/pl/plpython, the test
fails with a number of diffs between the expected and actual output.
I'm not sure if plpython is broken, or if it's just that someone changed
the behavior and didn't bother to update the test's expected files (the
test files don't seem to have been maintained since they were first
installed).

Comments?

regards, tom lane

#2Greg Copeland
greg@CopelandConsulting.Net
In reply to: Tom Lane (#1)
Re: plpython fails its regression test

On Thu, 2003-01-30 at 16:39, Tom Lane wrote:

In CVS tip, if you run "make installcheck" in src/pl/plpython, the test
fails with a number of diffs between the expected and actual output.
I'm not sure if plpython is broken, or if it's just that someone changed
the behavior and didn't bother to update the test's expected files (the
test files don't seem to have been maintained since they were first
installed).

Comments?

Could this have anything to do with the changes I made to the python
stuff to get it to support longs (IIRC)? It's been a while now so I
don't recall exactly what got changed. I do remember that I chanced
some test code to ensure it tested the newly fixed data type.

Regards,

--
Greg Copeland <greg@copelandconsulting.net>
Copeland Computer Consulting

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Greg Copeland (#2)
Re: plpython fails its regression test

Greg Copeland <greg@copelandconsulting.net> writes:

On Thu, 2003-01-30 at 16:39, Tom Lane wrote:

In CVS tip, if you run "make installcheck" in src/pl/plpython, the test
fails with a number of diffs between the expected and actual output.

Could this have anything to do with the changes I made to the python
stuff to get it to support longs (IIRC)?

The diffs seem to have more to do with error handling --- see attached.

None of the plpython files have changed since November, btw, so I would
imagine you'll see the same behavior in 7.3 or 7.3.1; but I haven't
rebuilt that branch to confirm it.

regards, tom lane

--- error.expected	2002-03-06 13:50:31.000000000 -0500
+++ error.output	2003-01-30 17:18:23.000000000 -0500
@@ -1,12 +1,15 @@
 SELECT invalid_type_uncaught('rick');
-WARNING:  plpython: in function __plpython_procedure_invalid_type_uncaught_49801:
-plpy.SPIError: Cache lookup for type `test' failed.
+WARNING:  plpython: in function __plpython_procedure_invalid_type_uncaught_154373:
+plpy.SPIError: Unknown error in PLy_spi_prepare.
+ERROR:  Type "test" does not exist
 SELECT invalid_type_caught('rick');
-WARNING:  plpython: in function __plpython_procedure_invalid_type_caught_49802:
-plpy.SPIError: Cache lookup for type `test' failed.
+WARNING:  plpython: in function __plpython_procedure_invalid_type_caught_154374:
+plpy.SPIError: Unknown error in PLy_spi_prepare.
+ERROR:  Type "test" does not exist
 SELECT invalid_type_reraised('rick');
-WARNING:  plpython: in function __plpython_procedure_invalid_type_reraised_49803:
-plpy.SPIError: Cache lookup for type `test' failed.
+WARNING:  plpython: in function __plpython_procedure_invalid_type_reraised_154375:
+plpy.SPIError: Unknown error in PLy_spi_prepare.
+ERROR:  Type "test" does not exist
 SELECT valid_type('rick');
  valid_type 
 ------------
@@ -14,20 +17,20 @@
 (1 row)
 SELECT read_file('/etc/passwd');
-ERROR:  plpython: Call of function `__plpython_procedure_read_file_49809' failed.
+ERROR:  plpython: Call of function `__plpython_procedure_read_file_154381' failed.
 exceptions.IOError: can't open files in restricted mode
 SELECT write_file('/tmp/plpython','This is very bad');
-ERROR:  plpython: Call of function `__plpython_procedure_write_file_49810' failed.
+ERROR:  plpython: Call of function `__plpython_procedure_write_file_154382' failed.
 exceptions.IOError: can't open files in restricted mode
 SELECT getpid();
-ERROR:  plpython: Call of function `__plpython_procedure_getpid_49811' failed.
-exceptions.AttributeError: getpid
+ERROR:  plpython: Call of function `__plpython_procedure_getpid_154383' failed.
+exceptions.AttributeError: 'module' object has no attribute 'getpid'
 SELECT uname();
-ERROR:  plpython: Call of function `__plpython_procedure_uname_49812' failed.
-exceptions.AttributeError: uname
+ERROR:  plpython: Call of function `__plpython_procedure_uname_154384' failed.
+exceptions.AttributeError: 'module' object has no attribute 'uname'
 SELECT sys_exit();
-ERROR:  plpython: Call of function `__plpython_procedure_sys_exit_49813' failed.
-exceptions.AttributeError: exit
+ERROR:  plpython: Call of function `__plpython_procedure_sys_exit_154385' failed.
+exceptions.AttributeError: 'module' object has no attribute 'exit'
 SELECT sys_argv();
     sys_argv    
 ----------------
--- feature.expected	2002-10-15 11:24:17.000000000 -0400
+++ feature.output	2003-01-30 17:18:23.000000000 -0500
@@ -36,9 +36,10 @@
 (1 row)
 SELECT import_succeed();
-     import_succeed     
-------------------------
- succeeded, as expected
+NOTICE:  ('import failed -- No module named _sre',)
+             import_succeed             
+----------------------------------------
+ failed, that wasn't supposed to happen
 (1 row)
 SELECT import_test_one('sha hash of this string');
@@ -56,9 +57,9 @@
 select argument_test_one(users, fname, lname) from users where lname = 'doe' order by 1;
                                   argument_test_one                                  
 -------------------------------------------------------------------------------------
- jane doe => {'fname': 'jane', 'userid': 1, 'lname': 'doe', 'username': 'j_doe'}
- john doe => {'fname': 'john', 'userid': 2, 'lname': 'doe', 'username': 'johnd'}
- willem doe => {'fname': 'willem', 'userid': 3, 'lname': 'doe', 'username': 'w_doe'}
+ jane doe => {'lname': 'doe', 'username': 'j_doe', 'userid': 1, 'fname': 'jane'}
+ john doe => {'lname': 'doe', 'username': 'johnd', 'userid': 2, 'fname': 'john'}
+ willem doe => {'lname': 'doe', 'username': 'w_doe', 'userid': 3, 'fname': 'willem'}
 (3 rows)

select nested_call_one('pass this along');

#4Greg Copeland
greg@CopelandConsulting.Net
In reply to: Tom Lane (#3)
Re: plpython fails its regression test

On Thu, 2003-01-30 at 17:09, Tom Lane wrote:

The diffs seem to have more to do with error handling --- see attached.

None of the plpython files have changed since November, btw, so I would
imagine you'll see the same behavior in 7.3 or 7.3.1; but I haven't
rebuilt that branch to confirm it.

Ouch. Nope, I don't think that's my finger prints. ;)

Greg

--
Greg Copeland <greg@copelandconsulting.net>
Copeland Computer Consulting

#5Andrew Bosma
bosma@epigenomix.com
In reply to: Greg Copeland (#4)
Re: plpython fails its regression test

Tom Lane wrote:

In CVS tip, if you run "make installcheck" in src/pl/plpython, the test
fails with a number of diffs between the expected and actual output.
I'm not sure if plpython is broken, or if it's just that someone
changed the behavior and didn't bother to update the test's expected
files (the test files don't seem to have been maintained since they
were first installed).

What version of python are you using? I just ran "make installcheck"
using python 2.1 and the tests passed. I know python 2.2 and later will
fail because the rexec module used to create the restricted execution
environment has been deprecated, and any attempt to use it results in
RuntimeErrors being thrown.

The new-style classes introduced in python 2.2 allow you to trivially
breakout of the restricted environment. There are also known bugs in
the rexec bugs in python 2.1. It's probably wise to not install
plpython as a trusted language, at least until the restricted
environment can be restored.

Andrew

--
Andrew Bosma <bosma@epigenomix.com>

#6Noname
andrew@tbhiv.biomed.brown.edu
In reply to: Andrew Bosma (#5)
Re: plpython fails its regression test

I hate following up my on my own email, especially to say I was wrong.
In a previous message I said plpython passed the regression test here.
It failed, I'll check it out over the weekend.

However, python version 2.2 and later will fail further tests because
of the deprecation of rexec.

Andrew